/*
  Олимп — UI/UX по принципам Apple HIG / Material / Fluent:
  ясность, единая иерархия, 44px touch targets, 8px spacing, мягкие переходы.
  Тёмная тема, зелёный акцент.
*/

:root {
  /* Spacing scale (8px base) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;

  /* Surfaces */
  --bg: #0d1117;
  --bg-elevated: #161b22;
  --bg-card: #161b22;
  --bg-card-hover: #21262d;
  --bg-input: #0d1117;

  /* Text */
  --text: #f0f6fc;
  --text-secondary: #8b949e;
  --text-tertiary: #6e7681;

  /* Accent */
  --accent: #3fb950;
  --accent-hover: #56d364;
  --accent-dim: #238636;
  --accent-glow: rgba(63, 185, 80, 0.2);
  --accent-subtle: rgba(63, 185, 80, 0.12);

  /* Borders & shadows */
  --border: #30363d;
  --border-subtle: #21262d;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-full: 9999px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4);

  /* Typography */
  --font-sans: "Outfit", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --leading-tight: 1.25;
  --leading-normal: 1.5;
  --leading-relaxed: 1.6;
  --tracking-tight: -0.02em;
}

/* Кастомное оформление: акцент задаётся из JS через setProperty на :root */

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.app-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Top accent bar — тонкая, не отвлекает */
.app-wrap::before {
  content: "";
  display: block;
  height: 3px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-hover) 50%, var(--accent) 100%);
  opacity: 0.85;
}

/* ========== Header ========== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(13, 17, 23, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.app-header.header-scrolled {
  background: rgba(13, 17, 23, 0.95);
  box-shadow: var(--shadow);
}

.app-header.hidden {
  display: none !important;
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--space-3) var(--space-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.logo {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: var(--tracking-tight);
  padding: var(--space-2) var(--space-2);
  border-radius: var(--radius-sm);
  transition: color 0.2s ease;
}

.logo:hover {
  color: var(--accent);
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

.nav a {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  font-size: var(--text-sm);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  transition: color 0.15s ease, background 0.15s ease;
}

.nav a:hover {
  color: var(--text);
  background: var(--bg-card-hover);
}

.nav a.active {
  color: var(--accent);
  background: var(--accent-subtle);
}

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

.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.user-name {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.header-right .link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: var(--text-sm);
  padding: var(--space-2) 0;
  transition: color 0.15s ease;
}

.header-right .link:hover {
  color: var(--accent);
}

/* ========== Main content ========== */
.app-main {
  flex: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--space-6) var(--space-5);
  width: 100%;
}

/* ========== Typography ========== */
.page-title {
  font-size: var(--text-2xl);
  font-weight: 700;
  letter-spacing: var(--tracking-tight);
  color: var(--text);
  margin: 0 0 var(--space-5);
  line-height: var(--leading-tight);
}

.section-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text);
  margin: 0 0 var(--space-3);
}

.card .section-title:first-child {
  margin-top: 0;
}

/* ========== Cards ========== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: var(--space-6);
  margin-bottom: var(--space-5);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  border-color: var(--border);
  box-shadow: var(--shadow);
}

/* ========== Оформление (выбор акцентного цвета) ========== */
.theme-label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin: 0 0 var(--space-3);
}

.theme-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}

.theme-swatch {
  --swatch: var(--accent);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  border: 3px solid var(--border-subtle);
  background: var(--swatch);
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.theme-swatch:hover {
  transform: scale(1.1);
  border-color: var(--border);
  box-shadow: var(--shadow);
}

.theme-swatch.active {
  border-color: var(--text);
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--text);
}

.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;
}

.theme-names {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin: 0;
}

