/* Кампус — тёмная тема с красным акцентом. Только оформление, структура прежняя. */
:root {
  color-scheme: dark;
  --bg: #0b0b0d;
  --bg-2: #0e0e11;
  --surface: #16161a;
  --surface-2: #1d1d22;
  --surface-3: #24242a;
  --text: #f4f4f6;
  --muted: #8c8c96;
  --line: rgba(255, 255, 255, 0.075);
  --line-strong: rgba(255, 255, 255, 0.12);
  --red: #ff3b4e;
  --red-bright: #ff6b78;
  --red-deep: #cf0430;
  --red-soft: rgba(255, 59, 78, 0.14);
  --green: #3ddc84;
  --blue: #5aa9ff;
  --yellow: #ffc247;
  --radius: 20px;
  --radius-sm: 14px;
  --shadow: 0 14px 34px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

body {
  background:
    radial-gradient(900px 420px at 50% -6%, rgba(255, 59, 78, 0.18), transparent 62%),
    radial-gradient(700px 500px at 100% 8%, rgba(207, 4, 48, 0.10), transparent 60%),
    linear-gradient(180deg, #0b0b0d 0%, #0b0b0d 45%, #08080a 100%);
  background-attachment: fixed;
  padding-bottom: calc(108px + env(safe-area-inset-bottom));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  background: rgba(11, 11, 13, 0.72);
  backdrop-filter: blur(18px) saturate(140%);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; letter-spacing: -0.01em; }

.logo {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  border-radius: 11px;
  background: linear-gradient(135deg, #ff5468 0%, #cf0430 100%);
  box-shadow: 0 8px 20px rgba(255, 59, 78, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.icon-btn {
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--text);
  font-size: 18px;
  width: 40px;
  height: 40px;
  border-radius: 13px;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease;
}
.icon-btn:active { transform: scale(0.96); }

main { padding: 16px 16px 8px; max-width: 720px; margin: 0 auto; }

h2 {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.015em;
  margin: 2px 0 14px;
}
h3 { font-size: 18px; font-weight: 800; margin: 0 0 12px; letter-spacing: -0.01em; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.row.gap { gap: 10px; flex-wrap: wrap; }
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }

.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.012)), var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.28);
}
.card.ok { color: var(--green); }

.hero { margin-bottom: 14px; }
.hi { font-size: 21px; font-weight: 800; letter-spacing: -0.015em; margin-bottom: 10px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }

.chip {
  font-size: 12.5px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
}
.chip.on {
  color: var(--red-bright);
  border-color: rgba(255, 59, 78, 0.35);
  background: var(--red-soft);
}

.badge {
  font-size: 12px;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.badge.red { color: var(--red-bright); background: var(--red-soft); border-color: rgba(255, 59, 78, 0.3); }
.badge.yellow { color: var(--yellow); background: rgba(255, 194, 71, 0.12); border-color: rgba(255, 194, 71, 0.28); }
.badge.green { color: var(--green); background: rgba(61, 220, 132, 0.12); border-color: rgba(61, 220, 132, 0.28); }

.deadline { border-left: 3px solid var(--line-strong); padding-left: 15px; }
.deadline.red { border-left-color: var(--red); box-shadow: 0 10px 30px rgba(255, 59, 78, 0.12); }
.deadline.yellow { border-left-color: var(--yellow); }
.deadline.green { border-left-color: var(--green); }

.dl-subject { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.dl-title { font-weight: 700; margin: 6px 0 6px; font-size: 15.5px; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

.btn {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 11px 15px;
  font-size: 14.5px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.15s ease, background 0.15s ease;
}
.btn:active { transform: scale(0.97); }
.btn.primary {
  background: linear-gradient(135deg, #ff4a5e 0%, #cf0430 100%);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 8px 22px rgba(255, 59, 78, 0.30);
}
.btn.ghost { background: transparent; color: var(--muted); border-color: var(--line); }
.btn.small { padding: 8px 12px; font-size: 13px; border-radius: 11px; }

/* Кнопка «К предметам» в расширенной статистике остаётся под шапкой */
.sticky-back {
  position: sticky;
  top: calc(60px + env(safe-area-inset-top));
  z-index: 15;
  display: flex;
  padding: 6px 0 10px;
  margin: -6px 0 0;
  background: transparent;
  pointer-events: none;
}
.sticky-back .btn { pointer-events: auto; }
.btn[disabled] { opacity: 0.5; cursor: default; }
.btn.block { display: block; width: 100%; }
.connect-btn { margin-top: 8px; }

.quick {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01)), var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px;
  cursor: pointer;
  color: var(--text);
  text-align: left;
  font-size: 15px;
  font-weight: 700;
  transition: transform 0.12s ease, border-color 0.15s ease;
}
.quick:active { transform: scale(0.98); border-color: rgba(255, 59, 78, 0.3); }
.quick .qicon {
  font-size: 19px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  background: var(--red-soft);
}

.subject { cursor: pointer; transition: border-color 0.15s ease, transform 0.12s ease; }
.subject:active { transform: scale(0.99); border-color: rgba(255, 59, 78, 0.3); }
.subject .sname { font-weight: 700; }

.bar { height: 9px; border-radius: 999px; background: rgba(255, 255, 255, 0.07); overflow: hidden; margin: 9px 0 7px; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, #ff5468, #cf0430); border-radius: 999px; box-shadow: 0 0 12px rgba(255, 59, 78, 0.5); }

.list { display: flex; flex-direction: column; gap: 9px; }
.item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.01)), var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 13px;
}
.item .grow { flex: 1; min-width: 0; }
.item .txt { overflow-wrap: anywhere; font-weight: 600; }

