:root {
  color-scheme: light;
  --bg: #f2f2f7;
  --sidebar: #f9f9fb;
  --surface: #ffffff;
  --surface-hover: #f2f2f7;
  --border: rgba(60, 60, 67, 0.12);
  --text: #000000;
  --muted: #545458;
  --accent: #0058bd;
  --btn-primary-bg: #0058bd;
  --accent-soft: rgba(0, 88, 189, 0.12);
  --nav-active: rgba(0, 0, 0, 0.065);
  --topbar: rgba(249, 249, 251, 0.94);
  --radius: 12px;
  --ease-out: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-spring: cubic-bezier(0.34, 1.25, 0.64, 1);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", system-ui, sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #14171c;
  --sidebar: #181b20;
  --surface: #1e2229;
  --surface-hover: #262b33;
  --border: rgba(255, 255, 255, 0.08);
  --text: #ffffff;
  --muted: #9ca3af;
  --accent: #3b9eff;
  --btn-primary-bg: #0b6bcb;
  --accent-soft: rgba(59, 158, 255, 0.18);
  --nav-active: rgba(255, 255, 255, 0.10);
  --topbar: rgba(24, 27, 32, 0.92);
}

* { box-sizing: border-box; }

::selection {
  background: var(--accent-soft);
  color: var(--text);
}

input, textarea, select {
  caret-color: var(--accent);
}

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

.search-field:focus-within,
.field-label input:focus,
.edit-person-form select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  font-family: var(--font);
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  scrollbar-color: rgba(128, 128, 140, 0.35) transparent;
}

.hidden { display: none !important; }
.mobile-only { display: none; }

.shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  grid-template-rows: 1fr auto;
  height: var(--vvh, 100dvh);
  overflow: hidden;
  transition: grid-template-columns 0.22s var(--ease-out);
}

.shell.collapsed {
  grid-template-columns: 68px 1fr;
}

@media (min-width: 900px) {
  .mobile-only { display: none !important; }
  .shell .sidebar {
    grid-column: 1;
    grid-row: 1;
  }
  .shell .main {
    grid-column: 2;
    grid-row: 1 / -1;
  }
  .shell .desktop-settings-panel {
    grid-column: 1;
    grid-row: 2;
  }
  .shell.no-sidebar {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
  }
  .shell.no-sidebar .sidebar {
    display: none;
  }
  .shell.no-sidebar .main {
    grid-column: 1;
    grid-row: 1 / -1;
  }
  .shell.no-sidebar .desktop-settings-panel {
    display: none !important;
  }
  .shell:not(.no-sidebar) .topbar-settings-btn {
    display: none !important;
  }
}

@media (max-width: 899px) {
  .desktop-only { display: none !important; }
}

.logo-home-btn {
  display: inline-flex;
  align-items: center;
  border: 0;
  background: transparent;
  padding: 4px 6px;
  margin: -4px -6px;
  border-radius: 9px;
  cursor: pointer;
  color: inherit;
  transition: opacity 0.15s ease, transform 0.12s var(--ease-out), background 0.15s ease;
}

.logo-home-btn:hover {
  background: var(--surface-hover);
}

.logo-home-btn:active {
  transform: scale(0.97);
}

.topbar .logo-home-btn {
  margin: 0;
  padding: 4px 2px;
}

.shell.collapsed:not(.no-sidebar) .topbar-left .logo-home-btn:not(.hidden) {
  padding: 4px 6px;
  margin-right: 4px;
}

.desktop-settings-panel {
  background: var(--sidebar);
  border-top: 1px solid var(--border);
  border-right: 1px solid var(--border);
  padding: 8px 10px 10px;
  display: flex;
  align-items: center;
}

.shell.collapsed:not(.no-sidebar) .desktop-settings-panel {
  padding: 8px 10px 10px;
  justify-content: center;
}

.shell.collapsed:not(.no-sidebar) .desktop-settings-panel .nav-row-settings {
  justify-content: center;
  padding: 7px 0;
}

.shell.collapsed:not(.no-sidebar) .desktop-settings-panel .nav-label {
  display: none;
}

/* Sidebar */
.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 0 10px 12px;
  min-height: 0;
  overflow: hidden;
  isolation: isolate;
}

.sidebar-top {
  height: 54px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 -10px 10px;
  padding: 8px 12px 8px 19px;
  border-bottom: 1px solid var(--border);
  gap: 8px;
}

.sidebar-top-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.shell.collapsed .sidebar-top {
  height: auto;
  justify-content: center;
  padding: 8px 0;
}

.shell.collapsed .sidebar-top-actions {
  flex-direction: column;
  gap: 4px;
}

.app-logo {
  height: 21px;
  width: auto;
  max-width: 142px;
  display: block;
  object-fit: contain;
  object-position: left center;
  flex-shrink: 0;
  user-select: none;
  -webkit-user-drag: none;
}

[data-theme="dark"] .app-logo {
  filter: brightness(1.58) saturate(0.85);
}

.shell.collapsed:not(.no-sidebar) .sidebar .app-logo,
.shell.collapsed:not(.no-sidebar) .nav-label,
.shell.collapsed:not(.no-sidebar) .sidebar-search,
.shell.collapsed:not(.no-sidebar) .team-item-name,
.shell.collapsed:not(.no-sidebar) .hide-collapsed {
  display: none;
}

.sidebar-search {
  padding: 0 0 8px;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 6px 10px;
  color: var(--muted);
  transition: border-color 0.14s ease, background 0.14s ease;
}

.search-field:focus-within {
  border-color: var(--accent);
  background: var(--surface);
}

.search-field input {
  border: 0;
  background: transparent;
  color: var(--text);
  outline: none;
  width: 100%;
  font-size: 13.5px;
  font-family: inherit;
}

.search-field input::placeholder {
  color: var(--muted);
}

/* Team List */
.team-list {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  will-change: scroll-position;
  display: block;
  min-height: 0;
  padding-right: 2px;
  padding-bottom: 8px;
}

.team-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 38px;
  margin-bottom: 2px;
  padding: 6px 9px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}

.team-row:active { transform: scale(0.985); }

.shell.collapsed .team-row {
  justify-content: center;
  padding: 6px 0;
}

.team-row:hover { background: var(--surface-hover); }
.team-row.active {
  background: var(--nav-active);
  color: var(--text);
  font-weight: 600;
}

.team-item-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Логотипы: строго одного размера, без фона, с перекраской тёмных частей в тёмной теме */
.team-logo {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: transparent;
}

