:root {
  --spbstu-green: #3aaa35;
  --spbstu-green-light: #5fd055;
  --spbstu-green-dark: #244128;
  --spbstu-green-soft: rgba(58, 170, 53, 0.12);
  --text: #1a1f24;
  --text-muted: #5c6670;
  --bg: #eef2f6;
  --bg-gradient-top: #f8fafb;
  --glass-bg: rgba(255, 255, 255, 0.78);
  --glass-border: rgba(255, 255, 255, 0.95);
  --glass-highlight: rgba(255, 255, 255, 0.98);
  --glass-shadow:
    0 10px 40px rgba(36, 65, 40, 0.08),
    0 2px 8px rgba(36, 65, 40, 0.04),
    0 1px 0 var(--glass-highlight) inset;
  --glass-inset: rgba(255, 255, 255, 0.55);
  --glass-inset-border: rgba(255, 255, 255, 0.92);
  --danger: #c62828;
  --danger-bg: rgba(255, 235, 238, 0.92);
  --danger-border: #ffcdd2;
  --radius: 22px;
  --radius-sm: 14px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --excel-border: #c8c8c8;
  --excel-header: #f3f3f3;
  --excel-highlight: #ffc7ce;
  --excel-target: #ff4040;
  --excel-warn: #ffff00;
  --excel-consent: #c6efce;
  --excel-bg: #fff;
  --excel-toolbar: rgba(250, 250, 250, 0.96);
  --excel-text: #000;
  --input-bg: rgba(255, 255, 255, 0.92);
  --input-border: rgba(58, 170, 53, 0.12);
  --input-placeholder: #9aa3ad;
  --surface-border: rgba(58, 170, 53, 0.1);
  --surface-hover: rgba(255, 255, 255, 0.82);
  --priority-metric-bg: rgba(58, 170, 53, 0.09);
  --priority-metric-border: rgba(58, 170, 53, 0.22);
  --priority-card-border: rgba(58, 170, 53, 0.14);
  --glow-a: rgba(58, 170, 53, 0.14);
  --glow-b: rgba(58, 170, 53, 0.08);
  --glow-c: rgba(255, 255, 255, 0.7);
  --btn-secondary-bg: rgba(255, 255, 255, 0.84);
  --progress-track: rgba(58, 170, 53, 0.08);
  --focus-ring: rgba(58, 170, 53, 0.24);
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  background:
    radial-gradient(ellipse 110% 75% at 50% -20%, var(--glow-a), transparent 55%),
    radial-gradient(ellipse 55% 45% at 100% 40%, var(--glow-b), transparent 52%),
    radial-gradient(ellipse 40% 35% at 0% 80%, var(--glow-b), transparent 50%),
    linear-gradient(180deg, var(--bg-gradient-top) 0%, var(--bg) 100%);
  color: var(--text);
  line-height: 1.45;
  min-height: 100dvh;
  min-height: 100svh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}

.bg-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(90px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.6;
}

.bg-glow-a {
  width: min(440px, 95vw);
  height: min(440px, 95vw);
  top: -190px;
  right: -130px;
  background: var(--glow-a);
}

.bg-glow-b {
  width: min(340px, 75vw);
  height: min(340px, 75vw);
  left: -110px;
  bottom: 8%;
  background: var(--glow-b);
}

.bg-glow-c {
  width: 260px;
  height: 260px;
  top: 38%;
  right: 8%;
  background: var(--glow-c);
  opacity: 0.4;
}

.page {
  position: relative;
  z-index: 1;
  max-width: 520px;
  margin: 0 auto;
  padding:
    calc(16px + var(--safe-top))
    max(16px, var(--safe-right))
    calc(24px + var(--safe-bottom))
    max(16px, var(--safe-left));
}

.page.page-wide { max-width: 1180px; }

.glass {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(32px) saturate(200%);
  -webkit-backdrop-filter: blur(32px) saturate(200%);
  box-shadow: var(--glass-shadow);
}