.check {
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--red-bright);
  width: 36px;
  height: 36px;
  border-radius: 12px;
  font-size: 16px;
  cursor: pointer;
  flex: 0 0 auto;
  transition: background 0.15s ease, transform 0.12s ease;
}
.check:active { transform: scale(0.94); background: var(--red-soft); }

.grades { list-style: none; margin: 10px 0 0; padding: 0; }
.grades li { padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.grades li:first-child { border-top: 0; }
.g-ok { color: var(--green); }
.g-no { color: var(--red-bright); }

.presets { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.chip-btn {
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 13px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.chip-btn.on {
  background: linear-gradient(135deg, #ff4a5e, #cf0430);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 6px 16px rgba(255, 59, 78, 0.28);
}

.notice {
  background: linear-gradient(180deg, rgba(255, 59, 78, 0.10), rgba(255, 59, 78, 0.04)), var(--surface);
  border: 1px solid rgba(255, 59, 78, 0.28);
  color: var(--text);
  border-radius: 16px;
  padding: 13px;
  margin-bottom: 12px;
  font-size: 14px;
}
.error {
  background: rgba(255, 59, 78, 0.10);
  border: 1px solid rgba(255, 59, 78, 0.32);
  border-radius: 16px;
  padding: 15px;
  font-size: 14px;
}

.loading { text-align: center; color: var(--muted); padding: 52px 0; }

/* Скелетон при первом открытии вкладки */
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skel-title, .skel-card {
  background: linear-gradient(90deg, rgba(255,255,255,0.045) 25%, rgba(255,255,255,0.10) 37%, rgba(255,255,255,0.045) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease infinite;
  border-radius: 16px;
}
.skel-title { height: 26px; width: 52%; margin: 4px 0 18px; }
.skel-card { height: 96px; margin-bottom: 12px; border-radius: 20px; }

/* ---------- Нижняя панель вкладок: скруглённая «плашка» ---------- */
.tabs {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 30;
  width: calc(100% - 20px);
  max-width: 560px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
  padding: 11px 9px;
  background: rgba(18, 18, 21, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(20px) saturate(140%);
}

.tab {
  border: 0;
  background: transparent;
  color: #6f6f79;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 11px 2px 9px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  border-radius: 14px;
  cursor: pointer;
  transition: color 0.18s ease, transform 0.12s ease;
}
.tab .ticon {
  font-size: 25px;
  line-height: 1;
  filter: grayscale(1) opacity(0.55);
  transition: filter 0.18s ease, transform 0.18s ease;
}
.tab.active { color: var(--red-bright); }
.tab.active .ticon {
  transform: translateY(-1px);
  filter: drop-shadow(0 3px 8px rgba(255, 59, 78, 0.45));
}
.tab:active { transform: scale(0.95); }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(112px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(20px);
  background: #f4f4f6;
  color: #0b0b0d;
  padding: 11px 17px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: 0.2s ease;
  z-index: 60;
  max-width: 90vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--red); color: #fff; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.modal.hidden { display: none; }
.modal-card {
  width: 100%;
  max-width: 560px;
  background: linear-gradient(180deg, #1a1a1f, #131316);
  border: 1px solid var(--line-strong);
  border-bottom: 0;
  border-radius: 24px 24px 0 0;
  padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
  animation: slide-up 0.2s ease;
  max-height: 88vh;
  overflow: auto;
}
@keyframes slide-up { from { transform: translateY(40px); opacity: 0.4; } to { transform: none; opacity: 1; } }

.input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 13px 15px;
  font-size: 16px;
  margin-bottom: 10px;
}
.input::placeholder { color: var(--muted); }
.input:focus { outline: none; border-color: rgba(255, 59, 78, 0.55); box-shadow: 0 0 0 3px rgba(255, 59, 78, 0.14); }

.hr { height: 1px; background: var(--line); margin: 15px 0; }

/* ---------- Пропуски: крупные цифры ---------- */
.abs-hero-card { padding: 18px; }
.abs-hero { display: flex; align-items: baseline; gap: 12px; }
.abs-total {
  font-size: 46px;
  font-weight: 900;
  line-height: 0.95;
  letter-spacing: -0.03em;
  background: linear-gradient(180deg, #ffffff 20%, #ff8a95 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.abs-unit { font-size: 13px; font-weight: 600; color: var(--muted); }

.abs-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; }
.abs-stat {
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 11px 10px;
  text-align: center;
}
.abs-stat .num { font-size: 25px; font-weight: 900; line-height: 1.1; letter-spacing: -0.02em; }
.abs-stat .lbl { font-size: 11px; font-weight: 600; color: var(--muted); margin-top: 3px; }
.abs-stat.b .num { color: var(--green); }
.abs-stat.u .num { color: var(--blue); }
.abs-stat.n .num { color: var(--red-bright); }

.abs-row-item { align-items: center; }
.abs-name { font-weight: 700; font-size: 14.5px; line-height: 1.3; }
.abs-breakdown { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.abs-chip {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
}
.abs-chip.b { color: var(--green); background: rgba(61, 220, 132, 0.1); }
.abs-chip.u { color: var(--blue); background: rgba(90, 169, 255, 0.1); }
.abs-chip.n { color: var(--red-bright); background: var(--red-soft); }

.abs-count {
  flex: 0 0 auto;
  min-width: 46px;
  height: 46px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 23px;
  font-weight: 900;
  letter-spacing: -0.02em;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  color: var(--text);
}
.abs-count[class*="mix-"] {
  color: #fff;
  border: 0;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55), 0 0 8px rgba(0, 0, 0, 0.35);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35), inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}
.abs-count.mix-b { background: linear-gradient(160deg, #34d399, #047857); }
.abs-count.mix-u { background: linear-gradient(160deg, #60a5fa, #1d4ed8); }
.abs-count.mix-n { background: linear-gradient(160deg, #fb7185, #b91c1c); }
.abs-count.mix-bu {
  background:
    radial-gradient(circle at 50% 45%, rgba(0, 0, 0, 0.35), transparent 62%),
    conic-gradient(from -90deg, #10b981 0 50%, #3b82f6 50% 100%);
}
.abs-count.mix-bn {
  background:
    radial-gradient(circle at 50% 45%, rgba(0, 0, 0, 0.35), transparent 62%),
    conic-gradient(from -90deg, #10b981 0 50%, #ef4444 50% 100%);
}
.abs-count.mix-un {
  background:
    radial-gradient(circle at 50% 45%, rgba(0, 0, 0, 0.35), transparent 62%),
    conic-gradient(from -90deg, #3b82f6 0 50%, #ef4444 50% 100%);
}
.abs-count.mix-bun {
  background:
    radial-gradient(circle at 50% 45%, rgba(0, 0, 0, 0.38), transparent 64%),
    conic-gradient(from -90deg, #10b981 0 33.33%, #3b82f6 33.33% 66.66%, #ef4444 66.66% 100%);
}

/* ---------- Баллы: акцент на цифры ---------- */
.score-hero-card { padding: 18px; }
.score-hero { display: flex; align-items: baseline; gap: 12px; }
.score-total {
  font-size: 46px;
  font-weight: 900;
  line-height: 0.95;
  letter-spacing: -0.03em;
  background: linear-gradient(180deg, #ffffff 20%, #ff8a95 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.score-hero-unit { font-size: 13px; font-weight: 600; color: var(--muted); }

.score-row { display: flex; align-items: center; gap: 12px; }
.score-row .grow { flex: 1; min-width: 0; }
.score-num { flex: 0 0 auto; text-align: right; line-height: 1; }
.score-num b { display: block; font-size: 27px; font-weight: 900; letter-spacing: -0.02em; }
.score-num span { font-size: 12px; font-weight: 700; color: var(--muted); }
.score-num.low b { color: var(--red-bright); }
.score-num.top b { color: var(--green); }

/* ---------- Разбивка по работам (как в СДО) ---------- */
.work-list { padding: 14px; }
.work-cat { padding: 12px 0; }
.work-cat + .work-cat { border-top: 1px solid var(--line); }
.work-cat-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-weight: 800; font-size: 14px; margin-bottom: 4px; }
.work-cat-extra .work-cat-head > span:first-child { color: var(--red-bright); }
.work-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.work-row + .work-row { border-top: 1px solid rgba(255, 255, 255, 0.045); }
.work-name { flex: 1; min-width: 0; font-size: 13.5px; overflow-wrap: anywhere; }
.work-score { font-weight: 800; font-size: 14px; white-space: nowrap; }
.work-score span { color: var(--muted); font-weight: 600; font-size: 12px; }
.work-pct { min-width: 44px; text-align: right; font-weight: 800; font-size: 13px; color: var(--muted); }
.work-pct.hi { color: var(--green); }
.work-pct.mid { color: var(--text); }
.work-pct.lo { color: var(--red-bright); }

/* ---------- Плашка «обновлено» ---------- */
.sync-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 8px 7px 14px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  margin: 0 0 12px;
}
.sync-bar > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sync-btn {
  flex: 0 0 auto;
  border: 0;
  background: var(--red-soft);
  color: var(--red-bright);
  font-weight: 700;
  font-size: 12px;
  padding: 7px 13px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.12s ease;
}
.sync-btn:active { transform: scale(0.96); }
.sync-btn[disabled] { opacity: 0.7; }