.team-logo img,
.team-logo svg {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: transparent;
}

[data-theme="dark"] .team-logo svg .svg-dark {
  fill: #f2f4f8 !important;
}

.team-logo-fallback {
  width: 100%;
  height: 100%;
  border-radius: 6px;
  border: 1px solid var(--border);
  color: var(--muted);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
}

.topbar-logo {
  width: 28px;
  height: 28px;
  border-radius: 8px;
}

.mobile-team-logo {
  width: 32px;
  height: 32px;
  border-radius: 9px;
}

.nav-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 38px;
  padding: 7px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.14s ease, transform 0.1s var(--ease-out);
}

.nav-row:active { transform: scale(0.985); }

.shell.collapsed:not(.no-sidebar) .nav-row {
  justify-content: center;
  padding: 7px 0;
}

.nav-row:hover { background: var(--surface-hover); }
.nav-row.active {
  background: var(--nav-active);
  color: var(--text);
  font-weight: 600;
}

.nav-icon {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

/* Main */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.topbar {
  height: 54px;
  padding: 0 24px;
  background: var(--sidebar);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.topbar-title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.015em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  padding: 0 13px 0 10px;
  height: 34px;
  min-height: 34px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.14s ease, border-color 0.14s ease, transform 0.1s var(--ease-out);
}

.back-btn svg {
  color: var(--muted);
  flex-shrink: 0;
  transition: color 0.14s ease, transform 0.14s var(--ease-out);
}

.back-btn:hover {
  background: var(--surface-hover);
  border-color: rgba(128, 128, 140, 0.35);
}

.back-btn:hover svg {
  color: var(--text);
  transform: translateX(-1.5px);
}

.back-btn:active {
  transform: scale(0.97);
}

.tab-label-short {
  display: none;
}

.theme-circle-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  transition: background 0.14s ease, transform 0.12s ease;
}

.theme-circle-btn > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.theme-circle-btn:hover { background: var(--surface-hover); }
.theme-circle-btn:active { transform: scale(0.95); }

#navSettingsMobile.active {
  background: var(--accent-soft);
  border-color: rgba(0, 88, 189, 0.35);
  color: var(--accent);
}

[data-theme="dark"] #navSettingsMobile.active {
  border-color: rgba(59, 158, 255, 0.42);
}

@keyframes iconPop {
  from { opacity: 0; transform: scale(0.8) rotate(-12deg); }
  to { opacity: 1; transform: scale(1) rotate(0deg); }
}

.theme-circle-btn > span.pop {
  animation: iconPop 0.2s var(--ease-out);
}

.content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 24px;
}

@keyframes pageEnter {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(22px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-18px); }
  to { opacity: 1; transform: translateX(0); }
}

.content.anim-fade { animation: pageEnter 0.18s var(--ease-out); }
.content.anim-push { animation: slideInRight 0.24s var(--ease-out); }
.content.anim-pop { animation: slideInLeft 0.22s var(--ease-out); }

#pageSettings .container {
  max-width: 760px;
  margin: 0 auto;
}

.container-wide {
  max-width: none;
  width: 100%;
}

.group-label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin: 0 0 8px 12px;
}

.card,
.grouped-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 24px;
  overflow: hidden;
}

.empty-block { padding: 28px 22px; }
.empty-block h2 { margin: 0 0 8px; font-size: 17px; font-weight: 600; }
.empty-block p { margin: 0; color: var(--muted); line-height: 1.55; }

.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.list-row-btn {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  flex-wrap: nowrap;
}

.list-row-btn:hover { background: var(--surface-hover); }
.list-row:last-child { border-bottom: 0; }

.list-row-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

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

.list-row-title {
  font-size: 15px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-row-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

.chevron { font-size: 20px; line-height: 1; color: var(--muted); }

.list-row-muted {
  background: var(--surface);
}

.list-row-muted .list-row-title {
  color: var(--muted);
}

.soon-badge {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface-hover);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 999px;
  flex-shrink: 0;
}

.mobile-bottom-dock {
  flex-shrink: 0;
  padding: 10px max(14px, env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  background: var(--topbar);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--border);
}

html.keyboard-open .mobile-bottom-dock {
  padding-bottom: 10px;
}

@media (min-width: 900px) {
  .mobile-bottom-dock {
    display: none !important;
  }
}

.mobile-search-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 0;
}

.mobile-search-wrap .search-field {
  flex: 1;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  min-height: 44px;
  padding: 0 14px;
}

.mobile-add-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 0;
  background: var(--btn-primary-bg);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(0, 88, 189, 0.25);
  transition: transform 0.12s var(--ease-out), filter 0.14s ease;
}

.mobile-add-btn:hover { filter: brightness(0.96); }
.mobile-add-btn:active { transform: scale(0.94); }
.mobile-add-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Modal (Apple / Telegram sheet) */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.36);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 80;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s var(--ease-out), visibility 0.2s var(--ease-out);
}

.modal-backdrop.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.modal-sheet {
  width: 100%;
  max-width: 400px;
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 20px 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.24);
  transform: scale(0.94) translateY(10px);
  opacity: 0;
  transition: transform 0.28s var(--ease-spring), opacity 0.18s ease;
}

.modal-backdrop.open .modal-sheet {
  transform: scale(1) translateY(0);
  opacity: 1;
}

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

.modal-head h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
}

.field-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

.field-label input {
  width: 100%;
  height: 42px;
  min-height: 42px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-hover);
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.14s ease, background 0.14s ease;
}

.field-label input:focus {
  border-color: var(--accent);
  background: var(--surface);
}

.form-error {
  margin-top: 10px;
  padding: 9px 12px;
  border-radius: 9px;
  background: rgba(220, 38, 38, 0.12);
  color: #b91c1c;
  font-size: 13px;
}

[data-theme="dark"] .form-error {
  background: rgba(248, 113, 113, 0.16);
  color: #fca5a5;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.btn {
  min-height: 38px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s var(--ease-out), opacity 0.14s ease, filter 0.14s ease;
}

.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:hover:not(:disabled) { filter: brightness(0.96); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--btn-primary-bg); color: #fff; }
.btn-secondary { background: var(--surface-hover); color: var(--text); }
.btn-danger { background: #dc2626; color: #fff; }

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 0;
  background: transparent;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.14s ease, color 0.14s ease, transform 0.1s var(--ease-out);
}

.icon-btn:active { transform: scale(0.93); }
.icon-btn:hover { background: var(--surface-hover); color: var(--text); }

