/* ═══════════════════════════════════════════════════════════════
   MARKETING ARENA — High-End Design System & Micro-Interactions
   Aesthetic: Obsidian Editorial & Fintech Operations
   Typography: Onest + Inter + JetBrains Mono
   ═══════════════════════════════════════════════════════════════ */

:root,
[data-theme="dark"] {
  --bg-app: #0D0F12;
  --bg-topbar: rgba(13, 15, 18, 0.88);
  --surface-card: #16191F;
  --surface-elevated: #1C2027;
  --surface-subtle: rgba(255, 255, 255, 0.03);
  --surface-hover: #222833;

  --text-main: #F0F3F8;
  --text-secondary: #8B95A5;
  --text-muted: #6B7280;

  --border-subtle: #222733;
  --border-active: rgba(255, 255, 255, 0.18);
  --border-glass: rgba(255, 255, 255, 0.05);
  --field-bg: rgba(255, 255, 255, 0.05);

  --accent-magenta: #F0047F;
  --accent-magenta-hover: #D0036E;
  --accent-magenta-glow: rgba(240, 4, 127, 0.28);
  --accent-magenta-subtle: rgba(240, 4, 127, 0.12);

  --accent-cyan: #00F0FF;
  --accent-cyan-subtle: rgba(0, 240, 255, 0.10);

  --gold-podium: #FFB800;
  --gold-glow: rgba(255, 184, 0, 0.22);
  --silver-podium: #CBD5E1;
  --bronze-podium: #F59E0B;

  --badge-urgent: #EF4444;
  --badge-urgent-bg: rgba(239, 68, 68, 0.12);
  --badge-success: #10B981;
  --badge-success-bg: rgba(16, 185, 129, 0.12);

  --radius-pill: 9999px;
  --radius-xl: 18px;
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 6px;

  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.45);
  --shadow-pop: 0 12px 32px rgba(0, 0, 0, 0.65);
}

[data-theme="light"] {
  --bg-app: #F7F9FC;
  --bg-topbar: rgba(247, 249, 252, 0.88);
  --surface-card: #FFFFFF;
  --surface-elevated: #F1F4F9;
  --surface-subtle: rgba(0, 0, 0, 0.02);
  --surface-hover: #E9EDF4;

  --text-main: #1A202C;
  --text-secondary: #5A6472;
  --text-muted: #8A94A3;

  --border-subtle: #E3E8F0;
  --border-active: rgba(0, 0, 0, 0.20);
  --border-glass: rgba(0, 0, 0, 0.04);
  --field-bg: #F1F4F9;

  --accent-magenta: #E00070;
  --accent-magenta-hover: #C00060;
  --accent-magenta-glow: rgba(224, 0, 112, 0.18);
  --accent-magenta-subtle: rgba(224, 0, 112, 0.08);

  --accent-cyan: #0284C7;
  --accent-cyan-subtle: rgba(2, 132, 199, 0.08);

  --gold-podium: #D97706;
  --gold-glow: rgba(217, 119, 6, 0.15);
  --silver-podium: #64748B;
  --bronze-podium: #B45309;

  --badge-urgent: #DC2626;
  --badge-urgent-bg: rgba(220, 38, 38, 0.08);
  --badge-success: #059669;
  --badge-success-bg: rgba(5, 150, 105, 0.08);

  --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.04);
  --shadow-pop: 0 10px 28px rgba(0, 0, 0, 0.08);
}

/* ─── Base & Resets ─────────────────────────────────────────── */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

/* iOS WebKit paints its own chrome (grey pill buttons, white field backgrounds,
   square corners) on interactive elements unless appearance is explicitly
   killed. Every control below styles itself, so the UA look must never leak
   through — that is what produced the "native grey buttons in a dark app"
   reports on iPhone. */
button,
input,
select,
textarea {
  -webkit-appearance: none;
  appearance: none;
  border: none;
  outline: none;
  border-radius: 0;
  background: transparent;
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  line-height: inherit;
}

/* The magnifier/clear decorations iOS adds to search fields are part of its
   native widget, not of any icon we drew. */
input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
  opacity: 1; /* Firefox dims placeholders by default; iOS renders them near-white */
}

button {
  text-align: left;
}

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

body {
  font-family: 'Onest', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.45;
  padding-bottom: env(safe-area-inset-bottom, 24px);
  user-select: none;
  -webkit-user-select: none;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* iOS inflates body text in landscape/portrait unless told not to. */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

#app {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
  transition: max-width 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ─── Top Bar & Header ───────────────────────────────────────── */
.app-top-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg-topbar);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  /* Clears the Telegram header / Dynamic Island, and the path from the top edge
     down to the bar (which is what makes the bar look cut off on iPhone). */
  padding: calc(8px + max(env(safe-area-inset-top, 0px), var(--tg-inset-top, 0px))) 12px 6px;
  padding-left: calc(12px + max(env(safe-area-inset-left, 0px), var(--tg-inset-left, 0px)));
  padding-right: calc(12px + max(env(safe-area-inset-right, 0px), var(--tg-inset-right, 0px)));
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 8px;
  min-width: 0;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.user-profile:active {
  opacity: 0.8;
}