.glass-inset {
  background: var(--glass-inset);
  border: 1px solid var(--glass-inset-border);
  backdrop-filter: blur(20px) saturate(190%);
  -webkit-backdrop-filter: blur(20px) saturate(190%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 4px 16px rgba(36, 65, 40, 0.04);
}

.hero {
  display: flex;
  align-items: center;
  gap: 16px;
  border-radius: calc(var(--radius) + 2px);
  padding: 20px 18px;
  margin-bottom: 16px;
}

.hero-text { flex: 1; min-width: 0; }

.hero-logo {
  width: 60px;
  height: 60px;
  border-radius: 16px;
  flex-shrink: 0;
  box-shadow:
    0 6px 20px rgba(58, 170, 53, 0.22),
    0 0 0 1px rgba(255, 255, 255, 0.6) inset;
  border: 1px solid var(--glass-inset-border);
}

.hero-badge {
  margin: 0 0 4px;
  font-size: 0.64rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  line-height: 1.35;
}

.hero h1 {
  margin: 0;
  font-size: clamp(1.35rem, 4.5vw, 1.75rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.15;
  color: var(--spbstu-green-dark);
}

.hero-sub { margin: 6px 0 0; color: var(--text-muted); font-size: 0.88rem; }

.card {
  border-radius: var(--radius);
  padding: 20px 18px;
  margin-bottom: 14px;
}

.card-wide { padding: 18px 16px; }
.card-error { background: var(--danger-bg); border-color: var(--danger-border); }

.section-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--spbstu-green-dark);
}

.step-field { margin-bottom: 16px; }
.step-field:last-of-type { margin-bottom: 18px; }

.step-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }

.step-num {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.82rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(145deg, var(--spbstu-green), var(--spbstu-green-light));
  box-shadow: 0 4px 14px rgba(58, 170, 53, 0.3);
  flex-shrink: 0;
}

.field-label { font-size: 0.92rem; font-weight: 650; color: var(--text); }
.field-hint { margin: 8px 0 0; font-size: 0.78rem; color: var(--text-muted); line-height: 1.35; }
.field-error { margin: 6px 0 0; font-size: 0.78rem; color: var(--danger); line-height: 1.35; }

input[type="text"] {
  width: 100%;
  font-size: 16px;
  padding: 14px 16px;
  min-height: 48px;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
  appearance: none;
  touch-action: manipulation;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.95) inset;
}

input[type="text"]::placeholder { color: var(--input-placeholder); }

input[type="text"]:focus {
  outline: none;
  border-color: rgba(58, 170, 53, 0.45);
  box-shadow: 0 0 0 4px var(--focus-ring), 0 1px 0 rgba(255, 255, 255, 0.95) inset;
}

input.input-error {
  border-color: rgba(198, 40, 40, 0.55);
  box-shadow: 0 0 0 4px rgba(198, 40, 40, 0.12);
}

.btn-primary,
.btn-secondary,
.btn-download-main,
.sheet-tab,
.priority-toggle {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  transition:
    transform 0.38s cubic-bezier(0.34, 1.25, 0.64, 1),
    box-shadow 0.32s cubic-bezier(0.34, 1.1, 0.64, 1),
    filter 0.18s ease,
    background 0.18s ease,
    border-color 0.18s ease;
}

.btn-primary::before,
.btn-secondary::before,
.btn-download-main::before,
.sheet-tab::before,
.priority-toggle::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    165deg,
    rgba(255, 255, 255, 0.42) 0%,
    rgba(255, 255, 255, 0.12) 38%,
    transparent 72%
  );
  opacity: 1;
  transition: opacity 0.22s ease;
  pointer-events: none;
}

.btn-primary::after,
.btn-secondary::after,
.btn-download-main::after,
.sheet-tab::after,
.priority-toggle::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle at var(--press-x, 50%) var(--press-y, 50%), rgba(255, 255, 255, 0.55) 0%, transparent 62%);
  opacity: 0;
  transform: scale(0.4);
  transition: opacity 0.35s ease, transform 0.45s cubic-bezier(0.34, 1.2, 0.64, 1);
  pointer-events: none;
}