@media (prefers-reduced-motion: reduce) {
  .content,
  .modal-sheet,
  .intro-overlay,
  .hub-card,
  .info-team-item,
  .seg-thumb {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

.modal-desc {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
}

.empty-list-msg {
  padding: 20px 16px;
  font-size: 13.5px;
  color: var(--muted);
  text-align: center;
}

.segmented {
  position: relative;
  display: inline-flex;
  background: var(--surface-hover);
  padding: 3px;
  border-radius: 10px;
}

[data-theme="dark"] .segmented {
  background: rgba(0, 0, 0, 0.28);
}

.seg-thumb {
  position: absolute;
  top: 3px;
  left: 0;
  height: calc(100% - 6px);
  border-radius: 7.5px;
  background: var(--surface);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12), 0 0 1px rgba(0, 0, 0, 0.06);
  transition: transform 0.28s var(--ease-out), width 0.28s var(--ease-out);
  pointer-events: none;
  z-index: 0;
}

[data-theme="dark"] .seg-thumb {
  background: #2d333d;
}

.seg-thumb.no-anim {
  transition: none !important;
}

.seg-btn {
  position: relative;
  z-index: 1;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 7.5px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.18s ease, transform 0.1s var(--ease-out);
}

.seg-btn:active { transform: scale(0.96); }

.seg-btn.active {
  color: var(--text);
  font-weight: 600;
}

/* iPhone (< 900px) — Telegram style navigation */
@media (max-width: 899px) {
  .mobile-only { display: flex; }
  .topbar .mobile-only { display: inline-flex; }

  .shell,
  .shell.collapsed {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
  }

  .main {
    grid-column: 1;
    grid-row: 1;
  }

  .sidebar { display: none; }

  .topbar {
    height: calc(54px + env(safe-area-inset-top));
    min-height: 0;
    padding: env(safe-area-inset-top) max(14px, env(safe-area-inset-right)) 0 max(14px, env(safe-area-inset-left));
    gap: 8px;
  }

  .topbar-left {
    min-width: 0;
    flex: 1;
    gap: 8px;
  }

  .topbar-brand-logo {
    height: 19px;
    width: auto;
    max-width: 132px;
  }

  .topbar-brand-logo:not(.hidden) {
    display: block;
  }

  .topbar-title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 16px;
  }

  .theme-circle-btn {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
  }

  .back-btn {
    width: 44px;
    height: 44px;
    min-height: 44px;
    min-width: 44px;
    padding: 0;
    border-radius: 50%;
    justify-content: center;
  }

  .back-btn span {
    display: none;
  }

  .back-btn svg {
    width: 17px;
    height: 17px;
    color: var(--text);
  }

  .logo-home-btn {
    min-height: 44px;
  }

  .topbar-right .icon-btn-danger {
    width: 44px;
    height: 44px;
    border: 1px solid var(--border);
    background: var(--surface);
  }

  .content {
    padding: 14px max(14px, env(safe-area-inset-right)) calc(20px + env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  }

  .main.has-mobile-dock .content {
    padding-bottom: 12px;
  }

  .list-row-btn { min-height: 52px; padding: 10px 14px; }

  .modal-sheet {
    max-height: calc(var(--vvh, 100dvh) - 24px);
    overflow-y: auto;
  }
}

@media (max-width: 600px) {
  .tab-label-full {
    display: none;
  }

  .tab-label-short {
    display: inline;
  }
}

@media (max-width: 430px) {
  .topbar {
    gap: 6px;
    padding: env(safe-area-inset-top) max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left));
  }

  .topbar-right {
    gap: 6px;
  }

  .theme-circle-btn,
  .topbar-right .icon-btn-danger,
  .back-btn {
    width: 44px;
    height: 44px;
  }

  #topbarTeamLogo {
    display: none;
  }
}

/* Панель управления командой без капсулы, кнопки и вкладки в стиле Telegram */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.topbar-right .icon-btn-danger {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
}

.icon-btn-danger {
  border-radius: 999px;
  color: var(--muted);
}

.icon-btn-danger:hover {
  background: rgba(220, 38, 38, 0.12);
  color: #dc2626;
}

[data-theme="dark"] .icon-btn-danger:hover {
  background: rgba(248, 113, 113, 0.16);
  color: #f87171;
}

.btn-tg {
  min-height: 36px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
}

.btn-tg-neutral {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-tg-neutral:hover:not(:disabled) {
  background: var(--surface-hover);
  filter: none;
}

.btn-tg-danger {
  background: var(--surface);
  color: #dc2626;
  border: 1px solid rgba(220, 38, 38, 0.24);
}

.btn-tg-danger:hover:not(:disabled) {
  background: rgba(220, 38, 38, 0.10);
  filter: none;
}

[data-theme="dark"] .btn-tg-danger {
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.28);
}

[data-theme="dark"] .btn-tg-danger:hover:not(:disabled) {
  background: rgba(248, 113, 113, 0.14);
}

.team-head {
  padding: 2px 0 4px;
}

.team-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.team-tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  max-width: 100%;
}

.team-tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  transition: background 0.14s ease, color 0.14s ease;
}

.team-tab:hover {
  color: var(--text);
}

.team-tab.active {
  background: var(--nav-active);
  color: var(--text);
  font-weight: 600;
}

.tab-badge {
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--nav-active);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

[data-theme="dark"] .tab-badge {
  color: #cbd5e1;
}

.team-tab.active .tab-badge {
  background: var(--surface);
  color: var(--text);
}

.tab-badge-warn {
  background: rgba(245, 158, 11, 0.16);
  color: #92400e;
}

.team-tab.active .tab-badge-warn {
  background: rgba(245, 158, 11, 0.22);
  color: #92400e;
}

[data-theme="dark"] .tab-badge-warn,
[data-theme="dark"] .team-tab.active .tab-badge-warn {
  background: rgba(251, 191, 36, 0.2);
  color: #fcd34d;
}

.team-summary-sub {
  margin: 12px 4px 0;
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.4;
}

.team-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

@media (max-width: 1279px) {
  .team-actions {
    justify-content: flex-start;
  }
}

.team-panel {
  margin-top: 14px;
}

.btn-icon {
  margin-right: 7px;
  flex-shrink: 0;
}

.btn.is-loading .btn-icon {
  animation: spinIcon 0.9s linear infinite;
}

@keyframes spinIcon {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.sync-progress {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--surface-hover);
  border: 1px solid var(--border);
}