.avatar-wrap {
  position: relative;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-pill);
  background: var(--surface-elevated);
  border: 1px solid var(--border-active);
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: var(--accent-magenta);
}

.user-avatar img,
.podium-avatar img,
.lb-avatar img,
.tc-owner-avatar img,
.duo-avatar img,
.modal-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-pill);
}

.role-badge-icon {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 16px;
  height: 16px;
  border-radius: var(--radius-pill);
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}

.user-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.user-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-main);
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 130px;
}

.user-subline {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}

.user-role-pill {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  background: var(--accent-magenta-subtle);
  color: var(--accent-magenta);
  border: 1px solid rgba(240, 4, 127, 0.22);
}

.user-role-pill.marketer {
  background: var(--accent-cyan-subtle);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 240, 255, 0.22);
}

/* ─── Header Balance Capsule ─────────────────────────────────── */
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.balance-capsule {
  display: flex;
  align-items: center;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  padding: 3px 8px;
  height: 32px;
  box-shadow: var(--shadow-card);
}

.streak-chip {
  background: transparent;
  border: none;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  padding: 0 4px;
  font-size: 12px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-main);
  transition: transform 0.15s ease;
}

.streak-chip:active {
  transform: scale(0.92);
}

.fire-icon {
  font-size: 13px;
  line-height: 1;
}

.capsule-sep {
  width: 1px;
  height: 14px;
  background: var(--border-subtle);
  margin: 0 4px;
}

.points-chip {
  display: flex;
  align-items: center;
  gap: 3px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-magenta);
  padding: 0 4px;
}

.lightning-icon {
  font-size: 12px;
}

.icon-buttons-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-pill);
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

.icon-btn:hover {
  color: var(--text-main);
  background: var(--surface-elevated);
}

.icon-btn:active {
  transform: scale(0.93);
}

/* Fullscreen Toggle - strictly hidden on mobile viewports (< 768px) and mobile platforms */
.fullscreen-toggle {
  display: none !important;
}

body.is-mobile-platform .fullscreen-toggle {
  display: none !important;
}

@media (min-width: 768px) {
  body:not(.is-mobile-platform) .fullscreen-toggle {
    display: inline-flex !important;
  }
}

/* ─── Fluid Navigation Tabs ─────────────────────────────────── */
.nav-tabs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  padding: 3px;
  position: relative;
  margin-top: 4px;
}

.nav-tab-indicator {
  position: absolute;
  top: 3px;
  bottom: 3px;
  border-radius: var(--radius-pill);
  background: var(--surface-elevated);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
  z-index: 1;
}

.nav-tab {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 4px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  position: relative;
  z-index: 2;
  border-radius: var(--radius-pill);
  transition: color 0.18s ease;
}

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

.tab-svg {
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.75;
  transition: opacity 0.15s ease;
}

.tab-svg svg {
  width: 16px;
  height: 16px;
}

.nav-tab.active .tab-svg {
  opacity: 1;
  color: var(--accent-magenta);
}

.tab-label {
  font-size: 11px;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

/* ─── Main Content Layout ────────────────────────────────────── */
.content-body {
  padding: 12px;
  flex: 1;
}

@media (min-width: 768px) {
  .content-body {
    padding: 24px 20px;
  }
}

.tab-panel {
  display: none;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.22s ease, transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.tab-panel.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

/* ─── Sprint Goal Card ───────────────────────────────────────── */
.sprint-goal-card {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-card);
}

.sprint-goal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.sg-left {
  display: flex;
  align-items: center;
  gap: 7px;
}

.sg-pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: var(--radius-pill);
  background: var(--accent-magenta);
  box-shadow: 0 0 8px var(--accent-magenta);
  animation: pulse-dot 2s infinite ease-in-out;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

.sg-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.sg-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  background: var(--surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.sprint-bar-wrap {
  width: 100%;
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--surface-elevated);
  overflow: hidden;
  margin-bottom: 8px;
}

.sprint-bar-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--accent-magenta), #FF4D94);
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.sprint-goal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
}

.sg-stat {
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-main);
  font-weight: 600;
}

.sg-bonus {
  color: var(--accent-magenta);
  font-weight: 600;
}

.sg-sub-tag {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--surface-elevated);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
}

.pulse-metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}

.pulse-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 4px;
  background: var(--surface-elevated);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.pulse-chip .p-num {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 14px;
  color: var(--text-main);
}

.pulse-chip .p-lbl {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  margin-top: 2px;
}

/* ─── Filter Controls (Segmented Pills) ──────────────────────── */
/* Two segmented controls sharing one row. Below ~400px they no longer fit side
   by side at full padding, and the right-hand one used to run off the screen —
   wrapping keeps every segment reachable instead of hiding "Сезон" past the edge. */
.filter-controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
  min-width: 0;
}

.segmented-pill,
.period-pill {
  display: flex;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  padding: 2px;
  min-width: 0;
}

@media (max-width: 400px) {
  .seg-btn,
  .period-btn {
    padding: 5px 7px;
    font-size: 10.5px;
  }
}

/* Role tabs and period filters are one segmented control in two places. The
   appearance reset above only strips WebKit's default chrome; these rules are
   what make the active segment look pressed rather than merely bold. */