.btn-primary.is-pressed::after,
.btn-secondary.is-pressed::after,
.btn-download-main.is-pressed::after,
.sheet-tab.is-pressed::after,
.priority-toggle.is-pressed::after {
  opacity: 0.85;
  transform: scale(1.6);
}

.btn-primary,
.btn-secondary,
.btn-download-main {
  display: block;
  width: 100%;
  text-align: center;
  font-size: 1rem;
  font-weight: 650;
  padding: 16px 20px;
  min-height: 52px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  touch-action: manipulation;
}

.btn-label {
  position: relative;
  z-index: 1;
}

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--spbstu-green) 0%, var(--spbstu-green-light) 100%);
  box-shadow:
    0 8px 24px rgba(58, 170, 53, 0.28),
    0 1px 0 rgba(255, 255, 255, 0.3) inset,
    0 -1px 0 rgba(0, 0, 0, 0.06) inset;
  margin-top: 4px;
}

.btn-primary.is-pressed,
.btn-primary:active:not(:disabled) {
  transform: scale(0.965) translateY(1px);
  filter: brightness(0.93) saturate(1.05);
  box-shadow:
    0 3px 10px rgba(58, 170, 53, 0.2),
    0 1px 0 rgba(255, 255, 255, 0.18) inset;
}

.btn-primary.is-pressed::before,
.btn-primary:active:not(:disabled)::before { opacity: 0.35; }

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  filter: none;
}

.btn-secondary {
  background: var(--btn-secondary-bg);
  color: var(--spbstu-green-dark);
  border: 1px solid var(--priority-metric-border);
  margin-top: 12px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.92) inset,
    0 4px 14px rgba(36, 65, 40, 0.05);
}

.btn-secondary.is-pressed,
.btn-secondary:active {
  transform: scale(0.97) translateY(1px);
  filter: brightness(0.96);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset;
}

.btn-download-main {
  color: #fff;
  background: linear-gradient(
    145deg,
    var(--spbstu-green-light) 0%,
    var(--spbstu-green) 52%,
    #2f9a2b 100%
  );
  border: 1px solid rgba(255, 255, 255, 0.32);
  box-shadow:
    0 10px 28px rgba(58, 170, 53, 0.34),
    0 1px 0 rgba(255, 255, 255, 0.38) inset,
    0 -1px 0 rgba(36, 100, 32, 0.12) inset;
  margin-top: 16px;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.1);
}

.btn-download-main.is-pressed,
.btn-download-main:active {
  transform: scale(0.965) translateY(1px);
  filter: brightness(0.95) saturate(1.08);
  box-shadow:
    0 4px 14px rgba(58, 170, 53, 0.26),
    0 1px 0 rgba(255, 255, 255, 0.22) inset;
}

.direction-pick { margin-bottom: 16px; padding: 14px; border-radius: var(--radius-sm); }
.direction-pick-title { margin: 0 0 12px; font-size: 0.86rem; font-weight: 600; color: var(--text-muted); }

.direction-option {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 10px;
  min-height: 48px;
  border-radius: 12px;
  cursor: pointer;
  border: 1px solid transparent;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    transform 0.32s cubic-bezier(0.34, 1.2, 0.64, 1),
    box-shadow 0.25s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.direction-option:hover { background: var(--surface-hover); }

.direction-option.is-pressed,
.direction-option:active {
  transform: scale(0.98);
  background: var(--surface-hover);
}

.direction-option:has(input:checked) {
  background: var(--spbstu-green-soft);
  border-color: var(--priority-metric-border);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.85) inset;
}

.direction-option input { margin-top: 4px; width: 18px; height: 18px; accent-color: var(--spbstu-green); flex-shrink: 0; }
.direction-option span { font-size: 0.86rem; line-height: 1.4; }

.progress-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }

.progress-percent {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--spbstu-green);
  font-variant-numeric: tabular-nums;
}

.progress-track {
  height: 10px;
  background: var(--progress-track);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 12px;
  padding: 2px;
  border: 1px solid var(--surface-border);
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--spbstu-green), var(--spbstu-green-light));
  border-radius: 999px;
  transition: width 0.25s ease;
}