/* ========== Forms ========== */
.form-group {
  margin-bottom: var(--space-4);
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-group label {
  display: block;
  font-weight: 500;
  font-size: var(--text-sm);
  margin-bottom: var(--space-2);
  color: var(--text);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  max-width: 400px;
  padding: var(--space-3) var(--space-4);
  font: inherit;
  font-size: var(--text-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-tertiary);
}

.form-group textarea {
  min-height: 120px;
  resize: vertical;
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
}

.form-row .form-group {
  flex: 1;
  min-width: 140px;
}

/* ========== Buttons (min 44px height for touch) ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-3) var(--space-4);
  min-height: 44px;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, transform 0.1s ease;
}

.btn:active {
  transform: scale(0.98);
}

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

.btn-primary {
  background: var(--accent);
  color: #0d1117;
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-outline:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-subtle);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  color: var(--text);
  background: var(--bg-card-hover);
}

.btn-danger {
  background: #da3633;
  color: #fff;
}

.btn-danger:hover {
  background: #f85149;
  box-shadow: 0 0 0 3px rgba(248, 81, 73, 0.25);
}

.btn-sm {
  padding: var(--space-2) var(--space-3);
  min-height: 36px;
  font-size: var(--text-xs);
}

.btn-secondary {
  background: var(--bg-card-hover);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-subtle);
}

/* ========== Search ========== */
.search-row {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  flex-wrap: wrap;
}

.search-row input {
  flex: 1;
  min-width: 200px;
}

.search-results {
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-subtle);
}

.search-results .muted,
.muted {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  margin: 0;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.search-result-list .list-item {
  padding: var(--space-3) 0;
}

/* ========== Lists ========== */
.list-plain {
  list-style: none;
  margin: 0;
  padding: 0;
}

.list-item {
  padding: var(--space-4) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
  transition: background 0.15s ease;
}

.list-item:last-child {
  border-bottom: none;
}

.list-item:hover {
  background: var(--bg-card-hover);
}

/* ========== Auth ========== */
.auth-screen {
  max-width: 400px;
  margin: var(--space-12) auto;
  padding: var(--space-8);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

.auth-screen .page-title {
  text-align: center;
  margin-bottom: var(--space-6);
}

.auth-screen .btn-primary {
  width: 100%;
  padding: var(--space-4);
  margin-top: var(--space-4);
}

.auth-screen .form-group input {
  max-width: none;
}

.auth-links {
  text-align: center;
  margin-top: var(--space-5);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.auth-links a {
  color: var(--accent);
  text-decoration: none;
}

.auth-links a:hover {
  color: var(--accent-hover);
}

/* ========== Messages ========== */
.message {
  padding: var(--space-4) var(--space-4);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-4);
  font-size: var(--text-sm);
}

.message.error {
  background: rgba(218, 54, 51, 0.12);
  color: #f85149;
  border: 1px solid rgba(218, 54, 51, 0.4);
}

.message.success {
  background: var(--accent-subtle);
  color: var(--accent);
  border: 1px solid rgba(63, 185, 80, 0.4);
}

.message.info {
  background: rgba(56, 139, 253, 0.12);
  color: #58a6ff;
  border: 1px solid rgba(56, 139, 253, 0.4);
}

/* ========== Dashboard grid ========== */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-4);
}

.dash-tile {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: inherit;
  display: block;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
  min-height: 100px;
}

.dash-tile:hover {
  border-color: var(--border);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

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

.dash-tile h3 {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text);
  margin: 0 0 var(--space-2);
}

.dash-tile p {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
}

/* ========== Leaderboard table ========== */
.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-subtle);
}

.leaderboard-table th,
.leaderboard-table td {
  padding: var(--space-4) var(--space-5);
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
}

.leaderboard-table th {
  background: var(--bg-elevated);
  color: var(--text);
  font-weight: 600;
  font-size: var(--text-sm);
}

.leaderboard-table tr:last-child td {
  border-bottom: none;
}

.leaderboard-table tr:hover td {
  background: var(--bg-card-hover);
}

.leaderboard-table .rank {
  font-weight: 600;
  color: var(--accent);
  width: 3rem;
}