.seg-btn,
.period-btn {
  background: transparent;
  border: none;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 5px 11px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
  white-space: nowrap;
}

.seg-btn.active,
.period-btn.active {
  background: var(--surface-card);
  color: var(--text-main);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
}

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

/* ─── Podium Top 3 Stage ─────────────────────────────────────── */
/* DOM order is 2 — 1 — 3, so the winner lands in the middle under the crown.
   Every dimension is a clamp() off the viewport width: on a 350px phone the
   three columns shrink together instead of wrapping into a vertical list. */
.podium-stage {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(4px, 2.2vw, 10px);
  margin-bottom: 18px;
  padding: 16px 2px 0;
  --pav: clamp(38px, 12.5vw, 52px);
  --pav-gold: clamp(46px, 15.5vw, 62px);
  --ped-1: clamp(38px, 11vw, 54px);
  --ped-2: clamp(28px, 8vw, 40px);
  --ped-3: clamp(22px, 6.4vw, 32px);
}

.podium-slot {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.podium-slot:hover {
  transform: translateY(-2px);
}

.podium-slot:active {
  transform: scale(0.98);
}

.podium-avatar-shell {
  position: relative;
  margin-bottom: clamp(5px, 1.6vw, 8px);
}

.podium-avatar {
  width: var(--pav);
  height: var(--pav);
  border-radius: var(--radius-pill);
  background: var(--surface-elevated);
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: clamp(13px, 4vw, 16px);
  color: var(--text-main);
}

.podium-avatar img {
  width: 100%;
  height: 100%;
  border-radius: var(--radius-pill);
  object-fit: cover;
}

.podium-slot.gold .podium-avatar {
  width: var(--pav-gold);
  height: var(--pav-gold);
  border: 2px solid var(--gold-podium);
  box-shadow: 0 0 16px var(--gold-glow);
}

.podium-slot.silver .podium-avatar {
  border: 2px solid var(--silver-podium);
}

.podium-slot.bronze .podium-avatar {
  border: 2px solid var(--bronze-podium);
}

.podium-crown {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  font-size: clamp(12px, 3.6vw, 14px);
  line-height: 1;
}

.podium-medal-badge {
  position: absolute;
  bottom: -4px;
  right: -4px;
  width: clamp(16px, 5.2vw, 20px);
  height: clamp(16px, 5.2vw, 20px);
  border-radius: var(--radius-pill);
  background: var(--surface-elevated);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(9px, 2.8vw, 11px);
  line-height: 1;
}

.podium-name {
  width: 100%;
  padding: 0 2px;
  font-size: clamp(10px, 3.1vw, 12px);
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 1px;
}

.podium-score {
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(9.5px, 2.9vw, 11px);
  font-weight: 700;
  color: var(--accent-magenta);
  white-space: nowrap;
}

.podium-pedestal {
  width: 100%;
  margin-top: clamp(4px, 1.4vw, 6px);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-bottom: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 800;
  color: var(--text-muted);
  font-size: clamp(12px, 3.6vw, 14px);
}

.podium-slot.gold .podium-pedestal {
  height: var(--ped-1);
  background: linear-gradient(180deg, var(--gold-glow) 0%, var(--surface-card) 100%);
  border-color: rgba(255, 184, 0, 0.35);
  color: var(--gold-podium);
}

.podium-slot.silver .podium-pedestal {
  height: var(--ped-2);
  border-color: rgba(203, 213, 225, 0.25);
  color: var(--silver-podium);
}

.podium-slot.bronze .podium-pedestal {
  height: var(--ped-3);
  border-color: rgba(245, 158, 11, 0.25);
  color: var(--bronze-podium);
}

/* ─── Editorial Card & Leaderboard Table ─────────────────────── */
.editorial-card {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-card);
}

.card-header-clean {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.card-title-clean {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-main);
}

.card-desc-clean {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.card-meta-pill {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-elevated);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}

.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lb-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: var(--surface-subtle);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}

.lb-row:hover {
  background: var(--surface-elevated);
  border-color: var(--border-subtle);
}

.lb-row:active {
  transform: scale(0.99);
}

.lb-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lb-rank {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  width: 20px;
}

.lb-avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-pill);
  background: var(--surface-elevated);
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: var(--text-secondary);
}

.lb-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}

.lb-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.lb-score-pill {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-magenta);
  background: var(--accent-magenta-subtle);
  padding: 4px 9px;
  border-radius: var(--radius-pill);
}

.lb-division-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

/* ─── Sticky User Rank Tracker ────────────────────────────── */
/* Sits above the home indicator, not on it — Telegram's own bottom bar and the
   iPhone gesture area both eat into the last ~34px of the viewport. */
.user-floating-rank {
  position: sticky;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  z-index: 25;
  background: rgba(18, 21, 26, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-active);
  border-radius: var(--radius-pill);
  padding: 8px 14px 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  margin-top: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.05);
  animation: float-in 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] .user-floating-rank {
  background: rgba(255, 255, 255, 0.94);
  border-color: rgba(0, 0, 0, 0.12);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
}

@keyframes float-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

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

.ufr-avatar {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: var(--radius-pill);
  background: var(--surface-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  overflow: hidden;
  border: 1.5px solid var(--accent-magenta);
}

.ufr-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ufr-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.ufr-rank-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.ufr-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  background: var(--accent-magenta);
  color: #FFF;
}