.progress-text { margin: 0; font-size: 0.88rem; color: var(--text-muted); }

.result-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 16px;
}

.result-title {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--spbstu-green-dark);
}

.result-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(145deg, var(--spbstu-green), var(--spbstu-green-light));
  box-shadow: 0 4px 14px rgba(58, 170, 53, 0.28);
  flex-shrink: 0;
}

.stats { display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; }
.stats-header { padding: 14px 16px; border-radius: var(--radius-sm); }
.stats-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }

.stat-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.86rem;
  padding: 8px 0;
  border-bottom: 1px solid var(--surface-border);
}

.stat-item:last-child { border-bottom: none; }
.stat-item span { color: var(--text-muted); }
.stat-item b { color: var(--text); font-weight: 700; text-align: right; }

.stats-above-line {
  margin: 8px 0 0;
  padding-top: 8px;
  border-top: 1px solid var(--surface-border);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.stats-above-line strong { color: var(--text); font-weight: 700; }

.stats-hero {
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--surface-border);
}

.stats-participant-label {
  margin: 0 0 2px;
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.stats-participant-id {
  margin: 0 0 6px;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--spbstu-green-dark);
  font-variant-numeric: tabular-nums;
}

.stats-code {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 650;
  color: var(--text-muted);
}

.priority-card {
  border-radius: var(--radius-sm);
  padding: 16px 14px;
  border: 1px solid var(--priority-card-border);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.92) inset;
}

.priority-heading {
  margin: 0 0 12px;
  text-align: center;
  font-size: 1.28rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--spbstu-green-dark);
}

.priority-metric-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.priority-metric-card {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  padding: 10px 10px;
  border-radius: 12px;
  background: var(--priority-metric-bg);
  border: 1px solid var(--priority-metric-border);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.85) inset,
    0 2px 8px rgba(58, 170, 53, 0.06);
  text-align: center;
}

.priority-metric-phrase {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--text);
  font-weight: 500;
}

.priority-extra { display: flex; flex-direction: column; gap: 12px; }

.priority-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 10px 12px;
  min-height: 40px;
  border-radius: 12px;
  color: var(--spbstu-green-dark);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  border: 1px solid var(--priority-metric-border);
  background: var(--btn-secondary-bg);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.88) inset;
}

.priority-toggle.is-pressed,
.priority-toggle:active {
  transform: scale(0.97);
  filter: brightness(0.96);
  background: rgba(255, 255, 255, 0.68);
}

.priority-toggle-icon { font-size: 0.72rem; transition: transform 0.2s; }
.priority-toggle.expanded .priority-toggle-icon { transform: rotate(180deg); }

.table-section {
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--surface-border);
}

.table-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  background: var(--excel-toolbar);
  border-bottom: 1px solid var(--excel-border);
}

.table-label {
  margin: 0;
  font-size: 0.74rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  width: 100%;
}

.table-scroll-hint { margin: 0; width: 100%; font-size: 0.72rem; color: var(--text-muted); }

.sheet-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  flex: 1;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
  touch-action: pan-x pan-y;
  overscroll-behavior-x: contain;
}

.sheet-tabs::-webkit-scrollbar { display: none; }

/* Десктоп (мышь/трекпад): видимый бегунок и курсор перетаскивания */
@media (hover: hover) and (pointer: fine) {
  .sheet-tabs {
    cursor: grab;
    scrollbar-width: thin;
    scrollbar-color: rgba(58, 170, 53, 0.45) transparent;
    padding-bottom: 6px;
  }

  .sheet-tabs.drag-scrolling { cursor: grabbing; }
  .sheet-tabs.drag-scrolling .sheet-tab { cursor: grabbing; }

  .sheet-tabs::-webkit-scrollbar {
    display: block;
    height: 6px;
  }

  .sheet-tabs::-webkit-scrollbar-track {
    background: rgba(58, 170, 53, 0.1);
    border-radius: 999px;
  }

  .sheet-tabs::-webkit-scrollbar-thumb {
    background: linear-gradient(90deg, var(--spbstu-green), var(--spbstu-green-light));
    border-radius: 999px;
  }
}

