:root {
  --bg: #eaf4ff;
  --surface: #ffffff;
  --border: rgba(46, 116, 198, 0.22);
  --text: #10325f;
  --muted: #4c77a8;
  --accent: #ff6a1f;
  --accent-hover: #ff8a49;
  --success: #1fb88a;
  --warning: #d89b22;
  --error: #db4f43;
  --radius: 10px;
  --font: 'Segoe UI', system-ui, sans-serif;
  --shadow: 0 10px 22px rgba(12, 64, 131, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  background:
    radial-gradient(circle at 18% 15%, rgba(110, 190, 255, 0.28), transparent 42%),
    radial-gradient(circle at 85% 10%, rgba(45, 118, 220, 0.18), transparent 34%),
    linear-gradient(160deg, #f5fbff 0%, #eaf4ff 50%, #deeeff 100%);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.container {
  max-width: 1000px;
  margin: 0 auto 2rem auto;
  padding: 0 1.5rem 1.5rem 1.5rem;
}

header.site-header {
  border-bottom: 1px solid var(--border);
  padding: 0.8rem 1.5rem;
  margin-bottom: 1.5rem;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  box-shadow: 0 10px 26px rgba(12, 64, 131, 0.12);
  position: sticky;
  top: 0;
  z-index: 50;
}

.site-header-inner {
  max-width: 1000px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-mark {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e6f3ff;
}
.logo-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.brand-title {
  margin: 0;
  font-size: 1.1rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #083a73;
}

.brand-subtitle {
  margin: 0;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--muted);
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.9rem;
}

.main-nav a {
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  color: #174575;
  background: rgba(101, 169, 230, 0.08);
  border: 1px solid transparent;
  font-weight: 500;
}

.main-nav a:hover {
  background: rgba(101, 169, 230, 0.18);
  border-color: rgba(59, 137, 204, 0.45);
  text-decoration: none;
}

.main-nav a.main-nav-primary {
  background: linear-gradient(135deg, #ff6a1f 0%, #ff9a4d 100%);
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(255, 106, 31, 0.45);
  border-color: transparent;
}

.main-nav a.main-nav-primary:hover {
  background: linear-gradient(135deg, #ff7c39 0%, #ffaf6b 100%);
  box-shadow: 0 11px 22px rgba(255, 106, 31, 0.55);
}

.app-nav {
  display: flex;
  gap: 0.7rem;
  margin-top: 0.9rem;
}

.app-nav a {
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  font-size: 0.88rem;
  color: #184678;
  background: rgba(82, 164, 224, 0.08);
}

.app-nav a:hover {
  background: rgba(82, 164, 224, 0.18);
  text-decoration: none;
}

.app-nav a.active {
  background: rgba(82, 164, 224, 0.22);
  color: #0a3e80;
  box-shadow: inset 0 0 0 1px rgba(82, 164, 224, 0.32);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.97) 0%, rgba(244, 250, 255, 0.98) 100%);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
th, td {
  padding: 0.6rem 0.8rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
th {
  background: rgba(59, 137, 204, 0.12);
  font-weight: 600;
  color: #235a96;
}
th[data-sort-table][data-sort-key] {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 1.45rem;
}
th[data-sort-table][data-sort-key]::after {
  content: "↕";
  position: absolute;
  right: 0.45rem;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(35, 90, 150, 0.55);
  font-size: 0.82em;
}
th[data-sort-table][data-sort-key][data-sort-dir="asc"]::after {
  content: "↑";
  color: #235a96;
}
th[data-sort-table][data-sort-key][data-sort-dir="desc"]::after {
  content: "↓";
  color: #235a96;
}
tr:last-child td {
  border-bottom: none;
}
tr:hover td {
  background: rgba(59, 137, 204, 0.07);
}

/* Итоговый рейтинг этапа 1 — выделение столбца */
th.col-stage1-total,
td.col-stage1-total {
  background: rgba(59, 137, 204, 0.14);
  font-weight: 600;
}
tr:hover td.col-stage1-total {
  background: rgba(59, 137, 204, 0.2);
}

input, select, button {
  font-family: inherit;
  font-size: 0.95rem;
}
input, select {
  background: #f7fbff;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.4rem 0.6rem;
  border-radius: 4px;
  width: 100%;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 106, 31, 0.2);
}
input[type="number"] {
  width: 5rem;
  min-width: 4rem;
}

button {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 600;
  box-shadow: 0 6px 14px rgba(255, 106, 31, 0.35);
  transition: transform 0.12s ease, box-shadow 0.2s ease, background 0.2s ease;
}
button:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 9px 18px rgba(255, 106, 31, 0.42);
}
button.secondary {
  background: rgba(100, 173, 232, 0.14);
  color: #1e4f87;
  border: 1px solid rgba(84, 158, 220, 0.35);
  box-shadow: none;
}
button.secondary:hover {
  background: rgba(100, 173, 232, 0.24);
  box-shadow: none;
}
button.danger {
  background: var(--error);
  color: #fff;
  box-shadow: 0 6px 14px rgba(255, 111, 99, 0.35);
}
button.danger:hover {
  background: #ff8c82;
}

#addAthlete {
  background: #3e8b62;
  box-shadow: 0 6px 14px rgba(62, 139, 98, 0.3);
}

#addAthlete:hover {
  background: #4a9870;
  box-shadow: 0 9px 18px rgba(62, 139, 98, 0.36);
}