.ufr-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ufr-sub {
  font-size: 11px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ufr-action-btn {
  background: var(--surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  border-radius: var(--radius-pill);
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ufr-action-btn:hover {
  border-color: var(--border-active);
  background: var(--surface-hover);
}

.ufr-action-btn:active {
  transform: scale(0.95);
}

/* ─── Task Radar Components ──────────────────────────────────── */
/* `minmax(min(150px, 100%), 1fr)` lets the two KPI tiles sit side by side down
   to a 320px screen and only then stack, instead of the label ("На согласовании")
   forcing the grid track wider than the viewport and pushing the tiles apart. */
.task-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.summary-tile {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  cursor: pointer;
  transition: all 0.16s ease;
  box-shadow: var(--shadow-card);
}

.tile-content {
  min-width: 0;
}

.summary-tile:hover {
  background: var(--surface-elevated);
  border-color: var(--border-active);
}

.summary-tile:active {
  transform: scale(0.97);
}

.tile-icon-bubble {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  justify-content: center;
}

.tile-icon-bubble.in-work {
  background: var(--accent-cyan-subtle);
  color: var(--accent-cyan);
}

.tile-icon-bubble.in-review {
  background: var(--accent-magenta-subtle);
  color: var(--accent-magenta);
}

.tile-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(16px, 5vw, 19px);
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.1;
}

.tile-label {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.task-search-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.search-input-shell {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.search-svg {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
}

.search-field {
  width: 100%;
  height: 36px;
  background: var(--field-bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  padding: 0 32px 0 34px;
  font-size: 12px;
  color: var(--text-main);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-field:focus {
  border-color: var(--accent-magenta);
  box-shadow: 0 0 0 3px var(--accent-magenta-subtle);
}

.search-clear {
  position: absolute;
  right: 10px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
}

.view-density-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-pill);
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease;
}

.view-density-btn:active {
  transform: scale(0.93);
}

.task-filter-chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 14px;
  scrollbar-width: none;
}

.task-filter-chips::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  flex-shrink: 0;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.filter-chip.active {
  background: var(--surface-elevated);
  color: var(--text-main);
  font-weight: 600;
  border-color: var(--border-active);
}

.filter-chip.fire.active {
  background: var(--badge-urgent-bg);
  color: var(--badge-urgent);
  border-color: var(--badge-urgent);
}

.filter-chip.review.active {
  background: var(--accent-magenta-subtle);
  color: var(--accent-magenta);
  border-color: var(--accent-magenta);
}

.filter-chip.my.active {
  background: linear-gradient(135deg, rgba(240, 4, 127, 0.25) 0%, rgba(0, 240, 255, 0.18) 100%);
  color: var(--text-main);
  border-color: var(--accent-magenta);
  box-shadow: 0 2px 10px var(--accent-magenta-glow);
}

/* ─── Task Card Styles ───────────────────────────────────────── */
.tasks-feed {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.task-card {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: all 0.16s ease;
}

.task-card:hover {
  border-color: var(--border-active);
  background: var(--surface-elevated);
}

/* A solid 3px bar of saturated red / magenta on every hot card turned the whole
   list into a wall of alarm, and it fired on ordinary "due tomorrow" cards too.
   The deadline pill already states the problem in words and colour, so the card
   itself only takes a hairline tint. */
.task-card.urgent {
  border-color: rgba(239, 68, 68, 0.30);
}

.task-card.awaiting {
  border-color: rgba(240, 4, 127, 0.24);
}

.tc-top {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.tc-category-pill {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  background: var(--surface-elevated);
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 1;
}

/* Channel badge — the routing code peeled off the card title. Four hashed tints
   so O!Bank and O!Market never read as the same thing; purely decorative. */
.tc-channel-pill {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  background: var(--accent-magenta-subtle);
  color: var(--accent-magenta);
  white-space: nowrap;
  flex-shrink: 0;
}

.tc-channel-pill.tone-b {
  background: var(--accent-cyan-subtle);
  color: var(--accent-cyan);
}

.tc-channel-pill.tone-c {
  background: var(--badge-success-bg);
  color: var(--badge-success);
}

.tc-channel-pill.tone-d {
  background: var(--surface-elevated);
  color: var(--text-secondary);
}

.tc-due-pill {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  margin-left: auto;
  white-space: nowrap;
  flex-shrink: 0;
}

.tc-due-pill.urgent {
  color: var(--badge-urgent);
}

.tc-due-pill.awaiting {
  color: var(--accent-magenta);
}

.tc-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.tc-desc-snippet {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.35;
  margin-top: 2px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.tc-meta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 2px;
}

.tc-checklist-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--surface-elevated);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.tc-checklist-pill.done {
  color: var(--badge-success);
  border-color: var(--badge-success);
  background: var(--badge-success-bg);
}

.tc-priority-pill {
  display: inline-flex;
  align-items: center;
  font-size: 9px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.tc-label-pill {
  display: inline-flex;
  align-items: center;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: var(--surface-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tc-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  min-width: 0;
}

/* Straight to the Trello card from the list — previously the only way in was
   to open the modal first, then tap through. */
.tc-trello-link {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--surface-elevated);
  transition: all 0.16s ease;
}

.tc-trello-link:hover,
.tc-trello-link:active {
  color: var(--accent-magenta);
  border-color: var(--accent-magenta);
}

.tc-owner {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex-shrink: 1;
}

.tc-owner-avatar {
  width: 20px;
  height: 20px;
  border-radius: var(--radius-pill);
  background: var(--surface-elevated);
  background-size: cover;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  color: var(--text-muted);
  overflow: hidden;
}

.tc-owner-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tc-owner-name {
  font-size: 11px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tc-column {
  font-size: 10px;
  color: var(--text-muted);
  background: var(--surface-subtle);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  white-space: nowrap;
}

/* Direct Trello Button */
.trello-direct-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 42px;
  border-radius: var(--radius-pill);
  background: #0079BF;
  color: #FFFFFF;
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  transition: all 0.15s ease;
  box-shadow: 0 4px 14px rgba(0, 121, 191, 0.35);
}

.trello-direct-btn:hover {
  background: #026AA7;
}

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

/* ─── Trophies Showcase ──────────────────────────────────────── */
.hero-showcase-card {
  background: linear-gradient(135deg, var(--surface-card) 0%, var(--surface-elevated) 100%);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 16px;
  text-align: center;
}

.showcase-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gold-podium);
  margin-bottom: 4px;
}

.showcase-title {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text-main);
  margin-bottom: 4px;
}

.showcase-desc {
  font-size: 12px;
  color: var(--text-muted);
}

.trophy-filter-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin-bottom: 14px;
  scrollbar-width: none;
}

.trophy-pill {
  flex-shrink: 0;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.trophy-pill.active {
  background: var(--surface-elevated);
  color: var(--text-main);
  font-weight: 600;
  border-color: var(--border-active);
}

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

@media (min-width: 768px) {
  .trophies-grid {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

.trophy-card {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  transition: all 0.16s ease;
  box-shadow: var(--shadow-card);
}

.trophy-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-active);
}

.trophy-icon {
  font-size: 26px;
  margin-bottom: 6px;
}

.trophy-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 3px;
}

.trophy-rule {
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.3;
}

.trophy-card.unlocked {
  border-color: rgba(255, 184, 0, 0.35);
  background: linear-gradient(180deg, rgba(255, 184, 0, 0.05) 0%, var(--surface-card) 100%);
}

.trophy-card.locked {
  opacity: 0.85;
}

.trophy-progress-wrap {
  width: 100%;
  height: 4px;
  background: var(--surface-elevated);
  border-radius: var(--radius-pill);
  margin-top: 8px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

.trophy-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-podium), #FFE600);
  border-radius: var(--radius-pill);
  transition: width 0.3s ease;
}