.leaderboard-user-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.leaderboard-user-link:hover {
  text-decoration: underline;
}

/* ========== Empty state ========== */
.empty-state {
  text-align: center;
  padding: var(--space-8) var(--space-4);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  border: none !important;
  background: transparent !important;
  list-style: none;
}

.list-plain > li.empty-state {
  border-bottom: none;
  justify-content: center;
}

.empty-state p {
  margin: 0 0 var(--space-3);
}

/* ========== Tabs (pill-style, как в топ-приложениях) ========== */
.tabs {
  display: flex;
  gap: var(--space-1);
  margin-bottom: var(--space-5);
  flex-wrap: wrap;
}

.tabs a,
.tabs button.tab {
  padding: var(--space-2) var(--space-4);
  min-height: 40px;
  border-radius: var(--radius-full);
  text-decoration: none;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: var(--text-sm);
  border: none;
  background: transparent;
  cursor: pointer;
  font: inherit;
  display: inline-flex;
  align-items: center;
  transition: color 0.15s ease, background 0.15s ease;
}

.tabs a:hover,
.tabs button.tab:hover {
  color: var(--text);
  background: var(--bg-card-hover);
}

.tabs a.active,
.tabs button.tab.active {
  color: var(--text);
  background: var(--accent-subtle);
  color: var(--accent);
}

.tabs a:focus-visible,
.tabs button.tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ========== Pet screen ========== */
.pet-screen {
  text-align: center;
  padding: var(--space-8) var(--space-5) var(--space-12);
}

.pet-gif-wrap {
  margin: var(--space-8) auto;
  border-radius: var(--radius);
  overflow: hidden;
  max-width: 320px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-subtle);
}

.pet-gif-wrap img {
  display: block;
  width: 100%;
  height: auto;
  vertical-align: middle;
}

.pet-message {
  font-size: var(--text-lg);
  color: var(--text-secondary);
  max-width: 480px;
  margin: 0 auto var(--space-6);
  line-height: var(--leading-relaxed);
}

/* ========== Распределение очков по категориям ========== */
.points-by-group {
  margin-top: var(--space-4);
}

.points-by-group-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-secondary);
  margin: 0 0 var(--space-3);
}

.points-by-group-row {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
  min-height: 28px;
}

.points-by-group-row:last-child {
  margin-bottom: 0;
}

.points-by-group-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.points-by-group-icon {
  font-size: 1rem;
}

.points-by-group-value {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
  min-width: 4ch;
  text-align: right;
}

.points-by-group-bar-wrap {
  height: 8px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.points-by-group-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-dim) 0%, var(--accent) 100%);
  border-radius: var(--radius-sm);
  transition: width 0.4s ease;
}

/* ========== Stats page: плашки и графики ========== */
.stats-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.stats-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: var(--space-6);
  text-align: center;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.stats-card:hover {
  border-color: var(--border);
  box-shadow: var(--shadow);
}

.stats-card-icon {
  font-size: 2.5rem;
  line-height: 1;
  display: block;
  margin-bottom: var(--space-2);
}

.stats-card-value {
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--accent);
  line-height: 1.2;
}

.stats-card-label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: var(--space-1);
}

.stats-kbju-card .stats-kbju-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
  margin-top: var(--space-3);
}

.stats-kbju-item {
  text-align: center;
  padding: var(--space-3);
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
}

.stats-kbju-value {
  display: block;
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text);
}

.stats-kbju-unit {
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

@media (max-width: 520px) {
  .stats-cards { grid-template-columns: 1fr; }
  .stats-kbju-card .stats-kbju-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ========== Dashboard calendar ========== */
.dash-calendar-wrap {
  margin-bottom: var(--space-5);
}

.dash-calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}

.dash-calendar-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.dash-calendar-nav {
  display: flex;
  gap: var(--space-2);
}

.dash-calendar-nav button {
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  font-size: var(--text-sm);
  transition: border-color 0.2s ease, background 0.2s ease;
}

.dash-calendar-nav button:hover {
  border-color: var(--accent);
  background: var(--accent-subtle);
}

.dash-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  background: var(--border-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  overflow: hidden;
}

.dash-calendar-weekday {
  padding: var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-secondary);
  text-align: center;
  background: var(--bg-elevated);
}

