/* ОРИОКС Лайт — единая тема. Никаких CDN: всё локально. */

:root {
  color-scheme: light dark;

  --bg: #f4f5f8;
  --bg-elevated: #ffffff;
  --bg-sunken: #eceef3;
  --surface: rgba(255, 255, 255, 0.86);
  --border: #e0e3ea;
  --border-strong: #cdd2dd;
  --text: #14161c;
  --text-muted: #626a7b;
  --text-faint: #8b93a4;

  --accent: #5b5bd6;
  --accent-soft: rgba(91, 91, 214, 0.12);
  --accent-text: #ffffff;

  --great: #12a366;
  --great-soft: rgba(18, 163, 102, 0.14);
  --good: #2f7ae5;
  --good-soft: rgba(47, 122, 229, 0.14);
  --ok: #d18700;
  --ok-soft: rgba(209, 135, 0, 0.16);
  --bad: #dc3b52;
  --bad-soft: rgba(220, 59, 82, 0.14);
  --empty: #9aa2b1;
  --empty-soft: rgba(154, 162, 177, 0.16);

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 20, 30, 0.06), 0 8px 24px rgba(16, 20, 30, 0.06);
  --shadow-lg: 0 12px 40px rgba(16, 20, 30, 0.12);
  --sidebar-w: 248px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

html[data-theme="dark"] {
  --bg: #0d0f14;
  --bg-elevated: #161922;
  --bg-sunken: #12141b;
  --surface: rgba(22, 25, 34, 0.86);
  --border: #242833;
  --border-strong: #333949;
  --text: #eef0f6;
  --text-muted: #98a0b3;
  --text-faint: #6d7488;

  --accent: #7c7cf0;
  --accent-soft: rgba(124, 124, 240, 0.18);

  --great: #2ecc8f;
  --great-soft: rgba(46, 204, 143, 0.16);
  --good: #5b9cf8;
  --good-soft: rgba(91, 156, 248, 0.16);
  --ok: #f0b429;
  --ok-soft: rgba(240, 180, 41, 0.16);
  --bad: #f2617a;
  --bad-soft: rgba(242, 97, 122, 0.16);
  --empty: #6d7488;
  --empty-soft: rgba(109, 116, 136, 0.18);

  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.28);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.015em; }
h1 { font-size: 27px; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }

/* --- каркас ---------------------------------------------------------- */

.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  border-right: 1px solid var(--border);
  background: var(--bg-elevated);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 18px;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.02em;
}

.brand-mark {
  width: 30px; height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), #a855f7);
  display: grid; place-items: center;
  color: #fff; font-size: 14px; font-weight: 800;
  box-shadow: 0 4px 14px var(--accent-soft);
}

.nav { display: flex; flex-direction: column; gap: 2px; }

.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 520;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: var(--bg-sunken); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-item svg { width: 18px; height: 18px; flex: 0 0 18px; }

.sidebar-footer { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }

.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 10px; border-radius: var(--radius-sm);
  background: var(--bg-sunken);
}
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #a855f7);
  color: #fff; display: grid; place-items: center;
  font-size: 12px; font-weight: 700;
}
.user-chip-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip-sub { font-size: 11.5px; color: var(--text-faint); }

.content { flex: 1; min-width: 0; padding: 30px 34px 80px; max-width: 1180px; }

.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 20px; margin-bottom: 24px; flex-wrap: wrap;
}
.page-sub { color: var(--text-muted); font-size: 14px; margin-top: 4px; }

/* --- элементы -------------------------------------------------------- */

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.grid { display: grid; gap: 16px; }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(232px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

.stat {
  padding: 18px 20px; min-width: 0;
  display: flex; flex-direction: column; gap: 6px;
}
.stat > * { min-width: 0; }
.stat-label { font-size: 12.5px; color: var(--text-muted); font-weight: 550; text-transform: uppercase; letter-spacing: 0.04em; }
.stat-value { font-size: 30px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; }
.stat-hint { font-size: 13px; color: var(--text-faint); }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
  background: var(--empty-soft); color: var(--empty);
}
.badge.great { background: var(--great-soft); color: var(--great); }
.badge.good  { background: var(--good-soft);  color: var(--good); }
.badge.ok    { background: var(--ok-soft);    color: var(--ok); }
.badge.bad   { background: var(--bad-soft);   color: var(--bad); }
.badge.accent{ background: var(--accent-soft);color: var(--accent); }