.trophy-progress-lbl {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  font-weight: 700;
  color: var(--gold-podium);
  margin-top: 4px;
}

/* One-shot trophies have no measurable progress — showing "0/1" for "be the
   first to close a card this week" would be a number that means nothing. */
.trophy-progress-lbl.muted {
  color: var(--text-muted);
  font-weight: 600;
}

.trophy-unlocked-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 9px;
  font-weight: 800;
  color: var(--gold-podium);
  background: rgba(255, 184, 0, 0.12);
  border: 1px solid rgba(255, 184, 0, 0.28);
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  margin-top: 6px;
}

/* ─── Hero Tandem Card ───────────────────────────────────────── */
.hero-tandem-card {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px 16px;
  box-shadow: var(--shadow-card);
}

/* ─── Other Collaborative Duos List ─────────────────────────── */
.tandems-rank-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 0;
}

.tandem-rank-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: all 0.15s ease;
}

.tandem-rank-row:hover {
  border-color: var(--border-active);
}

.tandem-rank-duo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tandem-duo-avatars {
  display: flex;
  align-items: center;
  position: relative;
}

.tandem-mini-avatar {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-pill);
  background: var(--surface-card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  border: 1.5px solid var(--surface-elevated);
  overflow: hidden;
  color: var(--text-secondary);
}

.tandem-mini-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tandem-mini-avatar.sec {
  margin-left: -8px;
  border-color: var(--surface-elevated);
}

.tandem-pair-names {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
}

.tandem-pair-sub {
  font-size: 10px;
  color: var(--text-muted);
}

.tandem-score-pill {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-magenta);
  background: var(--accent-magenta-subtle);
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

.tandem-flame-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent-magenta);
  background: var(--accent-magenta-subtle);
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  margin-bottom: 14px;
}

.flame-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--accent-magenta);
}

.tandem-duo {
  display: flex;
  align-items: center;
  justify-content: space-around;
  margin-bottom: 16px;
}

.duo-member {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.duo-avatar {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-pill);
  background: var(--surface-elevated);
  background-size: cover;
  background-position: center;
  border: 2px solid var(--border-active);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 6px;
}

.duo-avatar.marketer {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.duo-avatar.designer {
  border-color: var(--accent-magenta);
  color: var(--accent-magenta);
}

.duo-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
}

.duo-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.duo-connector {
  color: var(--accent-magenta);
  opacity: 0.7;
}