.dash-calendar-day {
  min-height: 44px;
  padding: var(--space-2);
  font-size: var(--text-sm);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.2s ease;
}

.dash-calendar-day:hover {
  background: var(--bg-card-hover);
}

.dash-calendar-day.other-month {
  color: var(--text-tertiary);
}

.dash-calendar-day.today {
  font-weight: 700;
  color: var(--accent);
}

.dash-calendar-day.has-events {
  position: relative;
}

.dash-calendar-day.has-events::after {
  content: "";
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

.dash-calendar-day.selected {
  background: var(--accent-subtle);
  color: var(--accent);
}

.dash-day-events {
  margin-top: var(--space-4);
}

.dash-day-events h4 {
  font-size: var(--text-base);
  margin: 0 0 var(--space-3);
  color: var(--text);
}

.dash-day-events-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.dash-day-events-list li {
  padding: var(--space-3) var(--space-4);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.dash-day-events-list .event-name { font-weight: 600; color: var(--text); }
.dash-day-events-list .event-meta { color: var(--text-secondary); }
.dash-day-events-list .event-points { font-weight: 600; color: var(--accent); }

/* ========== Профиль друга ========== */
.friend-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.friend-link:hover {
  text-decoration: underline;
}

.friend-profile-info p {
  margin: 0 0 var(--space-2);
}

.friend-profile-info p:last-child {
  margin-bottom: 0;
}

/* ========== Лайки/дизлайки на мыслях ========== */
.mind-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}

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

.mind-reactions {
  display: flex;
  gap: var(--space-2);
  flex-shrink: 0;
}

.mind-reaction-btn {
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font: inherit;
  font-size: var(--text-sm);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.mind-reaction-btn:hover {
  border-color: var(--border);
  color: var(--text);
  background: var(--bg-card-hover);
}

.mind-reaction-btn.active {
  border-color: var(--accent);
  background: var(--accent-subtle);
  color: var(--accent);
}

.mind-reaction-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* ========== Background decorations ========== */
.app-wrap {
  position: relative;
  overflow-x: hidden;
}

.app-wrap::after {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width:  min(50vw, 400px);
  height: 100vh;
  background: radial-gradient(ellipse 100% 80% at 0% 20%, var(--accent-glow), transparent 60%);
  pointer-events: none;
  z-index: 0;
}

.app-wrap .app-main {
  position: relative;
  z-index: 1;
}

.app-wrap .app-header {
  position: relative;
  z-index: 2;
}

/* Декоративное пятно справа */
.app-wrap .app-main::before {
  content: "";
  position: absolute;
  top: 20%;
  right: -10%;
  width: 40%;
  max-width: 320px;
  height: 60%;
  background: radial-gradient(ellipse 80% 60% at 100% 50%, rgba(35, 134, 54, 0.08), transparent 70%);
  pointer-events: none;
}

/* ========== Event category buttons (как на лендинге) ========== */
.event-group-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-6);
  list-style: none;
  margin: 0 0 var(--space-6);
  padding: 0;
}

.event-group-btn {
  display: block;
  text-decoration: none;
  text-align: center;
  padding: var(--space-4) var(--space-3);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: var(--text-sm);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, color 0.2s ease, background 0.2s ease;
  min-height: 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
}