.sheet-tab {
  border: 1px solid var(--excel-border);
  background: var(--excel-bg);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 14px;
  min-height: 44px;
  font-size: 0.76rem;
  cursor: pointer;
  flex-shrink: 0;
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  touch-action: pan-x pan-y;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset;
}

.sheet-tab.is-pressed,
.sheet-tab:active {
  transform: scale(0.94);
  filter: brightness(0.95);
}

.sheet-tab.active {
  background: var(--spbstu-green);
  border-color: var(--spbstu-green);
  color: #fff;
  box-shadow:
    0 4px 14px rgba(58, 170, 53, 0.28),
    0 1px 0 rgba(255, 255, 255, 0.22) inset;
}

.sheet-tab.active.is-pressed,
.sheet-tab.active:active {
  transform: scale(0.93);
  filter: brightness(0.9);
}

.table-wrap {
  overflow: auto;
  min-height: 280px;
  max-height: min(62vh, 560px);
  -webkit-overflow-scrolling: touch;
  background: var(--excel-bg);
  overscroll-behavior: contain;
  touch-action: pan-x pan-y;
}

.table-slider {
  padding: 10px 14px;
  background: var(--excel-toolbar);
  border-top: 1px solid var(--excel-border);
}

.table-slider input[type="range"] {
  display: block;
  width: 100%;
  margin: 0;
  height: 18px;
  background: transparent;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  touch-action: manipulation;
}

.table-slider input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(58, 170, 53, 0.16);
}

.table-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 44px;
  height: 16px;
  margin-top: -5px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(145deg, var(--spbstu-green), var(--spbstu-green-light));
  box-shadow: 0 2px 8px rgba(58, 170, 53, 0.35);
}

.table-slider input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(58, 170, 53, 0.16);
}

.table-slider input[type="range"]::-moz-range-thumb {
  width: 44px;
  height: 16px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(145deg, var(--spbstu-green), var(--spbstu-green-light));
  box-shadow: 0 2px 8px rgba(58, 170, 53, 0.35);
}

.table-slider input[type="range"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
  border-radius: 999px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.76rem;
  min-width: 720px;
  color: var(--excel-text);
  font-family: Calibri, "Segoe UI", Arial, sans-serif;
}

.data-table th,
.data-table td {
  border: 1px solid var(--excel-border);
  padding: 8px;
  text-align: center;
  vertical-align: middle;
  background: var(--excel-bg);
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--excel-header);
  font-weight: 700;
  font-size: 0.72rem;
  color: var(--excel-text);
}