.tandem-metrics {
  display: flex;
  align-items: center;
  justify-content: space-around;
  background: var(--surface-elevated);
  border-radius: var(--radius-md);
  padding: 10px 8px;
}

.t-stat {
  text-align: center;
}

.t-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 15px;
  font-weight: 800;
  color: var(--text-main);
}

.t-stat.bonus .t-val {
  color: var(--accent-magenta);
}

.t-lbl {
  font-size: 10px;
  color: var(--text-muted);
}

.t-sep {
  width: 1px;
  height: 20px;
  background: var(--border-subtle);
}

.marketing-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mkt-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--surface-subtle);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}

.mkt-row:hover {
  background: var(--surface-elevated);
  border-color: var(--border-subtle);
}

.mkt-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}

.mkt-stats {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.mkt-score-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  color: var(--gold-podium);
  background: rgba(255, 184, 0, 0.08);
  padding: 4px 8px;
  border-radius: var(--radius-pill);
}

/* ─── Pre-flight Brief Simulator ─────────────────────────────── */
/* `--field-bg`, not `--surface-elevated`: on iOS a text field that matches the
   card behind it reads as a white rectangle pasted over the dark theme, because
   WebKit still paints its own background before ours. An explicit faint wash
   plus the appearance reset above is what makes the field look like a field. */
.clean-input,
.clean-textarea {
  width: 100%;
  background: var(--field-bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 9px 12px;
  font-size: 12px;
  color: var(--text-main);
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.clean-textarea {
  min-height: 70px;
  resize: vertical;
  margin-top: 8px;
}

.clean-input:focus,
.clean-textarea:focus {
  border-color: var(--accent-magenta);
  box-shadow: 0 0 0 3px var(--accent-magenta-subtle);
}

.pf-control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
}

.clean-checkbox {
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-secondary);
}

/* Visually hidden but still a real, focusable, screen-readable checkbox —
   `display: none` took it out of the tab order and off the accessibility tree
   entirely, so the only way to reach the toggle was to hit the 16px box. */
.clean-checkbox input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.clean-checkbox:focus-within .checkbox-box {
  outline: 2px solid var(--accent-magenta);
  outline-offset: 2px;
}

.checkbox-box {
  width: 16px;
  height: 16px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-active);
  display: inline-block;
  position: relative;
}

.clean-checkbox input:checked + .checkbox-box {
  background: var(--accent-magenta);
  border-color: var(--accent-magenta);
}

.clean-checkbox input:checked + .checkbox-box::after {
  content: '✓';
  position: absolute;
  top: -2px;
  left: 3px;
  color: #FFF;
  font-size: 11px;
  font-weight: 700;
}

.pf-score-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  background: var(--surface-elevated);
  color: var(--text-main);
}

.pf-chips-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 10px;
}

.pf-chip {
  font-size: 10px;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  background: var(--surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
}

.pf-chip.passed {
  border-color: var(--badge-success);
  color: var(--badge-success);
  background: var(--badge-success-bg);
}

.pf-chip.warn {
  border-color: var(--badge-urgent);
  color: var(--badge-urgent);
  background: var(--badge-urgent-bg);
}

.pf-score-chip.perfect {
  color: var(--badge-success);
  background: var(--badge-success-bg);
}

.pf-score-chip.good {
  color: var(--accent-magenta);
  background: var(--accent-magenta-subtle);
}

.pf-score-chip.poor {
  color: var(--badge-urgent);
  background: var(--badge-urgent-bg);
}

/* ─── Boss Reports Section ───────────────────────────────────── */
.boss-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.boss-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
}

.boss-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.icon-refresh-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-pill);
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.icon-refresh-btn:active {
  transform: rotate(90deg);
}

.report-segment-row {
  display: flex;
  gap: 4px;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  padding: 3px;
}

.rep-tab {
  flex: 1;
  background: transparent;
  border: none;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 6px 4px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.15s ease;
}

.rep-tab.active {
  background: var(--surface-elevated);
  color: var(--text-main);
  font-weight: 700;
}

.report-chip-tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent-magenta);
}

.report-heading {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 2px;
}