.btn-calculate {
  background: #3b79b8;
  box-shadow: 0 6px 14px rgba(59, 121, 184, 0.3);
}

.btn-calculate:hover {
  background: #4c88c4;
  box-shadow: 0 9px 18px rgba(59, 121, 184, 0.38);
}

.msg {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
}
.msg.toast {
  position: fixed;
  right: 1rem;
  bottom: 5.2rem;
  z-index: 1000;
  margin-bottom: 0;
  display: none;
  align-items: center;
  gap: 0.75rem;
  max-width: min(92vw, 560px);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.18);
}
.msg-text {
  flex: 1;
}
.msg-close {
  padding: 0;
  width: 1.8rem;
  min-width: 1.8rem;
  height: 1.8rem;
  border-radius: 999px;
  border: none;
  background: rgba(16, 50, 95, 0.15);
  color: currentColor;
  font-size: 1.35rem;
  line-height: 1;
  font-weight: 700;
  cursor: pointer;
  box-shadow: none;
}
.msg-close:hover {
  background: rgba(16, 50, 95, 0.25);
  transform: none;
  box-shadow: none;
}
.msg.error {
  background: #ffe9e7;
  border: 1px solid var(--error);
  color: #8c271f;
}
.msg.success {
  background: #e8fff7;
  border: 1px solid var(--success);
  color: #0d6b50;
}