.data-table td:nth-child(3) { text-align: left; min-width: 180px; }
.data-table tr.row-italic td { font-style: italic; }
.data-table td.cell-highlight { background: var(--excel-highlight) !important; }
.data-table td.cell-target { background: var(--excel-target) !important; color: #fff !important; font-weight: 700; }
.data-table td.cell-warn { background: var(--excel-warn) !important; color: var(--excel-text) !important; font-style: normal; }
.data-table td.cell-low-score { background: var(--excel-warn) !important; color: var(--excel-text) !important; }
.data-table td.cell-consent { background: var(--excel-consent) !important; color: var(--excel-text) !important; font-style: normal; }
.data-table tr.row-italic td.cell-target { font-weight: 700; }

.error-text { margin: 8px 0 4px; color: var(--danger); font-size: 0.94rem; word-break: break-word; }
.hidden { display: none !important; }

/* Смарт-часы и очень узкие экраны */
@media (max-width: 240px), (max-height: 280px) and (max-width: 320px) {
  .page { padding: calc(8px + var(--safe-top)) 8px calc(12px + var(--safe-bottom)); }
  .hero { flex-direction: column; text-align: center; padding: 12px 10px; gap: 8px; }
  .hero-logo { width: 44px; height: 44px; }
  .hero-badge { font-size: 0.52rem; }
  .hero h1 { font-size: 1.1rem; }
  .hero-sub { font-size: 0.72rem; }
  .card { padding: 12px 10px; }
  .step-num { width: 26px; height: 26px; font-size: 0.75rem; }
  .field-label { font-size: 0.82rem; }
  input[type="text"] { padding: 10px 12px; min-height: 42px; font-size: 14px; }
  .btn-primary, .btn-secondary, .btn-download-main { min-height: 42px; padding: 10px 12px; font-size: 0.88rem; }
  .priority-heading { font-size: 0.82rem; }
  .priority-metric-phrase { font-size: 0.72rem; }
  .stats-participant-id { font-size: 1rem; }
}

/* Смартфоны */
@media (max-width: 480px) {
  .page { padding-top: calc(12px + var(--safe-top)); }
  .hero { padding: 16px 14px; gap: 12px; margin-bottom: 12px; }
  .hero-logo { width: 52px; height: 52px; border-radius: 14px; }
  .hero-badge { font-size: 0.58rem; letter-spacing: 0.04em; }
  .hero-sub { font-size: 0.82rem; }
  .card, .card-wide { padding: 16px 14px; margin-bottom: 12px; }
  .stats-participant-id { font-size: 1.15rem; }
  .stats-grid { gap: 8px; }
  .stat-item { font-size: 0.82rem; }
  .priority-card { padding: 12px 10px; }
  .priority-heading { font-size: 1.14rem; margin-bottom: 9px; }
  .result-title { font-size: 1.15rem; }
  .priority-metric-card { padding: 9px 8px; min-height: 46px; }
  .priority-metric-phrase { font-size: 0.8rem; line-height: 1.4; }
  .section-title { font-size: 0.98rem; }
  .table-toolbar { flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 8px; }
  .table-scroll-hint { text-align: center; font-size: 0.72rem; }
  .sheet-tabs { width: 100%; max-width: 100%; min-width: 0; margin: 0; }
  .btn-primary.is-pressed,
  .btn-primary:active:not(:disabled),
  .btn-secondary.is-pressed,
  .btn-secondary:active,
  .btn-download-main.is-pressed,
  .btn-download-main:active {
    transform: scale(0.94) translateY(1px);
  }

  .sheet-tab.is-pressed,
  .sheet-tab:active {
    transform: scale(0.9);
  }

  .priority-toggle.is-pressed,
  .priority-toggle:active {
    transform: scale(0.95);
  }

  .btn-primary, .btn-secondary, .btn-download-main { min-height: 48px; padding: 14px 18px; }
}

/* Планшеты */
@media (min-width: 560px) {
  .page { max-width: 640px; padding-top: calc(28px + var(--safe-top)); }
  .table-scroll-hint { display: none; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .stat-item { flex-direction: column; align-items: flex-start; border-bottom: none; padding: 0; }
  .table-label { width: auto; margin-right: 8px; }
  .table-toolbar { flex-wrap: nowrap; }
  .data-table { font-size: 0.82rem; min-width: 860px; }
  .data-table td:nth-child(3) { min-width: 260px; }
  .priority-metric-grid { grid-template-columns: repeat(3, 1fr); }
}

/* Ноутбуки и ПК */
@media (min-width: 900px) {
  .page { max-width: 720px; }
  .page.page-wide { max-width: 1180px; }
  .hero { padding: 24px 22px; }
  .hero-logo { width: 68px; height: 68px; }
  .card { padding: 24px 22px; }
  .card-wide { padding: 22px 20px; }
  .priority-metric-phrase { font-size: 0.86rem; }
}

@media (min-width: 1200px) {
  .page.page-wide { max-width: 1240px; }
  .priority-metric-grid { gap: 12px; }
  .priority-metric-card { padding: 12px 12px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .progress-bar, .priority-toggle-icon { transition: none; }
  .btn-primary, .btn-secondary, .btn-download-main,
  .sheet-tab, .priority-toggle,
  .direction-option {
    transition: none;
  }
  .btn-primary::after, .btn-secondary::after, .btn-download-main::after,
  .sheet-tab::after, .priority-toggle::after {
    transition: none;
  }
}

@media (prefers-reduced-transparency: reduce) {
  .glass,
  .glass-inset {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: rgba(255, 255, 255, 0.96);
  }
}
