:root {
  --accent: #5B4CF0;
  --accent-dark: #4636c9;
  --accent-light: #eeecff;
  --green: #17a673;
  --green-light: #e6f8f1;
  --red: #e0355b;
  --red-light: #fdeaef;
  --amber: #d98c1c;
  --amber-light: #fdf3e2;
  --ink: #1b1b2f;
  --ink-soft: #5a5a72;
  --border: #e7e6f5;
  --bg: #f7f7fc;
  --card: #ffffff;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 2px 10px rgba(40, 30, 90, 0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: 1.8rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 .75rem; color: var(--ink-soft); }

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Navbar ---------- */
.navbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.navbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
}
.brand {
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #9d8cff);
  display: inline-block;
}
.nav-links { display: flex; gap: 4px; flex-wrap: wrap; }
.nav-links a {
  color: var(--ink-soft);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: .92rem;
}
.nav-links a.active, .nav-links a:hover { background: var(--accent-light); color: var(--accent-dark); text-decoration: none; }
.nav-spacer { flex: 1; }
.nav-user { display: flex; align-items: center; gap: 10px; font-size: .9rem; color: var(--ink-soft); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; object-fit: cover;
  background: var(--accent-light); display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: var(--accent-dark);
}

/* ---------- Layout ---------- */
.page { padding: 32px 0 64px; }
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 16px; }
.stat-card { text-align: left; }
.stat-value { font-size: 1.9rem; font-weight: 800; color: var(--ink); }
.stat-label { color: var(--ink-soft); font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 700;
  font-size: .92rem;
  border: none;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  transition: transform .08s ease, background .15s ease;
}
.btn:hover { background: var(--accent-dark); text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn-outline { background: transparent; color: var(--accent); border: 1.5px solid var(--accent); }
.btn-outline:hover { background: var(--accent-light); }
.btn-sm { padding: 6px 14px; font-size: .82rem; }
.btn-danger { background: var(--red); }
.btn-danger:hover { background: #b71f3e; }
.btn-ghost { background: transparent; color: var(--ink-soft); }
.btn-ghost:hover { background: #f0f0f7; text-decoration: none; }
.btn-block { width: 100%; }

/* ---------- Forms ---------- */
label { display: block; font-weight: 600; font-size: .88rem; margin: 14px 0 6px; }
label:first-child { margin-top: 0; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=time], input[type=file], input[type=tel],
select, textarea {
  width: 100%;
  padding: 10px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .95rem;
  font-family: inherit;
  background: #fff;
  color: var(--ink);
}
textarea { min-height: 100px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
.form-hint { font-size: .8rem; color: var(--ink-soft); margin-top: 4px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.checkbox-row input { width: auto; }
fieldset { border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; margin: 14px 0; }
legend { font-weight: 700; padding: 0 6px; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700;
}
.badge-green { background: var(--green-light); color: var(--green); }
.badge-red { background: var(--red-light); color: var(--red); }
.badge-amber { background: var(--amber-light); color: var(--amber); }
.badge-gray { background: #eef0f4; color: #626578; }
.badge-accent { background: var(--accent-light); color: var(--accent-dark); }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: .92rem; }
th { color: var(--ink-soft); font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; }
tr:last-child td { border-bottom: none; }
.table-wrap { overflow-x: auto; }

/* ---------- Flash ---------- */
.flash { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 14px; font-weight: 600; font-size: .9rem; }
.flash-error { background: var(--red-light); color: var(--red); }
.flash-success { background: var(--green-light); color: var(--green); }
.flash-info { background: var(--accent-light); color: var(--accent-dark); }

/* ---------- Calendar ---------- */
.calendar-controls { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.calendar-controls .tag-filter { margin-bottom: 0; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; }
.calendar-day { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px; min-height: 160px; }
.calendar-day-head { font-weight: 700; font-size: .82rem; color: var(--ink-soft); margin-bottom: 8px; display: flex; justify-content: space-between; }
.calendar-day.today { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-light); }
.calendar-day.other-month { opacity: .45; }
.lesson-chip {
  display: block; background: var(--accent-light); color: var(--accent-dark);
  border-radius: 8px; padding: 6px 8px; font-size: .78rem; margin-bottom: 6px; font-weight: 600;
}
.lesson-chip.cancelled { background: var(--red-light); color: var(--red); text-decoration: line-through; }
.lesson-chip.completed { background: var(--green-light); color: var(--green); }
.lesson-chip.hw-chip { background: var(--amber-light); color: var(--amber); }
/* Месячный вид: те же 7 колонок, но несколько строк недель — делаем ячейки
   компактнее, иначе месяц из 5-6 недель растягивает страницу непомерно. */
.calendar-grid.month .calendar-day { min-height: 90px; padding: 6px 8px; }
.calendar-grid.month .calendar-day-head { font-size: .74rem; margin-bottom: 4px; }
.calendar-grid.month .lesson-chip { padding: 3px 6px; font-size: .68rem; margin-bottom: 3px; }
@media (max-width: 900px) { .calendar-grid { grid-template-columns: repeat(auto-fit, minmax(140px,1fr)); } }

/* ---------- Landing ---------- */
.hero { padding: 90px 0 70px; text-align: center; }
.hero h1 { font-size: 2.6rem; max-width: 720px; margin: 0 auto 16px; }
.hero p { font-size: 1.1rem; max-width: 560px; margin: 0 auto 28px; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; padding: 40px 0; }
.feature-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.feature-icon { width: 44px; height: 44px; border-radius: 12px; background: var(--accent-light); display: flex; align-items: center; justify-content: center; font-size: 1.3rem; margin-bottom: 12px; }

/* ---------- Auth pages ---------- */
.auth-wrap { max-width: 420px; margin: 60px auto; }
.auth-wrap .card { padding: 32px; }
.auth-wrap h1 { text-align: center; font-size: 1.5rem; }
.auth-switch { text-align: center; margin-top: 16px; font-size: .9rem; }

/* ---------- Progress bar ---------- */
.progress-bar { height: 8px; background: #eee; border-radius: 999px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent), #9d8cff); }

.empty-state { text-align: center; padding: 40px 20px; color: var(--ink-soft); }
.muted { color: var(--ink-soft); font-size: .85rem; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 30px 0 12px; }
.section-title:first-child { margin-top: 0; }
.footer { text-align: center; color: var(--ink-soft); font-size: .82rem; padding: 30px 0; }
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li { padding: 10px 0; border-bottom: 1px solid var(--border); }
.list-plain li:last-child { border-bottom: none; }
.tag-filter { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.tag-filter a { padding: 6px 14px; border-radius: 999px; background: #eef0f4; color: var(--ink-soft); font-size: .85rem; font-weight: 600; }
.tag-filter a.active { background: var(--accent); color: #fff; }

/* графики результатов дз/пробников (progress.html) */
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: .8rem; color: var(--ink-soft); margin-bottom: 6px; }
.chart-legend .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }
.score-chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart-grid { stroke: var(--border); stroke-width: 1; }
.chart-axis-label { font-size: 9px; fill: var(--ink-soft); }
.chart-x-label { font-size: 9px; fill: var(--ink-soft); }
.chart-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-dot { stroke: #fff; stroke-width: 1.5; }
.dot-green, .chart-dot.dot-green { background: var(--green); fill: var(--green); }
.dot-red, .chart-dot.dot-red { background: var(--red); fill: var(--red); }
.dot-gray, .chart-dot.dot-gray { background: var(--ink-soft); fill: var(--ink-soft); }