.report-pre {
  background: var(--surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 320px;
  overflow-y: auto;
  margin: 12px 0;
}

.primary-btn {
  width: 100%;
  height: 42px;
  border-radius: var(--radius-pill);
  background: var(--accent-magenta);
  color: #FFF;
  border: none;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 4px 14px var(--accent-magenta-glow);
}

.primary-btn:hover {
  background: var(--accent-magenta-hover);
}

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

.secondary-btn {
  height: 42px;
  border-radius: var(--radius-pill);
  background: var(--surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  padding: 0 16px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.secondary-btn:hover {
  color: var(--text-main);
}

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

/* ─── Modal Sheet ────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: flex-end;
  justify-content: center;
  transition: opacity 0.2s ease;
}

.modal-backdrop.open {
  display: flex;
}

.modal-sheet {
  width: 100%;
  max-width: 520px;
  background: var(--surface-card);
  border: 1px solid var(--border-active);
  border-bottom: none;
  border-radius: 20px 20px 0 0;
  padding: 16px 20px 24px;
  box-shadow: var(--shadow-pop);
  animation: slide-up 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slide-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.sheet-handle {
  width: 36px;
  height: 4px;
  border-radius: var(--radius-pill);
  background: var(--border-active);
  margin: 0 auto 14px;
}

.modal-header-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.modal-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-pill);
  background: var(--surface-elevated);
  background-size: cover;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--text-main);
}

.modal-profile-meta {
  flex: 1;
}

.modal-user-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
}

.modal-user-role {
  font-size: 12px;
  color: var(--accent-magenta);
}

.modal-close {
  background: var(--surface-elevated);
  border: none;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-pill);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.modal-stats-matrix {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.modal-stat-box {
  background: var(--surface-elevated);
  border-radius: var(--radius-md);
  padding: 10px;
  text-align: center;
}

.modal-stat-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
}

.modal-stat-lbl {
  font-size: 10px;
  color: var(--text-muted);
}

.modal-subheading {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.modal-trophies-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.modal-badges-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 180px;
  overflow-y: auto;
}

.modal-section-group {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.modal-mini-tasks-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 160px;
  overflow-y: auto;
}

.modal-mini-task-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: var(--surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 12px;
}

.modal-mini-task-name {
  font-weight: 500;
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 260px;
}

.modal-mini-task-tag {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  background: var(--surface-card);
  color: var(--text-secondary);
  flex-shrink: 0;
}

.modal-breakdown-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 160px;
  overflow-y: auto;
}

.modal-breakdown-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  background: var(--surface-elevated);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  font-size: 12px;
}

.modal-breakdown-left {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  min-width: 0;
  flex: 1;
}

.modal-breakdown-left span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The arithmetic itself, printed next to every row: without it the block is
   just a list of numbers the reader has to take on faith. */
.modal-breakdown-calc {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
  white-space: nowrap;
}

.modal-breakdown-pts {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 12px;
  color: var(--accent-magenta);
  flex-shrink: 0;
  min-width: 34px;
  text-align: right;
}

.modal-breakdown-pts.negative {
  color: var(--badge-urgent);
}

.modal-breakdown-row.total {
  background: transparent;
  border-style: dashed;
  margin-top: 2px;
}

.modal-breakdown-row.total .modal-breakdown-left {
  color: var(--text-main);
  font-weight: 600;
}

.modal-badge-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.modal-badge-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
}

.modal-badge-icon.gold {
  background: rgba(255, 184, 0, 0.12);
  color: var(--gold-podium);
}

.modal-badge-icon.silver {
  background: rgba(203, 213, 225, 0.12);
  color: var(--silver-podium);
}

.modal-badge-icon.bronze {
  background: rgba(245, 158, 11, 0.12);
  color: var(--bronze-podium);
}

.modal-badge-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
}

.modal-badge-desc {
  font-size: 11px;
  color: var(--text-muted);
}

.arena-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(30px);
  background: var(--surface-card);
  border: 1px solid var(--border-active);
  color: var(--text-main);
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  box-shadow: var(--shadow-pop);
  z-index: 10000;
  pointer-events: none;
  opacity: 0;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
}

.arena-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ─── Feedback & Gate Screen ─────────────────────────────────── */
.feedback-type-chips {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

.fb-chip {
  flex: 1;
  padding: 7px 4px;
  border-radius: var(--radius-pill);
  background: var(--surface-elevated);
  border: 1px solid var(--border-subtle);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.fb-chip.active {
  background: var(--surface-hover);
  color: var(--text-main);
  border-color: var(--border-active);
}

.fb-actions {
  display: flex;
  gap: 8px;
}

.gate-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--bg-app);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.gate-card {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 28px 24px;
  max-width: 360px;
  text-align: center;
  box-shadow: var(--shadow-pop);
}

.gate-icon-wrap {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-pill);
  background: var(--accent-magenta-subtle);
  color: var(--accent-magenta);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.gate-title {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text-main);
  margin-bottom: 8px;
}

.gate-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 20px;
}

.gate-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 44px;
  border-radius: var(--radius-pill);
  background: var(--accent-magenta);
  color: #FFF;
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 4px 14px var(--accent-magenta-glow);
  transition: all 0.15s ease;
}

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

.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }

/* ─── Desktop & Wide Screen Layouts (Half-Screen & Full Monitor) ─── */
@media (min-width: 768px) {
  #app {
    max-width: 100%;
    padding: 0 16px;
  }
  .user-name {
    max-width: 280px;
    font-size: 15px;
  }
  .app-header {
    padding-bottom: 12px;
  }
  .nav-tabs {
    max-width: 580px;
    margin: 6px auto 0;
  }
  .content-body {
    padding: 16px 8px;
  }
  .task-summary-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
  }
  .tasks-feed {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 12px;
  }
  .task-filter-chips {
    flex-wrap: wrap;
    overflow-x: visible;
    gap: 8px;
    margin-bottom: 16px;
  }
  .filter-chip {
    padding: 6px 14px;
    font-size: 11.5px;
  }
  .trophies-grid {
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 14px;
  }
  .podium-stage {
    max-width: 440px;
    margin-left: auto;
    margin-right: auto;
  }
}

