/* =========================================================
   МорфФорум — гжель, переосмысленная современно
   Чистый CSS, без препроцессоров и фреймворков.
   ========================================================= */

:root {
  --ink: #131B2E;
  --ink-soft: #34405A;
  --muted: #5B6B82;
  --porcelain: #F6F7FA;
  --surface: #FFFFFF;
  --line: #E4E9F1;
  --blue: #1E52A0;
  --blue-deep: #0F2E5E;
  --blue-soft: #EAF1FC;
  --gold: #B98A3E;
  --gold-tint: #F6EEDD;
  --danger: #A23B34;
  --danger-tint: #FBEBE9;
  --ok: #1F7A52;
  --ok-tint: #E7F5EE;

  --font-display: "PT Serif", Georgia, "Times New Roman", serif;
  --font-body: "PT Sans", -apple-system, "Segoe UI", Roboto, sans-serif;

  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(15, 46, 94, 0.06);
  --shadow-md: 0 12px 28px -14px rgba(15, 46, 94, 0.28);
}

* { box-sizing: border-box; }
html { scroll-padding-top: env(safe-area-inset-top, 0px); }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--porcelain);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 0.4em;
  color: var(--blue-deep);
  letter-spacing: -0.01em;
}
h2, h3 {
  font-family: var(--font-body);
  font-weight: 700;
  line-height: 1.3;
  margin: 0 0 0.4em;
  color: var(--ink);
  letter-spacing: -0.005em;
}

p { margin: 0 0 1em; color: var(--ink-soft); }
a { color: var(--blue); }
code {
  background: var(--blue-soft);
  color: var(--blue-deep);
  padding: 0.1em 0.4em;
  border-radius: 5px;
  font-size: 0.9em;
}

button, input, select, textarea { font-family: inherit; font-size: inherit; }

:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

.scroll-divider { width: 56px; height: 10px; margin: 0.3rem 0 1.1rem; opacity: 0.7; }

/* ---- Иконки ---- */
.icon-badge {
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0; color: var(--blue);
}
.icon-badge svg { width: 100%; height: 100%; }

/* ---- Кнопки ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5em;
  border: 1px solid transparent; border-radius: 999px;
  padding: 0.7em 1.3em; font-size: 0.94rem; font-weight: 700; font-family: var(--font-body);
  cursor: pointer; transition: background-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}
.btn-primary { background: var(--blue); color: #fff; box-shadow: 0 6px 16px -6px rgba(30,82,160,0.55); }
.btn-primary:hover { background: var(--blue-deep); transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.55; cursor: default; transform: none; box-shadow: none; }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--ink-soft); }
.btn-ghost:hover { border-color: var(--blue); color: var(--blue); }
.btn-ghost:disabled { opacity: 0.55; cursor: default; }
.btn-sm { padding: 0.45em 0.9em; font-size: 0.84rem; }
.btn-danger { background: var(--danger-tint); color: var(--danger); }
.btn-danger:hover { background: #F3D9D6; }
.btn-ok { background: var(--ok-tint); color: var(--ok); }
.btn-ok:hover { background: #D7EFE2; }

/* ---- Формы ---- */
.field { display: block; margin-bottom: 1.15rem; }
.field label { display: block; font-size: 0.85rem; color: var(--ink-soft); margin-bottom: 0.4rem; font-weight: 600; }
.field input, .field select, .field textarea {
  width: 100%; padding: 0.7em 0.9em; border: 1px solid var(--line);
  border-radius: var(--r-sm); background: var(--surface); color: var(--ink);
}
.field textarea { resize: vertical; min-height: 4.5em; line-height: 1.45; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--blue); }
.field-hint { font-size: 0.8rem; color: var(--muted); margin-top: 0.3rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
@media (max-width: 620px) { .form-grid { grid-template-columns: 1fr; } }
.form-grid .field.full { grid-column: 1 / -1; }

.error-text {
  color: var(--danger); background: var(--danger-tint); border-radius: var(--r-sm);
  padding: 0.65em 0.9em; font-size: 0.9rem; margin-bottom: 1rem;
}
.error-text[hidden] { display: none; }
.success-text {
  color: var(--ok); background: var(--ok-tint); border-radius: var(--r-sm);
  padding: 0.65em 0.9em; font-size: 0.9rem; margin-bottom: 1rem;
}
.success-text[hidden] { display: none; }

/* ---- Страница входа ---- */
.login-shell { min-height: 100svh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
@media (max-width: 860px) { .login-shell { grid-template-columns: 1fr; } .login-brand { min-height: 300px; } }

.login-brand {
  background: linear-gradient(150deg, var(--blue) 0%, var(--blue-deep) 100%);
  color: #fff; display: flex; flex-direction: column; justify-content: space-between;
  padding: clamp(1.6rem, 4vw, 3.5rem); position: relative; overflow: hidden;
}

.login-brand .glow {
  position: absolute; width: 420px; height: 420px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.16) 0%, transparent 70%);
  top: -120px; right: -140px; pointer-events: none;
}

.login-brand .corner { position: absolute; width: 96px; height: 96px; opacity: 0.4; pointer-events: none; }
.login-brand .corner.tl { top: 22px; left: 22px; }
.login-brand .corner.br { bottom: 22px; right: 22px; transform: scale(-1,-1); }

.login-brand .brand-body { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 1.2rem; }
.login-brand .crest {
  width: 68px; height: 68px; border-radius: 50%;
  background: rgba(255,255,255,0.08); padding: 14px;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.25) inset;
}
.login-brand .mark { font-family: var(--font-display); font-size: clamp(1.25rem, 2.2vw, 1.5rem); letter-spacing: 0.02em; }
.login-brand .tagline { font-family: var(--font-display); font-size: clamp(1.7rem, 3.6vw, 2.5rem); max-width: 18ch; color: #fff; margin: 0; }
.login-brand .sub-tagline { color: rgba(255,255,255,0.82); font-size: 0.98rem; max-width: 34ch; }

.login-brand .events { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 0.55rem; font-size: 0.9rem; color: rgba(255,255,255,0.92); border-top: 1px solid rgba(255,255,255,0.25); padding-top: 1.1rem; }
.login-brand .events span { display: flex; align-items: center; gap: 0.55rem; }
.login-brand .events .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); flex-shrink: 0; }

