*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #111113;
  --surface:   #1c1c1f;
  --surface-2: #26262a;
  --border:    #333337;
  --text:      #ebebeb;
  --muted:     #888891;
  --accent:    #e63946;
  --accent-d:  #c1121f;
  --green:     #27ae60;
  --r:         8px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}

/* ── Layout ── */
.container { max-width: 640px; margin: 0 auto; padding: 0 16px; }

/* ── Header ── */
.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
  position: sticky; top: 0; z-index: 10;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.header-user  { font-size: 14px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.header-user strong { color: var(--text); }

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 20px;
  margin-bottom: 16px;
}
.card-title {
  font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 16px;
}

/* ── Forms ── */
.form-group  { margin-bottom: 14px; }
.form-label  { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.form-input  {
  width: 100%; padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: var(--text); font-size: 15px;
  transition: border-color 0.15s;
}
.form-input:focus { outline: none; border-color: var(--accent); }
.form-input::placeholder { color: var(--muted); }
select.form-input { cursor: pointer; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; border-radius: var(--r);
  font-size: 15px; font-weight: 500;
  border: none; cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  text-decoration: none;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }
.btn-primary   { background: var(--accent); color: #fff; width: 100%; padding: 12px; }
.btn-primary:hover { background: var(--accent-d); }
.btn-secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-danger    { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.btn-danger:hover { background: rgba(230,57,70,0.1); }
.btn-sm        { padding: 6px 12px; font-size: 13px; width: auto; }

/* ── Tabs ── */
.tabs  { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab   {
  padding: 10px 16px; color: var(--muted);
  font-size: 14px; font-weight: 500; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
  user-select: none;
}
.tab.active         { color: var(--accent); border-bottom-color: var(--accent); }
.tab-panel          { display: none; }
.tab-panel.active   { display: block; }

/* ── Activity type selector ── */
.type-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.type-card {
  padding: 14px 8px; text-align: center; cursor: pointer;
  background: var(--surface-2);
  border: 2px solid var(--border);
  border-radius: var(--r);
  transition: border-color 0.15s, background 0.15s;
  user-select: none;
}
.type-card:hover   { border-color: var(--muted); }
.type-card.selected{ border-color: var(--accent); background: rgba(230,57,70,0.08); }
.type-card input   { display: none; }
.type-icon         { font-size: 28px; display: block; margin-bottom: 4px; }
.type-label        { font-size: 12px; font-weight: 600; display: block; }
.type-unit         { font-size: 11px; color: var(--muted); display: block; }

/* ── Value input row ── */
.input-row                { display: flex; gap: 10px; align-items: flex-end; }
.input-row .form-group    { flex: 1; margin-bottom: 0; }
.input-unit {
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: var(--muted); font-size: 14px;
  white-space: nowrap; flex-shrink: 0;
}

/* ── Today list ── */
.activity-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: none; }
.activity-left  { display: flex; align-items: center; gap: 10px; }
.activity-icon  { font-size: 20px; flex-shrink: 0; }
.activity-value { font-size: 14px; }
.activity-value span { color: var(--muted); font-size: 12px; }
.activity-points { font-weight: 600; color: var(--accent); font-size: 14px; white-space: nowrap; }

/* ── Leaderboard ── */
.leaderboard-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.leaderboard-row:last-child { border-bottom: none; }
.rank {
  width: 28px; height: 28px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; font-size: 12px; font-weight: 700;
  background: var(--surface-2); color: var(--muted);
}
.rank-1 { background: #f59e0b; color: #000; }
.rank-2 { background: #9ca3af; color: #000; }
.rank-3 { background: #cd7c2f; color: #fff; }
.rank-name     { flex: 1; font-size: 14px; min-width: 0; }
.rank-team     { font-size: 12px; color: var(--muted); display: block; }
.rank-points   { font-weight: 700; color: var(--accent); font-size: 15px; white-space: nowrap; }

/* ── Stats bar ── */
.stats-bar { display: flex; gap: 12px; margin-bottom: 16px; }
.stat-card  {
  flex: 1; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r);
  padding: 14px; text-align: center;
}
.stat-value { font-size: 22px; font-weight: 700; color: var(--accent); }
.stat-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 2px; }

/* ── Toast ── */
.toast-container { position: fixed; bottom: 24px; right: 16px; z-index: 999; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  padding: 12px 18px; border-radius: var(--r);
  font-size: 14px; max-width: 300px;
  animation: slideIn 0.2s ease;
}
.toast-success { background: var(--green); color: #fff; }
.toast-error   { background: var(--accent); color: #fff; }
@keyframes slideIn { from { transform: translateX(110%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── Remember me ── */
.remember-label {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; margin-bottom: 14px; margin-top: 2px;
  font-size: 14px; color: var(--muted); user-select: none;
}
.remember-label input { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; }

/* ── Login page ── */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 400px; }
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo h1 { font-size: 26px; font-weight: 800; letter-spacing: -0.5px; }
.login-logo h1 span { color: var(--accent); }
.login-logo p { color: var(--muted); font-size: 14px; margin-top: 4px; }

/* ── Admin table ── */
.admin-table   { width: 100%; border-collapse: collapse; }
.admin-table th {
  text-align: left; font-size: 11px; font-weight: 600;
  color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em;
  padding: 0 0 10px; border-bottom: 1px solid var(--border);
}
.admin-table td {
  padding: 10px 0; border-bottom: 1px solid var(--border);
  font-size: 14px; vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table td:last-child { text-align: right; }
.admin-table td + td { padding-left: 12px; }

/* ── Settings grid ── */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ── Utilities ── */
.text-muted  { color: var(--muted); font-size: 13px; }
.text-accent { color: var(--accent); }
.empty-state { text-align: center; padding: 32px 16px; color: var(--muted); font-size: 14px; }
.btn-row     { display: flex; gap: 6px; justify-content: flex-end; }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex; align-items: center; justify-content: center;
  z-index: 50; padding: 16px;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 24px;
  width: 100%; max-width: 400px;
  max-height: 90vh; overflow-y: auto;
}
.modal-title         { font-weight: 600; font-size: 16px; margin-bottom: 20px; }
.modal-section-title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 8px; }
.modal-actions       { display: flex; gap: 10px; margin-top: 20px; }
.modal-actions .btn  { flex: 1; }

/* ── Stats summary rows ── */
.summary-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 14px; border-bottom: 1px solid var(--border); }
.summary-row:last-child { border-bottom: none; }
.summary-row span:first-child { flex: 1; }
.summary-row span:nth-child(2){ color: var(--muted); min-width: 64px; text-align: right; }
.summary-row span:last-child  { min-width: 72px; text-align: right; font-weight: 600; color: var(--accent); }

/* ── Activity date groups ── */
.date-group  { margin-bottom: 8px; }
.date-label  { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; padding: 10px 0 4px; }

/* ── Segmented control (leaderboard date toggle) ── */
.segmented       { display: flex; background: var(--surface-2); border-radius: var(--r); padding: 3px; gap: 2px; margin-bottom: 14px; }
.seg-btn         { flex: 1; padding: 7px; border-radius: 6px; text-align: center; font-size: 13px; font-weight: 500; cursor: pointer; color: var(--muted); user-select: none; transition: background 0.15s, color 0.15s; }
.seg-btn.active  { background: var(--surface); color: var(--text); }

/* ── Danger zone ── */
.danger-zone       { border: 1px solid rgba(230,57,70,0.4); border-radius: var(--r); padding: 16px; margin-top: 24px; }
.danger-zone-title { color: var(--accent); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 12px; }

/* ── Badge on tab ── */
.tab-badge { display: inline-flex; align-items: center; justify-content: center; background: var(--accent); color: #fff; border-radius: 10px; font-size: 10px; font-weight: 700; padding: 1px 5px; margin-left: 5px; vertical-align: middle; }

/* ── Team card ── */
.team-display    { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.team-name-badge { font-size: 15px; font-weight: 600; color: var(--text); }

/* ── Team dashboard ── */
.team-dashboard-card  { border-color: rgba(230,57,70,0.35); }
.team-dash-name       { font-size: 17px; font-weight: 700; color: var(--text); }
.team-modal-stats     { display: flex; gap: 20px; padding: 12px; background: var(--surface-2); border-radius: var(--r); margin-bottom: 4px; text-align: center; }
.team-modal-stats > div { flex: 1; }

/* ── Sponsor rows in modal ── */
.sponsor-row         { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.sponsor-row:last-of-type { border-bottom: none; }
.sponsor-info        { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.sponsor-details     { font-size: 12px; color: var(--muted); }

/* ── Clickable leaderboard rows ── */
.lb-row-click        { cursor: pointer; transition: background 0.12s; }
.lb-row-click:hover  { background: var(--surface-2); border-radius: 6px; }

/* ── Stats summary total row ── */
.summary-total { font-weight: 600; border-top: 1px solid var(--border); margin-top: 4px; padding-top: 6px !important; }

/* ── Stats bar clickable ── */
.stats-bar { cursor: pointer; }
.stat-card:hover { border-color: var(--accent); }

/* ── Event banner ── */
.event-banner {
  border-color: rgba(230,57,70,0.45);
  background: rgba(230,57,70,0.07);
  text-align: center;
  padding: 12px 16px;
  font-size: 14px;
  color: var(--text);
}

/* ── Week plan table ── */
.week-table              { width: 100%; border-collapse: collapse; }
.week-table th           { font-size: 11px; font-weight: 600; color: var(--muted); text-align: center; padding: 0 4px 10px; border-bottom: 1px solid var(--border); text-transform: uppercase; letter-spacing: 0.04em; }
.week-table td           { padding: 5px 4px; vertical-align: middle; text-align: center; }
.week-table tbody tr     { border-bottom: 1px solid var(--border); }
.week-table tbody tr:last-child { border-bottom: none; }
.week-today              { background: rgba(230,57,70,0.05); }
.week-day                { text-align: left; white-space: nowrap; padding-right: 8px; }
.week-day-name           { font-size: 13px; font-weight: 600; display: block; }
.week-day-date           { font-size: 11px; color: var(--muted); display: block; }
.week-inp                { padding: 6px 2px; font-size: 13px; text-align: center; width: 54px; -moz-appearance: textfield; }
.week-inp::-webkit-inner-spin-button,
.week-inp::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.week-pts                { font-size: 13px; font-weight: 700; color: var(--accent); white-space: nowrap; min-width: 44px; }
.week-total-label        { text-align: right; font-size: 12px; font-weight: 600; color: var(--muted); padding-top: 10px; }
.week-total-pts          { font-size: 16px; padding-top: 10px; }

@media (max-width: 480px) {
  .stats-bar     { gap: 8px; }
  .settings-grid { grid-template-columns: 1fr; }
  .type-label    { display: none; }
}

/* ── Page switching (bottom nav) ── */
.page        { display: none; }
.page.active { display: block; }

/* ── Bottom navigation ── */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: 60px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 20;
}
.nav-btn {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 2px;
  background: none; border: none;
  cursor: pointer;
  color: var(--muted);
  transition: color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.nav-btn.active { color: var(--accent); }
.nav-icon       { font-size: 22px; line-height: 1; }
.nav-label      { font-size: 10px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; }

/* ── Remove number input spinners ── */
.no-spin::-webkit-inner-spin-button,
.no-spin::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.no-spin { -moz-appearance: textfield; }

/* ── Feed ── */
.post-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  margin-bottom: 16px;
  overflow: hidden;
}
.post-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 14px 16px 10px;
}
.post-header-left   { display: flex; align-items: center; gap: 10px; }
.post-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; flex-shrink: 0;
}
.post-meta          { display: flex; flex-direction: column; }
.post-author        { font-weight: 600; font-size: 14px; }
.post-time          { font-size: 11px; color: var(--muted); }
.post-body          { padding: 0 16px 12px; font-size: 14px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.post-img           { width: 100%; display: block; max-height: 420px; object-fit: cover; }
.post-actions {
  display: flex; gap: 6px;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
}
.post-action-btn {
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 13px;
  display: flex; align-items: center; gap: 5px;
  padding: 5px 8px; border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}
.post-action-btn:hover { color: var(--text); background: var(--surface-2); }
.post-action-btn.liked { color: var(--accent); }
.comments-section   { border-top: 1px solid var(--border); padding: 10px 16px; }
.comment-row {
  display: flex; gap: 8px; align-items: flex-start;
  padding: 6px 0; border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.comment-row:last-of-type { border-bottom: none; }
.comment-author     { font-weight: 600; flex-shrink: 0; }
.comment-body       { flex: 1; line-height: 1.4; color: var(--text); }
.comment-del        { background: none; border: none; cursor: pointer; color: var(--muted); font-size: 15px; flex-shrink: 0; padding: 0 4px; }
.comment-del:hover  { color: var(--accent); }
.comment-input-row  { display: flex; gap: 8px; margin-top: 10px; }
.comment-input-row .form-input { flex: 1; padding: 7px 10px; font-size: 13px; }

/* ── Menu page ── */
.avatar-circle {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 700; flex-shrink: 0;
}
.menu-item-btn {
  display: flex; align-items: center; gap: 14px;
  width: 100%; padding: 16px 0;
  background: none; border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text); font-size: 15px;
  cursor: pointer; text-decoration: none;
  transition: color 0.15s;
}
.menu-item-btn:last-child { border-bottom: none; }
.menu-item-btn:hover      { color: var(--accent); }
.menu-danger              { color: var(--accent); }

/* ── Plan week navigation ── */
.plan-nav        { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.plan-nav-label  { font-size: 13px; font-weight: 600; color: var(--text); }
.plan-nav-btn    { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); color: var(--text); cursor: pointer; padding: 6px 16px; font-size: 18px; line-height: 1; }
.plan-nav-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* ── Bonus day badge ── */
.bonus-badge     { display: block; font-size: 10px; font-weight: 700; color: var(--accent); white-space: nowrap; cursor: pointer; }

/* ── Collapsible plan toggle ── */
.plan-toggle {
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; user-select: none;
}
.plan-toggle:hover { opacity: 0.8; }
#plan-chevron { color: var(--muted); font-size: 14px; }

/* ── Achievements ── */
.achievements-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.achievement-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 12px 6px;
  text-align: center;
  transition: border-color 0.15s;
}
.achievement-card.unlocked {
  border-color: #f59e0b;
  background: rgba(245,158,11,0.07);
}
.achievement-card.locked { opacity: 0.4; }
.achievement-icon { font-size: 22px; display: block; margin-bottom: 4px; }
.achievement-name { font-size: 11px; font-weight: 600; display: block; line-height: 1.3; }
.achievement-desc { font-size: 10px; color: var(--muted); display: block; margin-top: 3px; line-height: 1.3; }

/* ── Sport offers ── */
.offer-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px;
  margin-bottom: 12px;
}
.offer-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.offer-sportart-badge {
  display: inline-block;
  background: rgba(230,57,70,0.12);
  color: var(--accent);
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.offer-details {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 13px; color: var(--text); margin-bottom: 8px;
}
.offer-desc {
  font-size: 13px; color: var(--muted);
  line-height: 1.5; margin-bottom: 8px;
  white-space: pre-wrap; word-break: break-word;
}
.offer-author {
  font-size: 11px; color: var(--muted);
  display: block; text-align: right;
}

/* ── Post image ── */
.post-image, .post-img {
  width: 100%; display: block; max-height: 420px; object-fit: cover;
}
.post-content {
  padding: 0 16px 12px; font-size: 14px;
  line-height: 1.5; white-space: pre-wrap; word-break: break-word;
}