.section {
  background: linear-gradient(175deg, rgba(255, 255, 255, 0.97) 0%, rgba(241, 248, 255, 0.98) 100%);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.section h2 {
  margin: 0 0 1rem 0;
  font-size: 1.15rem;
  color: #1d568f;
}

.form-row {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}
.form-row label {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}
.form-row label span {
  font-size: 0.8rem;
  color: var(--muted);
}
.form-row .flex-1 { flex: 1; min-width: 120px; }
.form-row .flex-2 { flex: 2; min-width: 160px; }

.toolbar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.toolbar-checkboxes-spacer {
  flex: 1 1 auto;
}

.combine-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.combine-toggle-label {
  font-weight: 600;
  color: #1d1d1f;
}
.combine-toggle-group {
  display: inline-flex;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid #3b79b8;
  background: #ffffff;
  box-shadow: 0 6px 14px rgba(59, 121, 184, 0.3);
}
.combine-toggle-option {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 90px;
  padding: 0.35rem 0.8rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  color: #1d68b5;
  background: transparent;
  user-select: none;
}
.combine-toggle-option + .combine-toggle-option {
  border-left: 1px solid rgba(120, 144, 180, 0.35);
}
.combine-toggle-option input[type="checkbox"] {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.combine-toggle-option span {
  position: relative;
  z-index: 1;
}
.combine-toggle-option::before {
  content: '';
  position: absolute;
  inset: 0;
  background: transparent;
  transition: background 0.18s ease, box-shadow 0.18s ease;
  z-index: 0;
}
.combine-toggle-option:has(input[type="checkbox"]:checked)::before {
  background: #3b79b8;
  box-shadow: 0 6px 14px rgba(59, 121, 184, 0.3);
}
.combine-toggle-option:has(input[type="checkbox"]:checked) span {
  color: #ffffff;
}

.publish-side-btn {
  position: fixed;
  bottom: 1rem;
  left: calc(50% + 520px);
  z-index: 1200;
  white-space: nowrap;
}

.ranking-class {
  margin-bottom: 2rem;
}
.ranking-class h3 {
  margin: 0 0 0.75rem 0;
  font-size: 1.1rem;
  color: #2c6cab;
}
.ranking-class .tab-link {
  font-size: 0.85rem;
  margin-left: 0.35rem;
  opacity: 0.7;
}
.ranking-class .tab-link:hover {
  opacity: 1;
}

.no-data {
  color: var(--muted);
  padding: 2rem;
  text-align: center;
}

/* Бейджи классов судов */
.badge {
  display: inline-block;
  padding: 0.2em 0.55em;
  border-radius: 6px;
  font-size: 0.85em;
  font-weight: 600;
  white-space: nowrap;
}
.badge-k1m { background: #a6c9ff; color: #051c3d; }
.badge-k1w { background: #8fd9fb; color: #05255d; }
.badge-p1m { background: #79ddff; color: #053468; }
.badge-p1w { background: #57b6ea; color: #083b6c; }

.actions-cell {
  min-width: 210px;
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.organizer-tag {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-weight: 600;
  color: #ff8a00;
  background: #e2e6eb;
  border: 1px solid #c8ced6;
}

.pair-attempts {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.pair-attempt-line {
  font-size: 0.86rem;
  color: var(--muted);
}

.track-badges {
  display: inline-flex;
  flex-direction: column;
  gap: 0.35rem;
  vertical-align: middle;
}

.track-badge-row {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.track-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}

.track-badge-red {
  background: #ffe0de;
  color: #8f1f1a;
  border: 1px solid rgba(175, 35, 25, 0.3);
}

.track-badge-green {
  background: #ddf7e8;
  color: #176746;
  border: 1px solid rgba(23, 103, 70, 0.3);
}

/* Исход заезда: победа (яркий цвет трассы), поражение (тусклый), НФ (серый) */
.track-badge-red.track-badge-outcome-win {
  background: linear-gradient(135deg, #e84a4a 0%, #c92a2a 100%);
  color: #fff;
  border: 3px solid rgba(0, 0, 0, 0.35);
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(200, 50, 50, 0.45);
}
.track-badge-green.track-badge-outcome-win {
  background: linear-gradient(135deg, #1fb88a 0%, #1a9e76 100%);
  color: #fff;
  border: 3px solid rgba(0, 0, 0, 0.3);
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(31, 184, 138, 0.4);
}

/* В таблице параллельных спусков — только жирная обводка у победителя, фон трассы не меняем */
.table-parallel-pairs .track-badge-red.track-badge-outcome-win {
  background: #ffe0de;
  color: #8f1f1a;
  border: 3px solid rgba(175, 35, 25, 0.7);
  box-shadow: none;
}
.table-parallel-pairs .track-badge-green.track-badge-outcome-win {
  background: #ddf7e8;
  color: #176746;
  border: 3px solid rgba(23, 103, 70, 0.7);
  box-shadow: none;
}
.table-parallel-pairs .track-badge-red.track-badge-outcome-dnf,
.table-parallel-pairs .track-badge-green.track-badge-outcome-dnf {
  background: #b0b8c4;
  color: #4a5568;
  border: 3px solid #9ca3af;
  opacity: 1;
}
.table-parallel-pairs .track-badge-red.track-badge-outcome-second,
.table-parallel-pairs .track-badge-green.track-badge-outcome-second {
  border: 3px solid #9ca3af;
}
.table-parallel-pairs .track-badge-red.track-badge-outcome-second {
  background: #ffe0de;
  color: #8f1f1a;
}
.table-parallel-pairs .track-badge-green.track-badge-outcome-second {
  background: #ddf7e8;
  color: #176746;
}
.track-badge-outcome-dnf {
  background: #b0b8c4;
  color: #4a5568;
  border: 1px solid rgba(74, 85, 104, 0.35);
  opacity: 0.9;
}

.track-badge-clickable {
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.15s ease;
}
.track-badge-clickable:hover {
  transform: scale(1.04);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
}

/* Бейдж исхода: один стиль для всех (+0, +1, +2). */
.outcome-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  background: #e5e7eb;
  color: #374151;
  border: 1px solid #9ca3af;
}

.pair-attempt-points {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.15rem;
}
.pair-attempt-points-waiting {
  color: #c98a8a;
}

/* Таблица параллельных спусков — адаптивная ширина колонок, не выходит за контейнер */
.table-parallel-pairs-wrap {
  overflow-x: auto;
  max-width: 100%;
  margin-bottom: 0.5rem;
}
.table-parallel-pairs {
  width: 100%;
  table-layout: fixed;
}
.table-parallel-pairs th:nth-child(1),
.table-parallel-pairs td:nth-child(1) { width: 33.33%; }
.table-parallel-pairs th:nth-child(2),
.table-parallel-pairs td:nth-child(2) { width: 33.33%; }
.table-parallel-pairs th:nth-child(3),
.table-parallel-pairs td:nth-child(3) { width: 33.34%; }
.pair-total-points {
  font-weight: 600;
  vertical-align: top;
}
.pair-header-row {
  background: rgba(29, 86, 143, 0.08);
  border-top: 1px solid var(--border);
}
.pair-header-row:first-child {
  border-top: none;
}
.pair-header-cell {
  padding: 0.4rem 0.6rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  vertical-align: middle;
}
.pair-total-points-line {
  font-size: 0.85rem;
  line-height: 1.35;
  white-space: nowrap;
}
.pair-total-points-line + .pair-total-points-line {
  margin-top: 0.2rem;
}

.cross-heats-block {
  margin-top: 0.5rem;
}

/* Сетка хитов в виде сетки двойного выбывания */
.bracket-grid {
  display: flex;
  align-items: stretch;
  gap: 0;
  overflow-x: auto;
  padding: 1rem 0;
  margin-bottom: 1rem;
  min-height: 140px;
  max-width: 100%;
  min-width: 0;
  border-radius: var(--radius);
}
.bracket-column {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 1.5rem;
  min-width: clamp(200px, 32vw, 260px);
  flex-shrink: 0;
}
.bracket-round-label {
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
  margin-bottom: 0;
  color: var(--text);
}
.bracket-round-label-upper + .bracket-branch.bracket-upper {
  margin-top: 0;
}
.bracket-round-label-lower {
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
  margin-bottom: 0.5rem;
  color: var(--text);
}
.bracket-branch {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: stretch;
}
.bracket-branch.bracket-upper {
  justify-content: flex-start;
}
.bracket-branch.bracket-lower {
  justify-content: flex-start;
  padding-top: 0.75rem;
  margin-top: auto;
}
.bracket-loser-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 0.25rem;
}
.bracket-slot {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-width: 0;
  width: 100%;
  padding: 0.6rem;
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.bracket-slot-label {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  text-align: center;
  flex-shrink: 0;
  color: var(--muted);
}
.bracket-slot .heats-table.bracket-slot-table {
  width: 100%;
  font-size: 0.85rem;
  margin: 0;
}
.bracket-slot .heats-table.bracket-slot-table th,
.bracket-slot .heats-table.bracket-slot-table td {
  padding: 0.35rem 0.5rem;
}
.bracket-slot .heat-place-select {
  min-width: 3rem;
  padding: 0.2rem 0.3rem;
  font-size: 0.85rem;
}
.bracket-slot-count {
  display: none;
}
.bracket-connector {
  width: 18px;
  flex-shrink: 0;
  align-self: stretch;
}

/* Блок одного класса — явное визуальное разделение */
.cross-heats-class-block {
  margin-bottom: 2rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-width: 0;
}
.cross-heats-class-block:last-child {
  margin-bottom: 0.5rem;
}
.cross-heats-class-heading {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 1rem 0;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--accent);
  color: var(--text);
}
.cross-class-places {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--border);
}
.cross-class-places-heading {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 0.5rem 0;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.cross-class-places-edit-btn {
  border: none;
  background: rgba(255, 106, 31, 0.5);
  color: var(--muted);
  cursor: pointer;
  padding: 0.1rem 0.35rem;
  border-radius: 999px;
  font-size: 0.86rem;
  line-height: 1;
  box-shadow: none;
}
.cross-class-places-edit-btn:hover {
  background: rgba(59, 137, 204, 0.12);
  color: #1d568f;
}
.cross-class-places-table {
  width: 100%;
  max-width: 480px;
  font-size: 0.9rem;
}
.cross-class-places-table th,
.cross-class-places-table td {
  padding: 0.35rem 0.5rem;
}
.cross-place-num {
  color: var(--muted);
  font-size: 0.9em;
}
.cross-heats-class-heats {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.cross-heat-item {
  margin-bottom: 0.25rem;
}
.cross-heat-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 0.4rem 0;
  color: var(--muted);
}
.cross-round-block {
  margin-bottom: 1.25rem;
}
.cross-round-block:last-child {
  margin-bottom: 0;
}
.cross-round-heading {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 0.5rem 0;
  color: var(--text);
}
.cross-heats-class {
  margin-bottom: 1.25rem;
}
.cross-heats-class h4 {
  font-size: 0.95rem;
  margin: 0 0 0.5rem 0;
  color: var(--muted);
}
.heats-table {
  width: 100%;
  max-width: 600px;
  font-size: 0.9rem;
}
.heats-table.heat-single-table {
  margin-bottom: 0.5rem;
}
.heats-table .heat-num,
.heats-table .heat-row-num {
  font-weight: 600;
  width: 2.5rem;
}
/* Участники, выходящие в верхнюю сетку (места 1–2 в хите) */
.heats-table tr.heat-row-advances-upper,
.heats-table.heat-single-table tr.heat-row-advances-upper,
.bracket-slot .heats-table.bracket-slot-table tr.heat-row-advances-upper {
  background: rgba(76, 175, 80, 0.15);
}
.heats-table tr.heat-row-advances-upper td,
.heats-table.heat-single-table tr.heat-row-advances-upper td,
.bracket-slot .heats-table.bracket-slot-table tr.heat-row-advances-upper td {
  border-color: rgba(76, 175, 80, 0.35);
}
.heat-place-select {
  min-width: 3.5rem;
  padding: 0.25rem 0.35rem;
  font-size: 0.9rem;
  border: 1px solid var(--border);
  border-radius: 4px;
}
.heat-place-select.heat-place-error {
  border-color: var(--error);
  border-width: 2px;
  outline: none;
  box-shadow: 0 0 0 2px rgba(219, 79, 67, 0.25);
}

@media (max-width: 640px) {
  .container {
    padding: 0.9rem;
  }

  header {
    padding: 0.75rem 0;
    margin-bottom: 1rem;
  }

  header h1 {
    font-size: 1.2rem;
    margin-bottom: 0.65rem;
  }

  header nav {
    gap: 0.45rem;
    flex-wrap: wrap;
  }

  header nav a {
    flex: 1 1 auto;
    text-align: center;
  }

  .section {
    padding: 0.85rem;
    margin-bottom: 1rem;
  }

  .section h2 {
    font-size: 1.02rem;
    margin-bottom: 0.7rem;
  }

  .form-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.55rem;
  }

  .form-row .flex-1,
  .form-row .flex-2 {
    min-width: 0;
  }

  .toolbar {
    flex-direction: column;
    gap: 0.45rem;
  }

  .toolbar button,
  .form-row > button {
    width: 100%;
  }

  table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }

  th,
  td {
    padding: 0.5rem 0.58rem;
    font-size: 0.9rem;
  }

  input[type="number"] {
    width: 100%;
    min-width: 4.4rem;
  }

  .actions-cell {
    min-width: 0;
  }

  .table-actions {
    flex-wrap: wrap;
    white-space: normal;
  }

  .table-actions button {
    width: 100%;
  }

  .msg.toast {
    left: 0.8rem;
    right: 0.8rem;
    bottom: 7.2rem;
    max-width: none;
  }

  .publish-side-btn {
    left: auto;
    right: 0.8rem;
    top: auto;
    bottom: 4.6rem;
  }
}

@media (max-width: 900px) {
  .container {
    padding: 1rem;
  }

  .section {
    padding: 1rem;
  }

  header nav {
    flex-wrap: wrap;
  }

  table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .publish-side-btn {
    left: auto;
    right: 1rem;
    top: auto;
    bottom: 4.8rem;
  }
}

@media (max-width: 1320px) {
  .publish-side-btn {
    left: auto;
    right: 1rem;
  }
}