.login-form-side { display: flex; align-items: center; justify-content: center; padding: clamp(1.6rem, 4vw, 3rem); background: var(--porcelain); }
.login-form-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-md); padding: 2rem; }
.login-form-card h1 { font-size: 1.5rem; margin-bottom: 0.2rem; font-family: var(--font-body); font-weight: 800; color: var(--ink); }
.login-form-card .sub { color: var(--muted); font-size: 0.92rem; margin-bottom: 1.5rem; }
.login-form-card .btn-primary { width: 100%; margin-top: 0.3rem; }
.login-foot { margin-top: 1.4rem; font-size: 0.85rem; color: var(--muted); }

/* ---- Общий каркас ---- */
.admin-shell { min-height: 100svh; display: grid; grid-template-columns: 252px 1fr; grid-template-rows: 100svh; }
@media (max-width: 780px) { .admin-shell { grid-template-columns: 1fr; } .admin-sidebar { display: none; } .admin-sidebar.open { display: block; } }

.admin-sidebar {
  background: linear-gradient(190deg, var(--blue-deep) 0%, #081B3B 100%);
  color: #E8EEF6; padding: 0 0 1rem; overflow-y: auto;
}
.admin-sidebar .brand {
  font-family: var(--font-display); font-size: 1.05rem; color: #fff;
  padding: 1.2rem 1.4rem 1.1rem; border-bottom: 1px solid rgba(255,255,255,0.14);
  margin-bottom: 0.7rem; display: flex; align-items: center; gap: 0.7rem;
}
.admin-sidebar .brand svg { width: 24px; height: 24px; flex-shrink: 0; }

.nav-group { padding: 0.9rem 1.4rem 0.35rem; font-size: 0.76rem; color: rgba(232,238,246,0.5); }
.nav-list { list-style: none; margin: 0 0 0.4rem; padding: 0; }
.nav-item button {
  width: 100%; text-align: left; background: transparent; border: none;
  border-radius: 0 999px 999px 0; margin-right: 0.6rem;
  color: rgba(232,238,246,0.82); padding: 0.62rem 1.4rem; font-size: 0.92rem;
  cursor: pointer; display: flex; align-items: center; gap: 0.65rem;
  transition: background-color 150ms ease;
}
.nav-item button:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-item.active button { background: rgba(255,255,255,0.14); color: #fff; box-shadow: inset 3px 0 0 var(--gold); }

.admin-main { display: flex; flex-direction: column; min-width: 0; }
.admin-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.7rem; border-bottom: 1px solid var(--line); background: var(--surface);
}
.admin-topbar .title-block h2 { font-size: 1.2rem; margin: 0; }
.admin-topbar .title-block .desc { font-size: 0.85rem; color: var(--muted); }
.admin-topbar .user-block { display: flex; align-items: center; gap: 0.9rem; font-size: 0.88rem; color: var(--ink-soft); }

.menu-toggle { display: none; background: transparent; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 0.4em 0.6em; margin-right: 0.6rem; cursor: pointer; }
@media (max-width: 780px) { .menu-toggle { display: inline-flex; } }

.admin-content { padding: 1.8rem; overflow-y: auto; flex: 1; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); padding: 1.5rem; margin-bottom: 1.3rem; }

.stat-strip { display: flex; flex-wrap: wrap; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-sm); margin-bottom: 1.5rem; overflow: hidden; }
.stat { flex: 1 1 140px; padding: 1.2rem 1.4rem; border-right: 1px solid var(--line); }
.stat:last-child { border-right: none; }
.stat .value { font-variant-numeric: tabular-nums; font-size: 1.8rem; font-weight: 800; color: var(--blue); }
.stat .label { font-size: 0.82rem; color: var(--muted); margin-top: 0.2rem; }

.empty-state { border: 1px dashed var(--line); border-radius: var(--r-md); padding: 2.2rem 1.4rem; text-align: center; color: var(--muted); }
.empty-state strong { display: block; color: var(--ink); font-size: 1rem; margin-bottom: 0.3rem; }

table.data-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
table.data-table th { text-align: left; font-weight: 700; color: var(--blue-deep); border-bottom: 2px solid var(--line); padding: 0.6em 0.7em; }
table.data-table td { border-bottom: 1px solid var(--line); padding: 0.6em 0.7em; color: var(--ink-soft); }

.section-view[hidden] { display: none; }

/* ---- Личный кабинет: Главная ---- */
.home-hero { margin-bottom: 1.5rem; }
.home-hero .eyebrow { color: var(--muted); font-size: 0.95rem; margin: 0; }
.home-hero h1 { font-size: 2rem; margin: 0.15rem 0 0.2rem; }

.now-list, .event-list { display: flex; flex-direction: column; gap: 0.8rem; }

.now-card, .event-card {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-md); padding: 1rem 1.2rem;
  box-shadow: var(--shadow-sm); transition: box-shadow 150ms ease, transform 150ms ease;
}
.now-card.clickable { cursor: pointer; }
.now-card:hover, .event-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.doc-item { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; padding: 0.8rem 0; border-bottom: 1px solid var(--line); }
.doc-item:last-child { border-bottom: none; }
.doc-item .doc-title { font-weight: 700; color: var(--ink); }
.doc-item .doc-meta { font-size: 0.82rem; color: var(--muted); }

.competition-desc { font-size: 0.9rem; color: var(--ink-soft); margin-top: 0.3rem; }
.competition-block .desc-field { margin-top: 0.8rem; }

.now-card .icon-badge, .event-card .icon-badge {
  width: 46px; height: 46px; border-radius: 14px; background: var(--blue-soft); padding: 11px;
}
.now-card .body, .event-card .body { flex: 1; min-width: 0; }
.now-card .body .title, .event-card .body .title { font-weight: 700; color: var(--ink); }
.now-card .body .meta, .event-card .body .date { font-size: 0.85rem; color: var(--muted); margin-top: 0.15rem; }
.now-card .badge { font-size: 0.74rem; font-weight: 700; color: var(--gold); border: 1px solid var(--gold); border-radius: 999px; padding: 0.22em 0.75em; white-space: nowrap; }
.event-card .btn { flex-shrink: 0; }