.bar {
  position: relative; height: 8px; border-radius: 999px;
  background: var(--bg-sunken); overflow: hidden;
}
.bar-fill { position: absolute; inset: 0 auto 0 0; border-radius: 999px; background: var(--empty); transition: width 0.5s ease; }
.bar-fill.great { background: linear-gradient(90deg, var(--great), #34d399); }
.bar-fill.good  { background: linear-gradient(90deg, var(--good), #60a5fa); }
.bar-fill.ok    { background: linear-gradient(90deg, var(--ok), #fbbf24); }
.bar-fill.bad   { background: linear-gradient(90deg, var(--bad), #fb7185); }
.bar-ghost { position: absolute; inset: 0 auto 0 0; border-radius: 999px; background: var(--border-strong); opacity: 0.7; }

/* карточки дисциплин */

.disciplines { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }

.discipline-card {
  padding: 18px;
  display: flex; flex-direction: column; gap: 14px;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.discipline-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--border-strong); }
.discipline-top { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; }
.discipline-name { font-weight: 640; font-size: 15.5px; letter-spacing: -0.01em; }
.discipline-meta { font-size: 12.5px; color: var(--text-faint); margin-top: 3px; }

.score { text-align: right; flex: 0 0 auto; }
.score-value { font-size: 22px; font-weight: 720; letter-spacing: -0.02em; line-height: 1; }
.score-max { font-size: 12px; color: var(--text-faint); }

.discipline-foot { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; color: var(--text-muted); gap: 10px; }

/* таблица КМ */

.events { display: flex; flex-direction: column; }
.event-row {
  display: grid;
  grid-template-columns: 52px 1fr 130px 92px;
  gap: 14px; align-items: center;
  padding: 13px 18px;
  border-top: 1px solid var(--border);
}
.event-row:first-child { border-top: none; }
.event-row.missed { background: var(--bad-soft); }
.event-week { font-size: 12px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.event-name { font-weight: 560; }
.event-type { font-size: 12px; color: var(--text-faint); }
.event-grade { text-align: right; font-variant-numeric: tabular-nums; font-weight: 640; }
.event-grade small { color: var(--text-faint); font-weight: 500; }

/* прочее */

.section { margin-top: 30px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 13px; gap: 12px; }
.section-head h2 small { color: var(--text-faint); font-weight: 500; font-size: 13px; margin-left: 8px; }

.list-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; padding: 14px 18px; border-top: 1px solid var(--border);
}
.list-row:first-child { border-top: none; }

.empty-state {
  padding: 44px 20px; text-align: center; color: var(--text-muted);
}
.empty-state .emoji { font-size: 30px; display: block; margin-bottom: 10px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated); color: var(--text);
  font: inherit; font-weight: 580; font-size: 14px;
  cursor: pointer; white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.btn:hover { background: var(--bg-sunken); }
.btn:active { transform: scale(0.985); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-muted); }
.btn.ghost:hover { background: var(--bg-sunken); color: var(--text); }
.btn.danger { color: var(--bad); border-color: var(--bad-soft); background: var(--bad-soft); }
.btn.small { padding: 6px 11px; font-size: 13px; }

.input {
  width: 100%; padding: 11px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated); color: var(--text);
  font: inherit; font-size: 15px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 580; color: var(--text-muted); }

.alert {
  padding: 11px 14px; border-radius: var(--radius-sm);
  font-size: 13.5px; border: 1px solid transparent;
}
.alert.error { background: var(--bad-soft); color: var(--bad); border-color: var(--bad-soft); }
.alert.info { background: var(--accent-soft); color: var(--accent); }
.alert.warn { background: var(--ok-soft); color: var(--ok); }

/* --- вход ------------------------------------------------------------ */

.login-wrap {
  min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr;
}
.login-hero {
  padding: 56px; display: flex; flex-direction: column; justify-content: space-between;
  background:
    radial-gradient(1000px 520px at 15% 10%, rgba(124, 124, 240, 0.34), transparent 62%),
    radial-gradient(900px 480px at 85% 85%, rgba(168, 85, 247, 0.26), transparent 60%),
    var(--bg-sunken);
  border-right: 1px solid var(--border);
}
.login-hero h1 { font-size: 40px; line-height: 1.12; letter-spacing: -0.035em; max-width: 12ch; }
.login-hero p { color: var(--text-muted); max-width: 44ch; font-size: 15.5px; }
.hero-points { display: flex; flex-direction: column; gap: 12px; margin-top: 26px; }
.hero-point { display: flex; gap: 11px; align-items: flex-start; font-size: 14.5px; color: var(--text-muted); }
.hero-point b { color: var(--text); font-weight: 620; }
.hero-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-top: 8px; flex: 0 0 7px; }

.login-panel { display: grid; place-items: center; padding: 40px 28px; }
.login-card { width: 100%; max-width: 372px; display: flex; flex-direction: column; gap: 16px; }
.login-card h2 { font-size: 24px; }
.login-note { font-size: 12.5px; color: var(--text-faint); line-height: 1.55; }

/* --- расписание ------------------------------------------------------ */

.sched-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); align-items: start; }
.day-card { padding: 0; overflow: hidden; }
.day-head {
  padding: 12px 16px; font-weight: 640; font-size: 14px;
  border-bottom: 1px solid var(--border); background: var(--bg-sunken);
  display: flex; justify-content: space-between; align-items: center;
}
.day-card.today .day-head { background: var(--accent-soft); color: var(--accent); }
.lesson { padding: 12px 16px; border-top: 1px solid var(--border); display: flex; gap: 12px; }
.lesson:first-of-type { border-top: none; }
.lesson-time { font-size: 12px; color: var(--text-faint); font-variant-numeric: tabular-nums; flex: 0 0 44px; }
.lesson-time b { display: block; color: var(--text-muted); font-size: 12.5px; }
.lesson-name { font-weight: 560; font-size: 14px; }
.lesson-meta { font-size: 12.5px; color: var(--text-faint); margin-top: 3px; }
.day-empty { padding: 18px 16px; color: var(--text-faint); font-size: 13px; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 560;
  border: 1px solid var(--border-strong); color: var(--text-muted); cursor: pointer;
  background: var(--bg-elevated);
}
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* --- кольцо ---------------------------------------------------------- */

.ring { display: grid; place-items: center; position: relative; }
.ring svg { transform: rotate(-90deg); }
.ring-label { position: absolute; text-align: center; }
.ring-value { font-size: 24px; font-weight: 720; letter-spacing: -0.02em; }
.ring-sub { font-size: 11.5px; color: var(--text-faint); }

/* --- мобильная навигация --------------------------------------------- */

.mobile-bar { display: none; }
.mobile-top { display: none; }

@media (max-width: 940px) {
  .login-wrap { grid-template-columns: 1fr; }
  .login-hero { display: none; }
}

@media (max-width: 760px) {
  .sidebar { display: none; }
  .content { padding: 16px 16px 92px; }
  h1 { font-size: 22px; }
  .grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .grid.cols-2, .grid.cols-3 { grid-template-columns: 1fr; }
  .stat-value { font-size: 25px; }
  .event-row { grid-template-columns: 40px 1fr 78px; }
  .event-row .event-bar-cell { display: none; }

  .mobile-top {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; border-bottom: 1px solid var(--border);
    background: var(--bg-elevated); position: sticky; top: 0; z-index: 20;
  }
  .mobile-bar {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
    background: var(--surface); backdrop-filter: blur(14px);
    border-top: 1px solid var(--border);
    padding: 8px 4px calc(8px + env(safe-area-inset-bottom));
    overflow-x: auto; scrollbar-width: none;
  }
  .mobile-bar::-webkit-scrollbar { display: none; }
  .mobile-bar a {
    flex: 1 0 auto; min-width: 15vw;
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    font-size: 10px; color: var(--text-faint); padding: 4px 2px; font-weight: 560;
  }
  .mobile-bar a.active { color: var(--accent); }
  .mobile-bar svg { width: 21px; height: 21px; }
}

.skeleton {
  background: linear-gradient(90deg, var(--bg-sunken), var(--border), var(--bg-sunken));
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite linear;
  border-radius: 6px; color: transparent;
}
@keyframes shimmer { to { background-position: -200% 0; } }

.fade-in { animation: fade 0.35s ease both; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* --- блок «сейчас» --------------------------------------------------- */

.now-card { padding: 18px 20px; display: flex; flex-direction: column; gap: 4px; }
.now-status {
  font-size: 12px; font-weight: 650; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--text-faint); display: flex; align-items: center; gap: 7px;
}
.now-status.live { color: var(--great); }
.now-subject { font-size: 18px; font-weight: 650; letter-spacing: -0.015em; margin-top: 2px; }
.now-meta { font-size: 13px; color: var(--text-muted); }
.now-time { font-size: 13px; color: var(--text-faint); margin-top: 4px; }
.pulse {
  width: 8px; height: 8px; border-radius: 50%; background: var(--great);
  box-shadow: 0 0 0 0 var(--great-soft); animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 var(--great-soft); }
  70% { box-shadow: 0 0 0 9px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

.lesson-gap {
  padding: 8px 16px; font-size: 12.5px; color: var(--text-faint);
  background: var(--bg-sunken); border-top: 1px dashed var(--border-strong);
  display: flex; align-items: center; gap: 8px;
}
.lesson-kind {
  display: inline-block; padding: 1px 7px; border-radius: 5px; font-size: 11px;
  font-weight: 620; background: var(--accent-soft); color: var(--accent); margin-right: 6px;
}
.lesson-kind.lab { background: var(--good-soft); color: var(--good); }
.lesson-kind.pr { background: var(--ok-soft); color: var(--ok); }

.group-search { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.group-search .input { max-width: 240px; }

/* --- новости --------------------------------------------------------- */

.news-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.news-card {
  padding: 18px; display: flex; flex-direction: column; gap: 10px; min-height: 120px;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.news-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--border-strong); }
.news-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.news-badge {
  font-size: 11.5px; font-weight: 650; color: var(--accent);
  background: var(--accent-soft); padding: 3px 9px; border-radius: 999px;
}
.news-date { font-size: 12.5px; color: var(--text-faint); }
.news-title {
  font-weight: 600; font-size: 15.5px; line-height: 1.35; letter-spacing: -0.01em;
  flex: 1;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.news-more { font-size: 13px; color: var(--text-faint); font-weight: 550; }
.news-card:hover .news-more { color: var(--accent); }