@media (min-width: 960px) {
  #app {
    max-width: 1160px;
    padding: 0 24px;
  }
  .content-body {
    padding: 20px 0;
  }

  /* Two-column executive dashboard for Leaderboard */
  #panel-leaderboard.active {
    display: grid;
    grid-template-columns: 390px 1fr;
    gap: 20px;
    align-items: start;
  }
  #panel-leaderboard.active .sprint-goal-card {
    grid-column: 1;
    grid-row: 1;
    margin-bottom: 0;
  }
  #panel-leaderboard.active .filter-controls-row {
    grid-column: 1;
    grid-row: 2;
    margin-bottom: 0;
  }
  #panel-leaderboard.active #podiumWrap {
    grid-column: 1;
    grid-row: 3;
    margin-bottom: 0;
  }
  #panel-leaderboard.active .editorial-card {
    grid-column: 2;
    grid-row: 1 / span 3;
    margin-bottom: 0;
  }
  #panel-leaderboard.active .user-floating-rank {
    grid-column: 2;
    grid-row: 4;
    max-width: 480px;
    margin: 14px auto 0;
    width: 100%;
  }

  /* Two-column dashboard for Tandem */
  #panel-tandem.active {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
  }
  #panel-tandem.active .mt-16 {
    margin-top: 0;
  }

  /* Tasks radar feed and cards */
  .tasks-feed {
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 14px;
  }
  .task-summary-grid {
    grid-template-columns: 260px 260px;
    gap: 16px;
  }
  .task-card {
    padding: 12px 14px;
    gap: 8px;
  }
  .tc-title {
    font-size: 13.5px;
    line-height: 1.35;
  }
  .tc-channel-pill,
  .tc-category-pill {
    font-size: 11px;
    padding: 3px 8px;
  }
  .tc-due-pill {
    font-size: 11px;
  }
  .tc-trello-link {
    font-size: 11px;
    padding: 3px 9px;
  }

  /* Reports readable preformatted block */
  .report-pre {
    max-height: 520px;
    font-size: 12.5px;
  }

  /* Trophies grid */
  .trophies-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
  }
}

@media (min-width: 1280px) {
  #app {
    max-width: 1320px;
    padding: 0 32px;
  }
  #panel-leaderboard {
    grid-template-columns: 420px 1fr;
    gap: 24px;
  }
  .tasks-feed {
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 16px;
  }
  .trophies-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 18px;
  }
}


/* ─── Special Highlights & Easter Eggs (Farewell / Maternity / Birthdays) ─── */
.special-highlights-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

@media (min-width: 900px) {
  #panel-leaderboard.active .special-highlights-wrap {
    grid-column: 1 / -1;
    margin-bottom: 0;
  }
}

.special-highlight-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease;
  box-shadow: var(--shadow-card);
}

.special-highlight-card:active {
  transform: scale(0.985);
}

.special-highlight-card.farewell {
  background: linear-gradient(135deg, rgba(240, 4, 127, 0.10), rgba(255, 184, 0, 0.08));
  border-color: rgba(240, 4, 127, 0.35);
}

.special-highlight-card.maternity {
  background: linear-gradient(135deg, rgba(255, 184, 0, 0.10), rgba(16, 185, 129, 0.08));
  border-color: rgba(255, 184, 0, 0.35);
}

.special-highlight-card.birthday {
  background: linear-gradient(135deg, rgba(240, 4, 127, 0.12), rgba(139, 92, 246, 0.10));
  border-color: rgba(240, 4, 127, 0.4);
}

.sh-icon {
  font-size: 24px;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 2px;
}

.sh-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.sh-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.sh-title {
  font-family: 'Onest', sans-serif;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-main);
}

.sh-pill {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--surface-elevated);
  color: var(--accent-magenta);
  border: 1px solid rgba(240, 4, 127, 0.28);
  white-space: nowrap;
}

.sh-text {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.45;
}

.sh-action-btn {
  align-self: flex-start;
  margin-top: 4px;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(240, 4, 127, 0.35);
  background: var(--surface-elevated);
  color: var(--text-main);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.sh-action-btn:hover {
  border-color: var(--accent-magenta);
  color: var(--accent-magenta);
}

.sh-action-btn:disabled {
  opacity: 0.75;
  cursor: default;
}

.lb-score-pill.easter-pill {
  background: rgba(255, 184, 0, 0.14);
  color: var(--text-main);
  border: 1px solid rgba(255, 184, 0, 0.35);
  font-size: 11px;
}

.modal-easter-egg-wrap {
  margin: 10px 0 6px;
}

.modal-easter-card {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(240, 4, 127, 0.10), rgba(255, 184, 0, 0.08));
  border: 1px solid rgba(240, 4, 127, 0.32);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.modal-easter-card.maternity {
  background: linear-gradient(135deg, rgba(255, 184, 0, 0.12), rgba(16, 185, 129, 0.08));
  border-color: rgba(255, 184, 0, 0.38);
}

.mec-header {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.mec-emoji {
  font-size: 16px;
}

.mec-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
}

.mec-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  background: var(--surface-elevated);
  color: var(--accent-magenta);
}

.mec-text {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.45;
}

.mec-btn {
  align-self: flex-start;
  margin-top: 2px;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(240, 4, 127, 0.35);
  background: var(--surface-card);
  color: var(--text-main);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