.quick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0.9rem; }
.quick-tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 0.7rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 1.1rem; cursor: pointer; text-align: left; font-family: inherit;
  box-shadow: var(--shadow-sm); transition: box-shadow 150ms ease, transform 150ms ease;
}
.quick-tile:hover:not(:disabled) { border-color: var(--blue); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.quick-tile:disabled { opacity: 0.5; cursor: default; }
.quick-tile .icon-badge { width: 34px; height: 34px; }
.quick-tile .label { font-weight: 700; color: var(--ink); font-size: 0.92rem; }

/* ---- Статус-пилюли (заявки) ---- */
.status-pill { display: inline-flex; align-items: center; font-size: 0.76rem; font-weight: 700; padding: 0.28em 0.75em; border-radius: 999px; white-space: nowrap; }
.status-draft { background: var(--line); color: var(--ink-soft); }
.status-submitted, .status-under_review { background: var(--blue-soft); color: var(--blue-deep); }
.status-approved { background: var(--ok-tint); color: var(--ok); }
.status-rejected { background: var(--danger-tint); color: var(--danger); }
.status-live { background: var(--gold-tint); color: var(--gold); }
.status-live .live-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--gold); margin-right: 0.4em; animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .status-live .live-dot { animation: none; } }

/* ---- Расписание ---- */
.schedule-day { margin-bottom: 1.5rem; }
.schedule-day h3 { font-size: 0.98rem; color: var(--blue-deep); margin-bottom: 0.7rem; }
.schedule-item {
  display: flex; gap: 1rem; align-items: flex-start; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-md); padding: 0.9rem 1.1rem;
  margin-bottom: 0.6rem; box-shadow: var(--shadow-sm);
}
.schedule-item .time { font-variant-numeric: tabular-nums; font-weight: 800; color: var(--blue); min-width: 92px; flex-shrink: 0; }
.schedule-item .body { flex: 1; min-width: 0; }
.schedule-item .title { font-weight: 700; color: var(--ink); }
.schedule-item .loc { font-size: 0.85rem; color: var(--muted); margin-top: 0.15rem; }
.schedule-item .status-select {
  border: 1px solid var(--line); border-radius: 999px; padding: 0.3em 0.8em;
  font-size: 0.78rem; font-weight: 700; background: var(--surface); color: var(--ink-soft); cursor: pointer;
}
.schedule-item .reschedule-note { font-size: 0.78rem; color: var(--gold); font-weight: 700; margin-top: 0.25rem; }
.schedule-item .item-controls { display: flex; flex-direction: column; align-items: flex-end; gap: 0.4rem; flex-shrink: 0; }
.schedule-item .item-actions { display: flex; gap: 0.4rem; }
.schedule-item .item-actions button {
  border: none; background: none; color: var(--muted); font-size: 0.78rem; font-weight: 700;
  cursor: pointer; font-family: inherit; padding: 0.2em 0.3em;
}
.schedule-item .item-actions button:hover { color: var(--blue); }
.schedule-item .item-actions button.danger:hover { color: var(--danger); }

/* ---- Форма добавления события расписания (админ) ---- */
.schedule-add-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 1rem; }

/* ---- Переключатель "Морфологическая / Хирургическая олимпиада" ---- */
.tab-switch { display: inline-flex; gap: 0.3rem; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 0.3rem; margin-bottom: 1.3rem; }
.tab-btn { border: none; background: transparent; padding: 0.55em 1.2em; border-radius: 999px; font-weight: 700; font-size: 0.88rem; color: var(--ink-soft); cursor: pointer; font-family: inherit; }
.tab-btn.active { background: var(--blue); color: #fff; }

/* ---- Блок конкурса: критерии + сетка баллов ---- */
.competition-block { margin-bottom: 1.3rem; }
.competition-block .ch-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.6rem; margin-bottom: 0.3rem; }
.competition-block .ch-meta { font-size: 0.85rem; color: var(--muted); margin-bottom: 1rem; }
.criteria-add-row { display: flex; gap: 0.5rem; align-items: end; flex-wrap: wrap; margin-bottom: 1rem; }
.criteria-add-row .field { margin-bottom: 0; }
.criteria-add-row input { width: 160px; }
.criteria-add-row input.crit-max { width: 90px; }

table.score-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.score-table th, table.score-table td { border: 1px solid var(--line); padding: 0.5em 0.6em; text-align: center; }
table.score-table th { background: var(--blue-soft); color: var(--blue-deep); font-weight: 700; }
table.score-table td:first-child, table.score-table th:first-child { text-align: left; font-weight: 700; color: var(--ink); }
table.score-table input.score-input { width: 64px; text-align: center; padding: 0.4em; border: 1px solid var(--line); border-radius: 8px; }
table.score-table td.total-cell { font-weight: 800; color: var(--blue); background: var(--blue-soft); }
table.score-table input.time-input { width: 84px; text-align: center; padding: 0.4em; border: 1px solid var(--line); border-radius: 8px; }
.competition-block .coef-box { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; font-weight: 700; color: var(--muted); }
.competition-block .coef-box input { width: 80px; text-align: center; padding: 0.4em 0.5em; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); }

/* ---- Итоговая таблица результатов ---- */
table.ranking-table { width: 100%; border-collapse: collapse; }
table.ranking-table th { text-align: left; font-weight: 700; color: var(--blue-deep); border-bottom: 2px solid var(--line); padding: 0.6em 0.7em; }
table.ranking-table td { border-bottom: 1px solid var(--line); padding: 0.65em 0.7em; color: var(--ink-soft); }
table.ranking-table .place-badge {
  display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px;
  border-radius: 50%; font-weight: 800; font-size: 0.85rem; color: #fff; background: var(--muted);
}
table.ranking-table .place-badge.p1 { background: #C9A227; }
table.ranking-table .place-badge.p2 { background: #9AA3AD; }
table.ranking-table .place-badge.p3 { background: #B0703A; }
table.ranking-table .time-value { font-variant-numeric: tabular-nums; }
table.ranking-table .team-name { font-weight: 700; color: var(--ink); }
table.ranking-table .score-value { font-variant-numeric: tabular-nums; font-weight: 800; color: var(--blue); }

/* ---- Карточка заявки (участник и админ) ---- */
.app-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-sm); padding: 1.1rem 1.3rem; margin-bottom: 0.8rem; }
.app-card .row1 { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; margin-bottom: 0.4rem; }
.app-card .who { font-weight: 700; color: var(--ink); }
.app-card .meta { font-size: 0.85rem; color: var(--muted); }
.app-card .actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.7rem; }