.sync-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 13px;
}

.sync-status-text {
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sync-count-text {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.sync-bar-track {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

.sync-bar-fill {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.25s var(--ease-out);
}

.action-notice {
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13.5px;
  line-height: 1.45;
  background: var(--accent-soft);
  color: var(--text);
}

.action-notice.is-error {
  background: rgba(220, 38, 38, 0.12);
  color: #b91c1c;
}

[data-theme="dark"] .action-notice.is-error {
  background: rgba(248, 113, 113, 0.14);
  color: #fca5a5;
}

.check-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  cursor: pointer;
}

.check-row input[type="checkbox"] {
  margin-top: 3px;
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.check-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.check-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.check-sub {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.35;
}

@media (max-width: 899px) {
  .team-head {
    padding: 0;
  }

  .team-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .team-tabs {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
  }

  .team-tab {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 44px;
    justify-content: center;
    padding: 6px 8px;
    font-size: 12.5px;
    gap: 4px;
  }

  .tab-badge {
    font-size: 12px;
    padding: 2px 6px;
  }

  .team-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .team-actions .btn {
    width: 100%;
    min-height: 44px;
    padding: 8px 10px;
    font-size: 13px;
  }

  #syncTeamBtn,
  #clearDataOpenBtn {
    grid-column: 1 / -1;
  }
}

/* Вкладка «Состав» и «Требуют проверки»: фильтры и сетка карточек */
.roster-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.roster-search {
  flex: 1 1 280px;
  max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.roster-filters {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-pill {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}

.filter-pill:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.filter-pill.active {
  background: var(--btn-primary-bg);
  border-color: var(--btn-primary-bg);
  color: #fff;
  font-weight: 600;
}

.roster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 14px;
}

/* Докрученная хоккейная карточка (формат прошлой версии + Telegram-чистота) */
.hockey-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  transition: border-color 0.15s ease, transform 0.14s var(--ease-out), box-shadow 0.15s ease;
  cursor: pointer;
}

.hockey-card:hover {
  transform: translateY(-2px);
  border-color: rgba(0, 88, 189, 0.34);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .hockey-card:hover {
  border-color: rgba(59, 158, 255, 0.38);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
}

.card-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.card-number-badge {
  font-size: 13px;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 7px;
  background: var(--nav-active);
  color: var(--text);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
}

.card-number-badge.missing {
  background: rgba(245, 158, 11, 0.16);
  color: #92400e;
  font-size: 12px;
}

[data-theme="dark"] .card-number-badge.missing {
  background: rgba(251, 191, 36, 0.18);
  color: #fcd34d;
}

.card-status-dot {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
  border: 0;
  font-family: inherit;
}

.card-status-dot.is-clickable {
  cursor: pointer;
  transition: filter 0.14s ease, transform 0.1s ease;
}

.card-status-dot.is-clickable:hover {
  filter: brightness(0.92);
}

.card-status-dot.is-clickable:active {
  transform: scale(0.96);
}

.card-status-dot.ok {
  background: rgba(16, 185, 129, 0.14);
  color: #047857;
}

[data-theme="dark"] .card-status-dot.ok {
  background: rgba(52, 211, 153, 0.16);
  color: #6ee7b7;
}

.card-status-dot.missing {
  background: var(--surface-hover);
  color: var(--muted);
}

.card-status-dot.warn {
  background: rgba(245, 158, 11, 0.16);
  color: #92400e;
}

[data-theme="dark"] .card-status-dot.warn {
  background: rgba(251, 191, 36, 0.18);
  color: #fcd34d;
}

.card-photo-wrapper {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 11px;
}

.card-photo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}

.card-photo-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.card-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.card-player-lastname {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  color: var(--text);
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-player-firstname {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  opacity: 0.85;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-role-pill {
  display: inline-flex;
  align-self: flex-start;
  max-width: 100%;
  margin-top: 5px;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

[data-theme="dark"] .card-role-pill {
  color: #7cc4ff;
}

.card-specs-footer {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
}

.card-specs-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
}

.card-specs-line {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.card-specs-shot {
  white-space: nowrap;
  flex-shrink: 0;
  font-weight: 600;
  color: var(--text);
  opacity: 0.78;
}

.card-actions-row {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 5px;
  margin-top: 10px;
}

.card-actions-row.has-confirm {
  flex-wrap: wrap;
  gap: 6px;
}

.card-edit-btn {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 30px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-hover);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: background 0.14s ease, border-color 0.14s ease;
}

.card-edit-btn span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-edit-btn .tab-label-full {
  display: none;
}

.card-edit-btn .tab-label-short {
  display: inline;
}

.card-edit-btn:hover {
  background: var(--nav-active);
}

.card-confirm-btn {
  flex: 1 1 auto;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  border: 0;
  background: var(--btn-primary-bg);
  color: #fff;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.card-link-icon-btn {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}

.card-link-icon-btn:hover {
  background: var(--nav-active);
  border-color: var(--accent);
  color: var(--accent);
}

.card-link-label {
  display: none;
}

.edit-link-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.edit-link-row input {
  flex: 1 1 auto;
  min-width: 0;
}

.edit-link-open-btn {
  flex-shrink: 0;
  text-decoration: none;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.card-delete-icon-btn {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}

.card-delete-icon-btn:hover {
  background: rgba(220, 38, 38, 0.12);
  border-color: rgba(220, 38, 38, 0.25);
  color: #dc2626;
}

[data-theme="dark"] .card-delete-icon-btn:hover {
  background: rgba(248, 113, 113, 0.16);
  color: #f87171;
}

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

.disputed-desc {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--muted);
}

.disputed-header .disputed-desc {
  flex: 1 1 280px;
}

.disputed-subsection {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.disputed-subsection.is-solo {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.disputed-subhead {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.disputed-subtitle-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.disputed-subtitle {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

/* Модалка редактирования карточки */
.modal-sheet-wide {
  max-width: 580px;
}

.edit-person-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.edit-photo-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.edit-photo-preview {
  width: 72px;
  height: 72px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--muted);
  font-weight: 700;
  font-size: 20px;
}

.edit-photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}

.edit-photo-controls {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
}

.edit-photo-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.edit-upload-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.edit-upload-btn:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.edit-photo-hint {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}

.edit-fields-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.edit-fields-grid.is-single {
  grid-template-columns: 1fr;
}

.edit-person-form select {
  width: 100%;
  height: 42px;
  min-height: 42px;
  padding: 0 36px 0 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background-color: var(--surface-hover);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23545458' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 15px 15px;
  appearance: none;
  -webkit-appearance: none;
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  line-height: 1.25;
  cursor: pointer;
  outline: none;
  transition: border-color 0.14s ease, background-color 0.14s ease;
}

[data-theme="dark"] .edit-person-form select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

.edit-person-form select:focus {
  border-color: var(--accent);
  background-color: var(--surface);
}

.edit-person-form .modal-actions {
  margin-top: 6px;
}

.edit-person-form .form-error {
  margin-top: 0;
}

/* Вкладка «Шаблон и файлы» */
.files-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 14px;
}

.file-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.file-card-top {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  min-width: 0;
}

.file-card-icon {
  width: 60px;
  height: 60px;
  border-radius: 12px;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  color: var(--accent);
}

.file-card-icon.is-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 7px;
  display: block;
}

.file-card-icon.is-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.file-card-logo-letter {
  font-size: 22px;
  font-weight: 700;
  color: var(--muted);
}

.file-card-meta {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.file-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.file-card-title {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  color: var(--text);
}

.file-status-pill {
  font-size: 12px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.file-status-pill.ok {
  background: rgba(22, 163, 74, 0.14);
  color: #146c35;
}

.file-status-pill.shared {
  background: var(--accent-soft);
  color: var(--accent);
}

.file-status-pill.missing {
  background: rgba(217, 119, 6, 0.14);
  color: #9a4307;
}

[data-theme="dark"] .file-status-pill.ok {
  background: rgba(74, 222, 128, 0.16);
  color: #86efac;
}

[data-theme="dark"] .file-status-pill.shared {
  color: #7cc4ff;
}

[data-theme="dark"] .file-status-pill.missing {
  background: rgba(251, 191, 36, 0.16);
  color: #fcd34d;
}

.file-card-file {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-card-note {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--muted);
}

.file-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
}

.file-card-actions .btn-tg {
  min-height: 36px;
}

/* Модалка сборки анкет (Photoshop + выборочный архив) */
.build-mode-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-top: 12px;
  margin-bottom: 12px;
}

.build-mode-btn {
  min-height: 36px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  padding: 6px 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 0.14s ease, color 0.14s ease, box-shadow 0.14s ease;
}

.build-mode-btn.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .build-mode-btn.active {
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.build-select-pane {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.build-select-tools {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.build-search-field {
  min-height: 38px;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.build-quick-picks {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.build-checklist {
  max-height: 256px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-hover);
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.build-pick-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 9px;
  cursor: pointer;
  min-width: 0;
  transition: background 0.12s ease;
}

.build-pick-row:hover {
  background: var(--surface);
}

.build-pick-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--btn-primary-bg);
  flex-shrink: 0;
  cursor: pointer;
}

.build-pick-num {
  font-size: 12px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--nav-active);
  color: var(--text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
}

.build-pick-num.missing {
  background: rgba(245, 158, 11, 0.18);
  color: #92400e;
}

[data-theme="dark"] .build-pick-num.missing {
  color: #fcd34d;
}

.build-pick-main {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.build-pick-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.build-pick-sub {
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.build-pick-state {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.build-pick-state.ok { color: #146c35; }
.build-pick-state.warn { color: #92400e; }
.build-pick-state.muted { color: var(--muted); }

[data-theme="dark"] .build-pick-state.ok { color: #86efac; }
[data-theme="dark"] .build-pick-state.warn { color: #fcd34d; }

.build-checklist-empty {
  padding: 18px 12px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

/* Просмотр готовой анкеты */
.card-preview-box {
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}

.card-preview-box img {
  max-width: 100%;
  max-height: calc(var(--vvh, 100dvh) * 0.50);
  border-radius: 10px;
  object-fit: contain;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
  display: block;
}

.card-preview-empty {
  text-align: center;
  font-size: 13.5px;
  color: var(--muted);
  padding: 18px 12px;
  line-height: 1.45;
}

@media (max-width: 899px) {
  .files-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .file-card {
    padding: 14px;
    gap: 12px;
  }

  .file-card-actions .btn-tg {
    min-height: 44px;
  }

  .roster-search {
    max-width: none;
    flex: 1 1 100%;
  }

  .roster-filters {
    width: 100%;
    flex-wrap: wrap;
    gap: 6px;
  }

  .filter-pill {
    min-height: 44px;
    padding: 8px 13px;
  }

  .card-top-row {
    gap: 5px;
  }

  .card-number-badge,
  .card-status-dot {
    min-width: 0;
    max-width: 100%;
    flex-shrink: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .seg-btn {
    min-height: 44px;
  }

  .modal-head .icon-btn,
  .modal-actions .btn,
  .edit-upload-btn,
  .build-mode-btn {
    min-height: 44px;
  }

  .modal-head .icon-btn {
    min-width: 44px;
  }

  .roster-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .hockey-card {
    padding: 10px;
  }

  .card-player-lastname {
    font-size: 13.5px;
  }

  .card-player-firstname {
    font-size: 12px;
  }

  .card-specs-footer {
    font-size: 12px;
  }

  .card-actions-row {
    flex-wrap: nowrap;
    gap: 6px;
  }

  .card-actions-row.has-confirm,
  .card-actions-row.has-link {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px;
    gap: 6px;
  }

  .card-actions-row.has-confirm .card-edit-btn,
  .card-actions-row.has-link .card-edit-btn {
    grid-column: 1;
    grid-row: 1;
  }

  .card-actions-row.has-confirm .card-delete-icon-btn,
  .card-actions-row.has-link .card-delete-icon-btn {
    grid-column: 2;
    grid-row: 1;
  }

  .card-actions-row.has-link .card-link-icon-btn {
    position: relative;
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    height: auto;
    min-height: 40px;
    padding: 0 6px;
    font-size: 11.5px;
    font-weight: 600;
    gap: 4px;
    background: var(--nav-active);
    border-color: transparent;
    color: var(--accent);
  }

  .card-actions-row.has-link .card-link-icon-btn svg {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
  }

  .card-actions-row.has-link .card-link-icon-btn::after {
    content: "";
    position: absolute;
    inset: -2px 0;
  }

  .card-actions-row.has-link .card-link-label {
    display: inline;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .card-actions-row.has-confirm .card-confirm-btn {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
  }

  .card-actions-row.has-confirm.has-link .card-confirm-btn {
    grid-row: 3;
  }

  .card-edit-btn {
    min-height: 44px;
    font-size: 12.5px;
    padding: 0 8px;
    gap: 5px;
    overflow: hidden;
  }

  .card-edit-btn span {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .card-edit-btn svg {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
  }

  .card-confirm-btn {
    min-height: 44px;
    font-size: 12.5px;
  }

  .card-delete-icon-btn {
    width: 44px;
    height: 44px;
  }

  .edit-link-row {
    flex-direction: column;
  }

  .edit-link-open-btn {
    width: 100%;
    min-height: 44px;
  }

  .card-status-dot.is-clickable {
    position: relative;
    min-height: 28px;
    padding: 4px 9px;
  }

  .card-status-dot.is-clickable::after {
    content: "";
    position: absolute;
    inset: -8px -6px;
  }

  .edit-photo-btns .btn-tg,
  #editPersonOpenCardBtn {
    min-height: 44px;
  }

  .search-field {
    min-height: 44px;
  }

  .modal-actions .btn-tg,
  .file-card-actions .btn-tg,
  .logo-asset-actions .btn-tg,
  .settings-row-actions .btn-tg {
    white-space: normal;
  }
}

@media (max-width: 899px), (pointer: coarse) {
  .field-label input,
  .edit-person-form select,
  .search-field input {
    font-size: 16px;
  }

  .field-label input,
  .edit-person-form select {
    min-height: 44px;
    height: 44px;
  }

  .modal-actions .btn {
    min-height: 44px;
  }
}

@media (max-width: 600px) {
  .modal-backdrop {
    top: var(--vvt, 0px);
    bottom: auto;
    left: 0;
    right: 0;
    height: var(--vvh, 100dvh);
    padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  }

  .modal-sheet {
    padding: 16px;
    max-height: calc(var(--vvh, 100dvh) - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    border-radius: 16px;
  }

  .modal-head {
    margin-bottom: 12px;
  }

  .modal-actions {
    gap: 10px;
    margin-top: 14px;
  }

  .modal-actions .btn {
    flex: 1;
    min-height: 44px;
  }

  .edit-person-form {
    gap: 10px;
  }

  .edit-person-form .modal-actions {
    margin-top: 4px;
  }

  .edit-photo-row {
    gap: 12px;
  }

  .edit-photo-preview {
    width: 64px;
    height: 64px;
  }

  .edit-person-form select {
    padding: 0 30px 0 11px;
    background-position: right 10px center;
  }

  #clearDisputedBtn {
    width: 100%;
    min-height: 44px;
  }

  .build-checklist {
    max-height: calc(var(--vvh, 100dvh) * 0.34);
  }

  .build-mode-btn {
    font-size: 12.5px;
    padding: 6px 6px;
    gap: 4px;
    min-width: 0;
    overflow: hidden;
  }

  .build-modal-actions {
    flex-wrap: wrap;
  }

  .build-modal-actions .btn {
    flex: 1 1 115px;
  }

  .file-card-actions .btn-tg {
    flex: 1 1 auto;
    min-height: 44px;
  }

  #pageSettings .list-row:has(.segmented) {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .segmented {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .seg-btn {
    width: 100%;
    padding: 7px 6px;
    justify-content: center;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .edit-fields-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 430px) {
  .build-pick-row {
    gap: 7px;
    padding: 8px;
  }

  .card-number-badge {
    font-size: 12px;
    padding: 2px 7px;
  }

  .card-status-dot,
  .card-status-dot.is-clickable {
    font-size: 11px;
    padding: 3px 7px;
  }

  .card-actions-row.has-link .card-link-icon-btn {
    font-size: 11px;
    padding: 0 5px;
    gap: 4px;
  }
}

@media (max-width: 380px) {
  .team-tab {
    padding: 6px 5px;
    gap: 3px;
    font-size: 12px;
  }

  .tab-badge {
    padding: 2px 5px;
  }

  .modal-actions {
    flex-wrap: wrap;
  }

  .modal-actions .btn {
    flex: 1 1 120px;
  }

  .card-top-row {
    gap: 4px;
  }

  .card-edit-btn {
    padding: 0 5px;
    gap: 3px;
  }
}

@media (max-width: 359px) {
  .roster-grid {
    grid-template-columns: 1fr;
  }

  .team-actions .btn {
    font-size: 12.5px;
    padding: 8px 6px;
  }

  .seg-btn {
    font-size: 12px;
    padding: 7px 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* Интро при входе на сайт */
.intro-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
  cursor: pointer;
  user-select: none;
  overflow: hidden;
  transition: opacity 0.42s var(--ease-out), transform 0.42s var(--ease-out);
}

.intro-overlay.leaving {
  opacity: 0;
  transform: scale(1.03);
  pointer-events: none;
}

.intro-glow {
  position: absolute;
  width: min(460px, 85vw);
  height: min(460px, 85vw);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(97, 29, 255, 0.22) 0%, rgba(0, 88, 189, 0.14) 42%, transparent 72%);
  filter: blur(22px);
  animation: introGlowPulse 1.6s var(--ease-out) forwards;
  pointer-events: none;
}

[data-theme="dark"] .intro-glow {
  background: radial-gradient(circle, rgba(124, 58, 237, 0.34) 0%, rgba(59, 158, 255, 0.2) 45%, transparent 74%);
}

.intro-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}

.intro-logo-wrap {
  position: relative;
  padding: 12px 18px;
  border-radius: 18px;
  overflow: hidden;
  animation: introLogoEnter 0.72s var(--ease-spring) forwards;
}

.intro-logo {
  display: block;
  height: clamp(36px, 7vw, 54px);
  width: auto;
  max-width: min(320px, 78vw);
  object-fit: contain;
}

[data-theme="dark"] .intro-logo {
  filter: brightness(1.58) saturate(0.85) drop-shadow(0 0 18px rgba(124, 58, 237, 0.35));
}

.intro-shine {
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 25%, rgba(255, 255, 255, 0.55) 50%, transparent 75%);
  transform: translateX(-130%);
  animation: introShineSweep 0.95s 0.35s var(--ease-out) forwards;
  pointer-events: none;
}

[data-theme="dark"] .intro-shine {
  background: linear-gradient(110deg, transparent 25%, rgba(255, 255, 255, 0.28) 50%, transparent 75%);
}

.intro-caption {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--muted);
  opacity: 0;
  animation: introCaptionIn 0.55s 0.28s var(--ease-out) forwards;
}

@keyframes introLogoEnter {
  from { opacity: 0; transform: scale(0.84) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes introGlowPulse {
  0% { opacity: 0; transform: scale(0.72); }
  55% { opacity: 1; transform: scale(1.06); }
  100% { opacity: 0.85; transform: scale(1); }
}

@keyframes introShineSweep {
  from { transform: translateX(-130%); }
  to { transform: translateX(130%); }
}

@keyframes introCaptionIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .intro-logo-wrap,
  .intro-glow,
  .intro-shine,
  .intro-caption {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
  .intro-shine { display: none; }
}

/* Панель управления системой (Hub) */
.hub-container {
  max-width: 880px;
  margin: 0 auto;
  padding-top: clamp(12px, 4vh, 36px);
}

.hub-hero {
  margin-bottom: 24px;
}

.hub-heading {
  margin: 0 0 6px;
  font-size: clamp(24px, 3vw, 30px);
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text);
}

.hub-subheading {
  margin: 0;
  font-size: 15px;
  line-height: 1.45;
  color: var(--muted);
}

.hub-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.hub-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  padding: 22px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.16s var(--ease-out), border-color 0.18s ease, box-shadow 0.2s ease, background 0.16s ease;
}

.hub-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .hub-card:hover {
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.34);
}

.hub-card:active {
  transform: scale(0.99);
}

.hub-card-top {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.hub-icon {
  width: 48px;
  height: 48px;
  border-radius: 13px;
  display: grid;
  place-items: center;
}

.hub-icon-blue {
  background: rgba(0, 88, 189, 0.11);
  color: var(--accent);
}

.hub-icon-violet {
  background: rgba(97, 29, 255, 0.12);
  color: #611dff;
}

[data-theme="dark"] .hub-icon-violet {
  background: rgba(139, 92, 246, 0.22);
  color: #b794ff;
}

.hub-arrow {
  font-size: 18px;
  font-weight: 600;
  color: var(--muted);
  transition: transform 0.16s var(--ease-out), color 0.16s ease;
}

.hub-card:hover .hub-arrow {
  transform: translateX(3px);
  color: var(--accent);
}

.hub-card-title {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin-bottom: 8px;
}

.hub-card-desc {
  margin: 0 0 18px;
  font-size: 14px;
  line-height: 1.48;
  color: var(--muted);
  flex: 1;
}

.hub-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hub-meta-pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--surface-hover);
  color: var(--text);
}

/* Профиль команды (Информация о командах / табло) */
.team-info-wrap {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-bottom: 4px;
}

.info-hero-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.info-hero-main {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.info-hero-logo {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  padding: 6px;
}

.info-hero-logo img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

.info-hero-text {
  min-width: 0;
}

.info-hero-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 4px;
}

.info-hero-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  overflow-wrap: anywhere;
}

.code-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--accent-soft);
  color: var(--accent);
}

[data-theme="dark"] .code-pill,
[data-theme="dark"] .list-row-code-chip {
  color: #7cc4ff;
}

.info-hero-sub {
  font-size: 13px;
  color: var(--muted);
}

.info-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex-shrink: 0;
}

.info-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 4px 0 8px;
}

.info-section-title {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}

.copy-fields-list {
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  overflow: hidden;
}

.copy-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}

.copy-row:last-child {
  border-bottom: 0;
}

.copy-row-meta {
  min-width: 0;
}

.copy-row-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 2px;
}

.copy-row-val {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
}

.copy-row-val-empty {
  color: var(--muted);
  font-weight: 500;
}

.copy-row-code {
  font-size: 16.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.copy-btn {
  flex-shrink: 0;
  min-width: 118px;
  justify-content: center;
}

.copy-btn.copied {
  background: rgba(16, 185, 129, 0.14);
  color: #047857;
  border-color: rgba(16, 185, 129, 0.35);
}

[data-theme="dark"] .copy-btn.copied {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

.logo-assets-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.logo-asset-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  padding: 15px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.logo-asset-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.logo-asset-title {
  margin: 0;
  font-size: 15.5px;
  font-weight: 700;
}

.checkerboard-box {
  height: 160px;
  border-radius: 12px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  overflow: hidden;
  background-color: #cdd2db;
  background-image:
    linear-gradient(45deg, #bec4cf 25%, transparent 25%),
    linear-gradient(-45deg, #bec4cf 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #bec4cf 75%),
    linear-gradient(-45deg, transparent 75%, #bec4cf 75%);
  background-size: 18px 18px;
  background-position: 0 0, 0 9px, 9px -9px, -9px 0;
}

[data-theme="dark"] .checkerboard-box {
  background-color: #3a414e;
  background-image:
    linear-gradient(45deg, #303642 25%, transparent 25%),
    linear-gradient(-45deg, #303642 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #303642 75%),
    linear-gradient(-45deg, transparent 75%, #303642 75%);
}

.checkerboard-box img {
  max-width: 100%;
  max-height: 132px;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

.checkerboard-box-200 img {
  width: 128px;
  height: 128px;
}

.logo-asset-empty {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

.logo-asset-meta {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.45;
}

.logo-asset-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
}

.list-row-code-chip {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 3px 7px;
  border-radius: 7px;
  background: var(--accent-soft);
  color: var(--accent);
  flex-shrink: 0;
}

.input-uppercase {
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.08em;
}

@media (max-width: 899px) {
  .hub-grid {
    grid-template-columns: 1fr;
  }

  .hub-card {
    padding: 18px;
  }

  .logo-assets-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .info-hero-card {
    flex-direction: column;
    align-items: stretch;
  }

  .info-hero-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
  }

  .info-hero-actions .btn-tg {
    width: 100%;
    min-height: 44px;
    padding: 8px 10px;
  }

  .copy-row {
    gap: 10px;
    padding: 12px 14px;
  }

  .copy-row-meta {
    flex: 1;
    min-width: 0;
  }

  .copy-btn {
    min-width: 132px;
    min-height: 44px;
    padding: 8px 12px;
    font-size: 13px;
  }

  .logo-asset-actions .btn-tg {
    min-height: 44px;
    flex: 1 1 130px;
  }
}

@media (max-width: 430px) {
  .info-hero-card {
    padding: 14px;
    gap: 12px;
  }

  .info-hero-main {
    gap: 12px;
  }

  .info-hero-logo {
    width: 52px;
    height: 52px;
  }

  .info-hero-title {
    font-size: 17.5px;
  }
}

@media (max-width: 380px) {
  .info-hero-actions {
    grid-template-columns: 1fr;
  }

  .copy-row {
    flex-direction: column;
    align-items: stretch;
  }

  .copy-btn {
    width: 100%;
  }
}

/* Раздел «Информация о командах»: карточки на всю рабочую область (ПК) / список (iPhone) */
.info-list-container {
  max-width: 1480px;
  width: 100%;
  margin: 0 auto;
  padding-bottom: 24px;
}

.info-detail-container {
  max-width: 1220px;
  width: 100%;
  margin: 0 auto;
  padding-bottom: 28px;
}

.info-list-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.info-list-title {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.info-list-sub {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.info-desktop-search {
  width: 320px;
  min-width: 240px;
  height: 40px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.info-teams-surface {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 14px;
}

.info-team-item {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  text-decoration: none;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  gap: 14px;
  cursor: pointer;
  transition: transform 0.16s var(--ease-out), border-color 0.18s ease, box-shadow 0.2s ease, background 0.16s ease;
}

.info-team-item:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .info-team-item:hover {
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.34);
}

.info-team-item:active {
  transform: scale(0.99);
}

.info-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.info-card-logo {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.info-card-logo img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

.info-card-badges {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.info-card-arrow {
  font-size: 16px;
  font-weight: 600;
  color: var(--muted);
  transition: transform 0.16s var(--ease-out), color 0.16s ease;
}

.info-team-item:hover .info-card-arrow {
  transform: translateX(3px);
  color: var(--accent);
}

.info-card-body {
  min-width: 0;
}

.info-card-name {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.info-card-city {
  font-size: 13.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.info-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
}

.info-card-chevron {
  display: none;
}

/* Полноценная страница профиля команды */
.info-detail-grid {
  display: grid;
  grid-template-columns: minmax(300px, 400px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.mobile-bottom-dock.search-only #createTeamMobileBtn {
  display: none;
}

.edit-profile-inline {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  margin: 14px 0 16px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--accent);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.06);
}

.edit-profile-inline-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

@media (max-width: 1180px) {
  .info-detail-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 899px) {
  .info-desktop-search {
    display: none;
  }

  .info-list-title {
    display: none;
  }

  .info-list-container {
    padding-bottom: 16px;
  }

  .main.has-mobile-dock .info-list-container {
    padding-bottom: 4px;
  }

  /* На iPhone: единый компактный список вместо широких карточек */
  .info-teams-surface {
    display: flex;
    flex-direction: column;
    gap: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
  }

  .info-team-item {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    border: 0;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    padding: 11px 14px;
    min-height: 58px;
    gap: 12px;
    box-shadow: none;
  }

  .info-team-item:last-child {
    border-bottom: 0;
  }

  .info-team-item:hover {
    transform: none;
    box-shadow: none;
    background: var(--surface-hover);
  }

  .info-card-top {
    order: 1;
    display: flex;
    align-items: center;
  }

  .info-card-logo {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    padding: 4px;
  }

  .info-card-badges,
  .info-card-arrow,
  .info-card-foot {
    display: none;
  }

  .info-card-body {
    order: 2;
    flex: 1;
    min-width: 0;
  }

  .info-card-name {
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 2px;
  }

  .info-card-city {
    font-size: 12px;
  }

  .info-card-chevron {
    order: 3;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
  }
}

/* Полноценные разделы настроек: Команды и лига, Папки и выгрузка */
.list-row-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.settings-row-stack {
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}

.settings-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.settings-row-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

.settings-row-actions .btn-tg {
  white-space: nowrap;
}

.settings-check-label {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.settings-check-label input[type="checkbox"] {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: var(--btn-primary-bg);
  flex-shrink: 0;
  cursor: pointer;
}

.settings-path-sub {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-sync-box {
  margin-top: 2px;
}

.settings-notice {
  margin-top: 14px;
}

@media (max-width: 899px) {
  .list-row:has(.settings-row-actions),
  .settings-row-top {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .settings-row-actions {
    justify-content: flex-start;
  }

  .settings-row-actions .btn-tg {
    min-height: 44px;
    flex: 1 1 140px;
  }

  .settings-path-sub {
    white-space: normal;
    word-break: break-word;
  }

  .settings-check-label {
    min-height: 44px;
    align-items: center;
    line-height: 1.35;
  }

  .settings-check-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-top: 1px;
  }
}

/* Экран входа (Авторизация) */
.auth-gate {
  position: relative;
  min-height: var(--vvh, 100dvh);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(20px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: var(--bg);
  overflow-x: hidden;
  overflow-y: auto;
}

.auth-gate.hidden {
  display: none !important;
}

.auth-glow {
  position: fixed;
  top: 42%;
  left: 50%;
  width: min(560px, 95vw);
  height: min(560px, 95vw);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(97, 29, 255, 0.14) 0%, rgba(0, 88, 189, 0.08) 45%, transparent 72%);
  filter: blur(26px);
  pointer-events: none;
}

[data-theme="dark"] .auth-glow {
  background: radial-gradient(circle, rgba(124, 58, 237, 0.24) 0%, rgba(59, 158, 255, 0.12) 45%, transparent 74%);
}

.auth-theme-btn {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
  z-index: 10;
}

.auth-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 390px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px 24px 24px;
  box-shadow: 0 20px 54px rgba(15, 23, 42, 0.09);
  animation: pageEnter 0.24s var(--ease-out);
}

[data-theme="dark"] .auth-card {
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.42);
}

.auth-brand {
  display: flex;
  justify-content: center;
  margin-bottom: 18px;
}

.auth-logo {
  height: 28px;
  width: auto;
  display: block;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

[data-theme="dark"] .auth-logo {
  filter: brightness(1.58) saturate(0.85);
}

.auth-title {
  margin: 0 0 6px;
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  letter-spacing: -0.02em;
  color: var(--text);
}

.auth-sub {
  margin: 0 0 20px;
  font-size: 13.5px;
  line-height: 1.45;
  text-align: center;
  color: var(--muted);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-form .form-error {
  margin-top: 0;
}

.password-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.password-input-wrap input {
  padding-right: 46px;
}

.password-toggle-btn {
  position: absolute;
  right: 2px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: color 0.14s ease, background 0.14s ease;
}

.password-toggle-btn:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.auth-submit-btn {
  width: 100%;
  min-height: 44px;
  margin-top: 4px;
  font-size: 15px;
  border-radius: 12px;
}

@media (max-width: 899px), (pointer: coarse) {
  .password-toggle-btn {
    width: 44px;
    height: 44px;
  }

  .auth-card {
    padding: 24px 18px 20px;
    border-radius: 18px;
  }
}