.event-group-btn:hover {
  border-color: var(--border);
  color: var(--text);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.event-group-btn.active {
  background: var(--accent-subtle);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.event-group-btn .event-group-icon {
  font-size: 1.5rem;
  line-height: 1;
}

/* ========== Event cards (вместо таблички) + центрирование ========== */
.events-cards-wrap {
  max-width: 640px;
  margin: 0 auto;
}

.events-cards {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  list-style: none;
  margin: 0;
  padding: 0;
}

.event-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: var(--space-4) var(--space-5);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
  animation: eventCardIn 0.35s ease backwards;
}

.event-card:hover {
  border-color: var(--border);
  box-shadow: var(--shadow);
  transform: translateX(4px);
}

.event-card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
  background: var(--bg-elevated);
}

.event-card-icon.sport { background: rgba(63, 185, 80, 0.2); }
.event-card-icon.nutrition { background: rgba(255, 166, 87, 0.2); }
.event-card-icon.sleep { background: rgba(121, 192, 255, 0.2); }
.event-card-icon.mind { background: rgba(210, 153, 255, 0.2); }

.event-card-body {
  flex: 1;
  min-width: 0;
}

.event-card-title {
  font-weight: 600;
  font-size: var(--text-base);
  color: var(--text);
  margin: 0 0 var(--space-1);
}

.event-card-meta {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin: 0;
}

.event-card-points {
  font-weight: 700;
  font-size: var(--text-lg);
  color: var(--accent);
  white-space: nowrap;
}

.event-card-points span {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-secondary);
}

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

.event-card:nth-child(1) { animation-delay: 0.05s; }
.event-card:nth-child(2) { animation-delay: 0.1s; }
.event-card:nth-child(3) { animation-delay: 0.15s; }
.event-card:nth-child(4) { animation-delay: 0.2s; }
.event-card:nth-child(5) { animation-delay: 0.25s; }
.event-card:nth-child(n+6) { animation-delay: 0.3s; }

.events-cards .empty-state {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  border-radius: var(--radius);
  background: var(--bg-elevated);
}

/* ========== Form: улучшенные поля ========== */
.form-group .input-wrap {
  position: relative;
  max-width: 400px;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="datetime-local"],
.form-group select,
.form-group textarea {
  width: 100%;
  max-width: 100%;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ========== Dashboard: feature tiles с иконками ========== */
.feature-tile {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: inherit;
  display: block;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
  min-height: 100px;
  animation: tileReveal 0.4s ease backwards;
}

.feature-tile:hover {
  border-color: var(--border);
  box-shadow: var(--shadow);
  transform: translateY(-3px);
}

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

.feature-tile-icon {
  font-size: 1.75rem;
  line-height: 1;
  margin-bottom: var(--space-3);
  display: block;
}

.feature-tile h3 {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text);
  margin: 0 0 var(--space-2);
}

.feature-tile p {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
}

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

.feature-tile:nth-child(1) { animation-delay: 0.05s; }
.feature-tile:nth-child(2) { animation-delay: 0.1s; }
.feature-tile:nth-child(3) { animation-delay: 0.15s; }
.feature-tile:nth-child(4) { animation-delay: 0.2s; }
.feature-tile:nth-child(5) { animation-delay: 0.25s; }
.feature-tile:nth-child(6) { animation-delay: 0.3s; }

/* ========== Responsive ========== */
@media (max-width: 768px) {
  .header-inner {
    flex-direction: column;
    align-items: flex-start;
    padding: var(--space-4);
  }

  .nav {
    width: 100%;
  }

  .nav a {
    flex: 1;
    justify-content: center;
    min-height: 44px;
  }

  .header-right {
    width: 100%;
    justify-content: flex-end;
  }

  .app-main {
    padding: var(--space-4);
  }

  .page-title {
    font-size: var(--text-xl);
  }

  .dash-grid {
    grid-template-columns: 1fr;
  }

  .card {
    padding: var(--space-4);
  }

  .event-group-buttons {
    grid-template-columns: repeat(2, 1fr);
  }

  .event-group-btn {
    min-height: 64px;
    padding: var(--space-3);
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