.profile-card { display: flex; align-items: center; gap: 1.1rem; margin-bottom: 1.1rem; }
.profile-card .avatar { width: 58px; height: 58px; border-radius: 50%; background: var(--blue); color: #fff; display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-size: 1.4rem; flex-shrink: 0; }
.profile-card .name { font-weight: 800; color: var(--ink); }
.profile-card .role { font-size: 0.85rem; color: var(--muted); }

.link-row {
  display: flex; align-items: center; justify-content: space-between; padding: 0.9rem 0;
  border-bottom: 1px solid var(--line); color: var(--ink-soft); text-decoration: none;
  background: none; border-left: none; border-right: none; border-top: none;
  width: 100%; text-align: left; font-family: inherit; font-size: 0.95rem; cursor: pointer;
}
.link-row:last-child { border-bottom: none; }
.link-row:hover { color: var(--blue); }

.back-link { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--blue); background: none; border: none; font-weight: 700; padding: 0; margin-bottom: 1.2rem; cursor: pointer; font-family: inherit; font-size: 0.92rem; }
.back-link:hover { text-decoration: underline; }

/* ---- Динамический список участников команды ---- */
.member-list { display: flex; flex-direction: column; gap: 0.6rem; margin-bottom: 0.6rem; }
.member-row { display: flex; gap: 0.5rem; align-items: center; }
.member-row input { flex: 1; }
.member-row .remove-member {
  width: 38px; height: 38px; flex-shrink: 0; border-radius: var(--r-sm); border: 1px solid var(--line);
  background: var(--surface); color: var(--muted); cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.member-row .remove-member:hover { border-color: var(--danger); color: var(--danger); }
.member-row .remove-member svg { width: 16px; height: 16px; }
.add-row-btn {
  display: inline-flex; align-items: center; gap: 0.4rem; background: none; border: 1px dashed var(--line);
  border-radius: var(--r-sm); padding: 0.5em 0.9em; color: var(--blue); cursor: pointer; font-family: inherit; font-size: 0.88rem; font-weight: 700;
}
.add-row-btn:hover { border-color: var(--blue); background: var(--blue-soft); }
.add-row-btn svg { width: 15px; height: 15px; }

.checkbox-group { display: flex; flex-direction: column; gap: 0.55rem; }
.checkbox-group label { display: flex; align-items: center; gap: 0.6rem; font-size: 0.92rem; color: var(--ink-soft); font-weight: 400; }
.checkbox-group input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--blue); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }


/* ---- Медиаальбомы, контакты и компактная панель быстрого доступа ---- */
.quick-tile { min-height: 142px; }
.quick-tile .quick-description { color: var(--muted); font-size: .8rem; line-height: 1.35; }
.media-card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.contact-card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(285px, 1fr)); gap: 1rem; }
.media-card, .contact-card { overflow: hidden; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); box-shadow: var(--shadow-sm); }
.contact-card { display: grid; grid-template-columns: 104px minmax(0, 1fr); align-items: start; gap: 0; }
.media-card-cover { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; background: var(--blue-soft); }
.media-card-body { padding: 1rem; }
.contact-card-body { min-width: 0; padding: .85rem .9rem; }
.media-card h4, .contact-card h4 { margin: 0 0 .45rem; color: var(--ink); font-size: 1rem; }
.media-card .meta, .contact-card .meta { color: var(--muted); font-size: .84rem; line-height: 1.45; }
.media-card .btn { margin-top: .8rem; }
.contact-card-photo { width: 104px; max-width: 100%; aspect-ratio: 3 / 4; height: auto; object-fit: cover; object-position: center; display: block; background: var(--blue-soft); }
.contact-card-links { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .8rem; }
.contact-card-links a { overflow-wrap: anywhere; }
.media-preview { margin-top: .65rem; max-width: 260px; }
.media-preview img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); }
.media-preview.portrait-preview { max-width: 150px; }
.media-preview.portrait-preview img { aspect-ratio: 3 / 4; object-fit: cover; }
.media-admin-item { display: grid; grid-template-columns: 110px minmax(0,1fr); gap: 1rem; align-items: center; padding: 1rem 0; border-bottom: 1px solid var(--line); }
.media-admin-item:last-child { border-bottom: 0; }
.media-admin-item img { width: 110px; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; background: var(--blue-soft); }
.media-admin-item.contact-admin-item img { aspect-ratio: 3 / 4; width: 84px; }
.media-admin-item .actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .65rem; }
.form-actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.muted-note { color: var(--muted); font-size: .86rem; line-height: 1.5; }
.role-management-list { display: grid; gap: .65rem; margin: .8rem 0 1.2rem; }
.role-user-row { display: flex; align-items: center; justify-content: space-between; gap: .8rem; padding: .85rem 1rem; border: 1px solid var(--line); border-radius: 12px; }
.role-user-info { min-width: 0; }
.role-user-name { font-weight: 700; overflow-wrap: anywhere; }
.role-user-meta { color: var(--muted); font-size: .82rem; }
.role-user-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .4rem; }
@media (max-width: 600px) { .contact-card-grid { grid-template-columns: 1fr; } .contact-card { grid-template-columns: 88px minmax(0, 1fr); } .contact-card-photo { width: 88px; } .contact-card-body { padding: .75rem; } .media-admin-item { grid-template-columns: 78px minmax(0,1fr); gap: .7rem; } .media-admin-item img { width: 78px; } .role-user-row { align-items: flex-start; flex-direction: column; } .role-user-actions { justify-content: flex-start; } }


/* ---- Брендинг СНО НГМУ и обратный отсчёт ---- */
.admin-sidebar .brand { display:flex; align-items:center; justify-content:center; box-sizing:border-box; width:100%; padding:1.1rem .85rem; min-height:124px; overflow:hidden; border-bottom:1px solid rgba(255,255,255,.10); }
.admin-sidebar .brand-logo { display:block; flex:0 1 auto; width:100%; max-width:248px; max-height:88px; height:auto; object-fit:contain; filter:none; opacity:1; }
.countdown-panel { text-align:center; background:linear-gradient(135deg, var(--surface), var(--blue-soft)); }
.countdown-panel[hidden] { display:none !important; }
.countdown-eyebrow { color:var(--muted); margin:0 0 .25rem; font-size:.9rem; }
.countdown-panel h2 { margin:.2rem 0 1rem; font-family:'PT Serif',serif; color:var(--blue-deep); }
.countdown-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:.65rem; max-width:620px; margin:0 auto; }
.countdown-grid > div { padding:.8rem .3rem; background:rgba(255,255,255,.72); border:1px solid var(--line); border-radius:12px; }
.countdown-grid strong { display:block; font-size:clamp(1.5rem,4vw,2.2rem); color:var(--blue-deep); line-height:1.1; font-variant-numeric:tabular-nums; }
.countdown-grid span { display:block; margin-top:.35rem; color:var(--muted); font-size:.8rem; }
.countdown-date { margin:.8rem 0 0; color:var(--muted); font-size:.9rem; }
@media(max-width:460px) { .countdown-grid { gap:.35rem; } .countdown-grid > div { padding:.65rem .15rem; } .countdown-grid span { font-size:.7rem; } }

/* v18.4: robust SNO branding */
.admin-sidebar .brand { display:flex; align-items:center; justify-content:center; width:100%; min-height:124px; padding:16px 12px; box-sizing:border-box; }
.admin-sidebar .brand-logo { display:block !important; width:100%; max-width:248px; height:auto; max-height:88px; object-fit:contain; visibility:visible; opacity:1; }

/* v18.5 — адаптивная компоновка для ноутбуков, планшетов и телефонов */
html { -webkit-text-size-adjust: 100%; }
body { min-width: 320px; }
img, video, canvas, svg { max-width: 100%; }
input, select, textarea { max-width: 100%; min-width: 0; }
button, .btn, a { -webkit-tap-highlight-color: transparent; }
.btn, button { touch-action: manipulation; }
.admin-shell { grid-template-columns: 252px minmax(0, 1fr); }
.admin-sidebar { min-width: 0; }
.admin-content { min-width: 0; overflow-x: hidden; }
.panel, .app-card, .event-card, .profile-card, .countdown-panel { min-width: 0; }
.form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.quick-grid, .media-card-grid, .contact-card-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
table.data-table { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
pre, code { overflow-wrap: anywhere; }

@media (min-width: 1500px) {
  .admin-shell { grid-template-columns: 280px minmax(0, 1fr); }
  .admin-content { padding: 2rem clamp(2rem, 3vw, 3.5rem); }
  .panel { padding: 1.75rem; }
}
@media (max-width: 1024px) {
  .admin-shell { grid-template-columns: 220px minmax(0, 1fr); }
  .admin-content { padding: 1.25rem; }
  .admin-topbar { padding: .85rem 1.1rem; }
  .panel { padding: 1.2rem; }
  .stat { padding: 1rem; }
  .stat .value { font-size: 1.55rem; }
}
@media (max-width: 780px) {
  .admin-shell { display: block; min-height: 100vh; min-height: 100dvh; }
  .admin-main { min-height: 100vh; min-height: 100dvh; }
  .admin-sidebar { z-index: 1000; }
  .admin-sidebar.open { position: fixed; inset: 0 auto 0 0; width: min(86vw, 320px); max-width: 320px; height: 100dvh; overflow-y: auto; box-shadow: 18px 0 45px rgba(7, 24, 52, .25); }
  .admin-topbar { position: sticky; top: 0; z-index: 50; gap: .65rem; padding: .7rem .85rem; padding-top: max(.7rem, env(safe-area-inset-top)); }
  .admin-topbar .title-block { min-width: 0; flex: 1; }
  .admin-topbar .title-block h2 { font-size: 1.05rem; line-height: 1.25; }
  .admin-topbar .title-block .desc { font-size: .78rem; }
  .admin-topbar .user-block { gap: .45rem; font-size: .8rem; }
  .admin-content { padding: 1rem; padding-bottom: max(1.25rem, env(safe-area-inset-bottom)); }
  .panel { border-radius: 16px; padding: 1rem; margin-bottom: 1rem; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .form-grid .field.full { grid-column: auto; }
  .quick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; }
  .quick-tile { min-height: 120px; }
  .stat-strip { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat { min-width: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .stat:nth-child(2n) { border-right: 0; }
  .stat:nth-last-child(-n+2) { border-bottom: 0; }
  .event-card { align-items: flex-start; flex-direction: column; gap: .8rem; }
  .event-card .btn { width: 100%; }
  .app-card .row1 { align-items: flex-start; flex-direction: column; gap: .25rem; }
  .form-actions { align-items: stretch; }
  .form-actions .btn { flex: 1 1 140px; }
}
@media (max-width: 480px) {
  body { font-size: 15px; }
  .admin-content { padding: .75rem; }
  .admin-topbar { padding-left: .65rem; padding-right: .65rem; }
  .admin-topbar .user-block { max-width: 42%; overflow-wrap:break-word; }
  .menu-toggle { margin-right: .1rem; padding: .45rem .55rem; flex-shrink: 0; }
  .panel { padding: .85rem; border-radius: 14px; }
  .quick-grid { grid-template-columns: minmax(0, 1fr); }
  .quick-tile { min-height: auto; }
  .stat { padding: .8rem; }
  .stat .value { font-size: 1.35rem; }
  .stat .label { font-size: .76rem; }
  .login-form-card { padding: 1.25rem; border-radius: 18px; }
  .login-form-side { padding: 1rem; }
  .countdown-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .countdown-grid > div { min-width: 0; }
  .countdown-grid strong { font-size: clamp(1.15rem, 6vw, 1.6rem); }
  .countdown-grid span { font-size: .66rem; }
  .media-card-grid, .contact-card-grid { grid-template-columns: minmax(0, 1fr); }
  .role-user-actions .btn { flex: 1 1 auto; }
  .btn { min-height: 42px; }
  input, select, textarea { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* v18.6: responsive polish + admin controls */
.ranking-visibility-control{display:flex;align-items:center;justify-content:space-between;gap:1rem;flex-wrap:wrap;padding:1rem;margin:1rem 0;border:1px solid var(--line);border-radius:var(--r-md);background:var(--blue-soft)}
.ranking-visibility-control p{margin:.25rem 0 0;font-size:.82rem;max-width:650px}
.switch-label{display:flex;align-items:center;gap:.5rem;font-weight:700;white-space:nowrap}
.competition-admin-actions{display:flex;gap:.5rem;flex-wrap:wrap;margin:.75rem 0 1rem}
.criterion-heading{display:flex;align-items:center;justify-content:center;gap:.35rem}
.criterion-remove{border:0;border-radius:50%;width:1.45rem;height:1.45rem;line-height:1;background:#fbebE9;color:#a23b34;font-weight:700;cursor:pointer;flex-shrink:0}
.actions{display:flex;gap:.4rem;flex-wrap:wrap}
.muted-note{font-size:.88rem;color:var(--muted)}
@media (min-width:1200px){.admin-main,.dashboard-main{min-width:0}.panel{padding:clamp(1rem,1.5vw,1.6rem)}.admin-shell,.dashboard-shell{max-width:1800px;margin-inline:auto}}
@media (max-width:900px){.admin-sidebar,.dashboard-sidebar{z-index:1000}.admin-main,.dashboard-main{min-width:0;width:100%;padding:1rem}.panel{padding:1rem;border-radius:14px}.tab-switch{overflow-x:auto;flex-wrap:nowrap;max-width:100%;padding-bottom:.35rem}.tab-switch .tab-btn{flex:0 0 auto;white-space:nowrap}.schedule-add-form{grid-template-columns:repeat(2,minmax(0,1fr))}.schedule-add-form .field.full{grid-column:1/-1}.score-table{min-width:720px}.competition-block .ch-head{align-items:flex-start;gap:.75rem;flex-wrap:wrap}}
@media (max-width:600px){body{font-size:15px}.admin-main,.dashboard-main{padding:.7rem}.panel{padding:.85rem;margin-bottom:.8rem}.section-view h2{font-size:1.35rem}.section-view h3{font-size:1.05rem}.schedule-add-form{grid-template-columns:minmax(0,1fr)}.schedule-add-form .field,.schedule-add-form .field.full{grid-column:1/-1;min-width:0}.field input,.field select,.field textarea{width:100%;min-width:0;max-width:100%;font-size:16px}.btn{min-height:42px}.btn-sm{min-height:36px}.ranking-visibility-control{align-items:flex-start;flex-direction:column;padding:.85rem}.ranking-visibility-control .btn{width:100%}.competition-admin-actions .btn{flex:1 1 100%}.app-card .row1{align-items:flex-start;gap:.5rem;flex-wrap:wrap}.app-card .actions{width:100%}.app-card .actions .btn{flex:1}.score-table{font-size:.82rem}.score-table th,.score-table td{padding:.45rem}.score-input{width:4.2rem}.criteria-add-row{display:grid;grid-template-columns:1fr 1fr;gap:.6rem}.criteria-add-row .field:first-child{grid-column:1/-1}.criteria-add-row .btn{grid-column:1/-1;width:100%}.tab-switch .tab-btn{padding:.55rem .8rem;font-size:.88rem}}
@media (prefers-reduced-motion:reduce){*,*::before,*::after{scroll-behavior:auto!important;transition:none!important}}
.admin-sidebar .brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 100px;
  padding: 18px 10px;
  box-sizing: border-box;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.admin-sidebar .brand-title {
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.4px;
}

.admin-sidebar .brand-city {
  color: #c4d3e5;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.admin-sidebar .brand img {
  display: none !important;
}

/* =========================================================
   v19 — mobile-first refinement (iPhone / Android / desktop)
   Safe-area aware, compact spacing, reliable touch targets.
   ========================================================= */
:root { --mobile-gutter: 16px; }
html { width:100%; max-width:100%; overflow-x:clip; scroll-behavior:smooth; }
body { width:100%; max-width:100%; overflow-x:clip; }
button, .btn, input, select, textarea { max-width:100%; }
button, .btn { touch-action:manipulation; }
img, svg, video, canvas { height:auto; }
.panel, .stat, .quick-tile, .app-card, .event-card, .profile-card,
.login-form-card, .login-brand, .countdown-panel, .competition-block,
.ranking-visibility-control { overflow-wrap:break-word; min-width:0; }
table { border-collapse:separate; border-spacing:0; }
td, th { overflow-wrap:break-word; }
.form-actions, .actions, .competition-admin-actions, .role-user-actions {
  display:flex; align-items:center; gap:.55rem; flex-wrap:wrap;
}
input, select, textarea { min-width:0; }
.btn, button { min-height:42px; }
.menu-toggle { align-items:center; justify-content:center; min-width:42px; min-height:42px; }

/* Mobile menu overlay */
@media (max-width:780px) {
  .admin-shell, .dashboard-shell { display:block !important; width:100%; min-height:100dvh; }
  .admin-main, .dashboard-main { width:100%; min-width:0; max-width:100%; padding:0 !important; min-height:100dvh; }
  .admin-sidebar, .dashboard-sidebar {
    display:block !important; position:fixed !important; top:0; bottom:0; left:0;
    width:min(86vw,320px); max-width:320px; height:100dvh; height:100dvh;
    padding-bottom:max(16px,env(safe-area-inset-bottom));
    overflow-y:auto; overscroll-behavior:contain;
    transform:translateX(-105%); visibility:hidden; pointer-events:none;
    transition:transform .22s ease, visibility .22s ease;
    z-index:1001; box-shadow:none;
  }
  .admin-sidebar.open, .dashboard-sidebar.open {
    transform:translateX(0); visibility:visible; pointer-events:auto;
    box-shadow:18px 0 45px rgba(7,24,52,.25);
  }
  body.mobile-nav-open::before {
    content:""; position:fixed; inset:0; z-index:1000;
    background:rgba(7,18,39,.48); backdrop-filter:blur(2px);
  }
  body.mobile-nav-open { overflow:hidden; }
  .admin-topbar, .dashboard-topbar {
    position:sticky; top:0; z-index:100; width:100%; min-width:0;
    padding:calc(8px + env(safe-area-inset-top)) 12px 9px;
    gap:8px; align-items:center;
  }
  .admin-topbar > div:first-child, .dashboard-topbar > div:first-child {
    flex:1 1 auto; min-width:0;
  }
  .admin-topbar .title-block, .dashboard-topbar .title-block { min-width:0; }
  .admin-topbar .title-block h2, .dashboard-topbar .title-block h2 {
    font-size:clamp(16px,4.2vw,19px); line-height:1.2; overflow-wrap:break-word;
  }
  .admin-topbar .title-block .desc, .dashboard-topbar .title-block .desc {
    font-size:12px; line-height:1.3; overflow-wrap:break-word;
  }
  .admin-topbar .user-block, .dashboard-topbar .user-block {
    display:flex; align-items:center; justify-content:flex-end; gap:6px;
    max-width:42%; min-width:0; font-size:12px;
  }
  #current-user-email { display:none; }
  .admin-topbar .user-block .btn, .dashboard-topbar .user-block .btn {
    padding:8px 12px; white-space:nowrap; min-height:38px;
  }
  .admin-content, .dashboard-content {
    width:100%; min-width:0; padding:12px !important;
    padding-bottom:max(20px,env(safe-area-inset-bottom)) !important;
    overflow:visible; overflow-wrap:break-word;
  }
  .section-view { width:100%; min-width:0; }
  .section-view > h1, .section-view > h2 { line-height:1.2; }
  .home-hero { padding:4px 0 10px; }
  .home-hero h1 { font-size:clamp(25px,7vw,34px); }
  .panel, .countdown-panel {
    padding:14px; margin:0 0 12px; border-radius:16px;
  }
  .panel h2, .panel h3 { line-height:1.25; }
  .form-grid { grid-template-columns:minmax(0,1fr) !important; gap:12px; }
  .form-grid > *, .form-grid .field, .field { min-width:0; width:100%; }
  .form-grid .field.full { grid-column:1/-1; }
  .field input, .field select, .field textarea, input, select, textarea {
    width:100%; min-width:0; max-width:100%; font-size:16px;
  }
  .form-actions { align-items:stretch; }
  .form-actions .btn { flex:1 1 100%; width:100%; }
  .actions { width:100%; }
  .actions .btn { flex:1 1 auto; }
  .quick-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:9px; }
  .quick-tile { padding:12px; min-height:100px; border-radius:14px; }
  .stat-strip { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .stat { min-width:0; padding:12px; }
  .stat .value { font-size:clamp(20px,5vw,27px); line-height:1.15; }
  .event-card { display:flex; flex-direction:column; align-items:stretch; gap:10px; padding:14px; }
  .event-card .btn { width:100%; }
  .app-card { padding:13px; }
  .app-card .row1 { display:flex; flex-direction:column; align-items:flex-start; gap:5px; }
  .app-card .actions .btn { flex:1 1 120px; }
  .tab-switch { display:flex; max-width:100%; overflow-x:auto; flex-wrap:nowrap; gap:7px; padding:2px 1px 8px; scrollbar-width:thin; -webkit-overflow-scrolling:touch; }
  .tab-switch .tab-btn { flex:0 0 auto; white-space:nowrap; min-height:40px; }
  .ranking-visibility-control { gap:10px; padding:13px; }
  .competition-admin-actions .btn { flex:1 1 100%; width:100%; }
  .criterion-heading { flex-wrap:wrap; }
  .schedule-add-form { display:grid; grid-template-columns:minmax(0,1fr) !important; gap:10px; }
  .schedule-add-form .field, .schedule-add-form .field.full { grid-column:1/-1; }
  .score-table, table.data-table { display:block; width:100%; max-width:100%; overflow-x:auto; -webkit-overflow-scrolling:touch; }
  .score-table { min-width:680px; }
  .score-table th, .score-table td { padding:8px 7px; }
  .score-input { width:64px; max-width:64px; }
  .countdown-grid { gap:6px; }
  .countdown-grid > div { padding:8px 3px; border-radius:10px; }
  .countdown-grid strong { font-size:clamp(18px,5.5vw,26px); }
  .countdown-grid span { font-size:10px; }
  .login-shell { display:flex; flex-direction:column; min-height:100dvh; }
  .login-brand { padding:26px 18px 20px; min-height:0; }
  .login-brand .brand-body { width:100%; }
  .login-brand .tagline { font-size:clamp(23px,6.4vw,32px); line-height:1.18; }
  .login-brand .sub-tagline { font-size:14px; }
  .login-brand .events { display:grid; grid-template-columns:minmax(0,1fr); gap:7px; margin-top:14px; }
  .login-form-side { padding:14px; width:100%; }
  .login-form-card { width:100%; max-width:480px; margin:0 auto; padding:20px 16px; }
  .login-form-card h1 { font-size:24px; }
  .login-form-card .btn { width:100%; }
  .media-card-grid, .contact-card-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
  .media-card-grid > *, .contact-card-grid > * { min-width:0; }
}
@media (max-width:420px) {
  :root { --mobile-gutter:12px; }
  body { font-size:14px; }
  .admin-content, .dashboard-content { padding:10px !important; }
  .admin-topbar, .dashboard-topbar { padding-left:9px; padding-right:9px; }
  .admin-topbar .title-block .desc, .dashboard-topbar .title-block .desc { display:none; }
  .panel { padding:12px; border-radius:14px; margin-bottom:10px; }
  .quick-grid, .media-card-grid, .contact-card-grid { grid-template-columns:minmax(0,1fr); }
  .quick-tile { min-height:0; }
  .stat-strip { gap:0; }
  .stat { padding:10px; }
  .login-brand { padding:22px 14px 18px; }
  .login-form-side { padding:10px; }
  .login-form-card { padding:18px 14px; }
  .btn { padding:.68em 1em; }
}
@media (hover:none) {
  .btn:hover, button:hover { transform:none; }
}

/* Самостоятельная регистрация аккаунта */
.text-button {
  appearance: none; border: 0; background: transparent; color: var(--blue, #245ca6);
  font: inherit; font-weight: 800; text-decoration: underline; text-underline-offset: 3px;
  padding: 4px 2px; cursor: pointer; border-radius: 6px;
}
.text-button:hover { color: var(--blue-deep, #173f78); }
.text-button:focus-visible { outline: 3px solid rgba(50, 110, 190, .35); outline-offset: 3px; }
.login-foot { line-height: 1.65; }
.field-hint { display: block; margin-top: 5px; color: var(--muted, #667085); font-size: .8rem; }
.success-text {
  margin: 0 0 1rem; padding: 12px 14px; border-radius: 12px;
  border: 1px solid #b7e4cb; background: #effaf3; color: #17643a;
  font-size: .9rem; line-height: 1.5; overflow-wrap:break-word;
}
.success-text[hidden] { display: none; }
#register-panel[hidden], #login-panel[hidden] { display: none !important; }
#register-form .field, #login-form .field { min-width: 0; }
#register-form input, #login-form input { width: 100%; min-width: 0; }
@media (max-width: 480px) {
  .login-foot { margin-top: 1rem; }
  .text-button { min-height: 40px; }
  .success-text, .error-text { overflow-wrap:break-word; }
}


/* =========================================================
   v20 — аккуратные переносы текста и компоновка на телефонах
   (вертикальная ориентация, 320–480px). Структура не менялась.
   ========================================================= */
html { -webkit-text-size-adjust:100%; text-size-adjust:100%; }
body { overflow-wrap:break-word; word-break:normal; }

/* Заголовки и подписи — ровные строки без «висячих» слов */
h1, h2, h3, h4,
.login-brand .tagline, .login-brand .sub-tagline,
.countdown-panel h2, .empty-state strong,
.stat .label, .quick-tile .label, .nav-group { text-wrap:balance; hyphens:manual; }
/* Обычный текст — без одиноких коротких слов в конце абзаца, перенос по слогам */
p, .meta, .desc, .competition-desc, .quick-description, .muted-note,
.field-hint, .doc-meta, .loc, .reschedule-note, .empty-state, .sub { text-wrap:pretty; hyphens:auto; -webkit-hyphens:auto; }
/* Кнопки, пилюли, ссылки-кнопки — никаких дефисов и разрыва слов */
.btn, button, .status-pill, .badge, .tab-btn, .place-badge { hyphens:none; word-break:keep-all; overflow-wrap:normal; }
.btn, .tab-btn { text-align:center; line-height:1.25; }
/* Длинные e-mail, ссылки и коды — единственное место, где рвём «где угодно» */
a, .contact-card-links a, #current-user-email, .verify-meta code { overflow-wrap:anywhere; }
.team-name, .who, .title, .doc-title { hyphens:auto; -webkit-hyphens:auto; overflow-wrap:break-word; }
table.ranking-table td, table.data-table td, table.score-table td { overflow-wrap:break-word; }

@media (max-width:780px) {
  /* Страница входа: заголовок формы не ограничен 18ch и не ломается столбиком */
  .login-brand .tagline { max-width:none; font-size:clamp(22px,6.2vw,30px); }
  .login-brand .sub-tagline { max-width:none; }
  .login-brand .crest { width:56px; height:56px; padding:11px; }
  .login-brand .corner { width:64px; height:64px; }
  .login-brand .brand-body { gap:.8rem; }
  .login-form-card .sub { margin-bottom:1.1rem; }

  /* Карточка мероприятия на странице деталей (инлайн-стили из JS) */
  #event-detail-header > div { gap:.85rem !important; }
  #event-detail-header > div > div { min-width:0; flex:1 1 220px; }
  #event-detail-header h1 { font-size:clamp(1.2rem,5.6vw,1.5rem) !important; }
  #event-detail-header .btn { width:100%; }

  /* Расписание: время сверху, название на всю ширину, статус — отдельной строкой */
  .schedule-item { flex-wrap:wrap; gap:.35rem .75rem; padding:.8rem .9rem; }
  .schedule-item .time { min-width:0; flex:1 1 100%; font-size:.95rem; }
  .schedule-item .body { flex:1 1 100%; }
  .schedule-item .item-controls { flex:1 1 100%; flex-direction:row; align-items:center; justify-content:space-between; gap:.5rem; }
  .schedule-item .status-select { min-height:38px; flex:1 1 auto; max-width:60%; }
  .schedule-item .item-actions button { min-height:38px; padding:.3em .6em; }
  .schedule-item > .status-pill { margin-top:.1rem; }

  /* Карточки «Сейчас» и мероприятий */
  .now-card { gap:.55rem .8rem; padding:.85rem .95rem; }
  .now-card .body { flex:1 1 calc(100% - 70px); }
  .now-card .icon-badge, .event-card .icon-badge { width:40px; height:40px; padding:9px; border-radius:12px; }
  .now-card .badge { margin-left:auto; }
  .event-card { align-items:stretch; }

  /* Документы и ссылки-строки */
  .doc-item { flex-wrap:wrap; gap:.5rem .8rem; }
  .doc-item > :first-child { flex:1 1 180px; min-width:0; }
  .doc-item .btn { flex:0 0 auto; }
  .link-row { padding:.8rem 0; line-height:1.35; }

  /* Профиль, роли, медиа */
  .profile-card { gap:.85rem; }
  .profile-card .avatar { width:50px; height:50px; font-size:1.2rem; }
  .profile-card > div:last-child { min-width:0; }
  .role-user-row { gap:.6rem; }
  .media-admin-item { align-items:start; }

  /* Карточки заявок: статус под названием, кнопки ровной сеткой */
  .app-card .row1 .status-pill { align-self:flex-start; }
  .app-card .actions { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:.5rem; }
  .app-card .actions .btn { width:100%; padding-inline:.6em; }
  .app-card .actions .btn:only-child, .app-card .actions .btn:last-child:nth-child(odd) { grid-column:1/-1; }

  /* Список участников команды: поле + кнопка удаления не вылезают за край */
  .member-row { gap:.4rem; }
  .member-row input { min-width:0; }
  .add-row-btn { width:100%; justify-content:center; min-height:42px; }
  .checkbox-group label { align-items:flex-start; line-height:1.4; }
  .checkbox-group input[type="checkbox"] { margin-top:.12em; flex-shrink:0; }

  /* Таблицы: итоговая таблица умещается без прокрутки, баллы — прокручиваются внутри блока */
  table.ranking-table { font-size:.88rem; }
  table.ranking-table th, table.ranking-table td { padding:.55em .45em; }
  table.ranking-table .team-name { min-width:0; }
  table.ranking-table .place-badge { width:26px; height:26px; font-size:.8rem; }
  table.score-table th:first-child, table.score-table td:first-child {
    position:sticky; left:0; z-index:2; background:var(--surface); min-width:104px;
    box-shadow:1px 0 0 var(--line);
  }
  table.score-table th:first-child { background:var(--blue-soft); }
  table.score-table th { white-space:normal; min-width:84px; }
  .tab-switch { scroll-snap-type:x proximity; }
  .tab-switch .tab-btn { scroll-snap-align:start; }
}

@media (max-width:480px) {
  /* Верхняя панель: название раздела не обрезается, кнопка «Выйти» не сжимает его */
  .admin-topbar .user-block, .dashboard-topbar .user-block { max-width:none; flex:0 0 auto; }
  .admin-topbar .title-block h2 { font-size:clamp(15px,4.6vw,18px); }
  .home-hero h1 { font-size:clamp(24px,7.4vw,30px); }
  .home-hero .eyebrow { font-size:.88rem; }
  .panel h3, .section-view h3 { font-size:1.02rem; }
  .stat .label { font-size:.74rem; line-height:1.3; }
  .quick-tile .label { font-size:.95rem; }
  .quick-tile .quick-description { font-size:.78rem; }
  .countdown-panel h2 { font-size:1.1rem; }
  .countdown-date { font-size:.82rem; }
  .contact-card { grid-template-columns:84px minmax(0,1fr); }
  .contact-card-photo { width:84px; }
  .criteria-add-row input, .criteria-add-row input.crit-max { width:100%; }
  .competition-block .coef-box { width:100%; justify-content:space-between; }
  .competition-block .coef-box input { width:96px; }
  .verify-card { padding:1.5rem 1.1rem; }
}
@media (max-width:360px) {
  body { font-size:14px; }
  .btn { font-size:.9rem; }
  .app-card .actions { grid-template-columns:minmax(0,1fr); }
  .stat .value { font-size:1.2rem; }
  .countdown-grid span { font-size:.62rem; }
}
