/* Daily Russian School — design system
   Serif display (Playfair Display) + clean UI sans (Inter), bright red #FF3B30,
   warm off-white background, rounded white cards, black accent cards. */

:root {
  --red:        #FF3B30;
  --red-hover:  #E42B21;
  --red-soft:   #FFE7E4;
  --red-softer: #FFF1F0;
  --bg:         #F5F3EF;
  --card:       #FFFFFF;
  --ink:        #17140F;
  --ink-2:      #5F5A53;
  --muted:      #948F87;
  --line:       #ECE7E0;
  --black:      #141210;
  --black-soft: #26221E;
  --ok:         #1FA463;

  --shadow-sm: 0 1px 2px rgba(30, 24, 16, .05);
  --shadow-md: 0 8px 30px rgba(30, 24, 16, .07);
  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;

  --serif: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ---------- app shell ---------- */
.app { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }

.sidebar {
  padding: 26px 20px;
  display: flex; flex-direction: column; gap: 26px;
  border-right: 1px solid var(--line);
  background: #FBFAF8;
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto;   /* short viewports: scroll instead of clipping the bottom cards */
}
.nav-toggle {
  display: none;   /* desktop: the sidebar is always expanded */
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  width: 40px; height: 40px; font-size: 18px; line-height: 1; color: var(--ink);
  align-items: center; justify-content: center;
}
.brand { line-height: 1.05; }
.brand .name { font-family: var(--serif); font-weight: 700; font-size: 25px; letter-spacing: -.01em; }
.brand .sub  { font-family: var(--serif); font-weight: 500; font-size: 15px; color: var(--ink-2); }
.brand .role {
  margin-top: 10px; font-size: 11px; font-weight: 700; letter-spacing: .14em;
  color: var(--red); text-transform: uppercase;
}

.course-switch { display: flex; flex-direction: column; gap: 5px; }
.course-switch-label { font-size: 10.5px; font-weight: 700; letter-spacing: .12em; color: var(--muted); text-transform: uppercase; }
.course-select {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; font-family: inherit; font-size: 14px; font-weight: 600; color: var(--ink);
  cursor: pointer; outline: none;
}
.course-select:focus { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-softer); }
.course-select:disabled { color: var(--muted); cursor: default; }

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 13px; border-radius: 11px;
  color: var(--ink-2); font-weight: 500; font-size: 14.5px;
  transition: background .15s, color .15s;
}
.nav a .dot { width: 7px; height: 7px; border-radius: 50%; background: #C9C3BA; flex: none; }
.nav a:hover { background: #F2EEE8; color: var(--ink); }
.nav a.active { background: var(--red-softer); color: var(--red); font-weight: 600; }
.nav a.active .dot { background: var(--red); }
.nav a .badge {
  margin-left: auto; background: var(--red); color: #fff;
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; display: grid; place-items: center;
}

.teaching-card {
  margin-top: auto; padding: 15px; border-radius: var(--r-md);
  border: 1px solid var(--line); background: #fff;
}
.teaching-card .label { font-size: 10.5px; font-weight: 700; letter-spacing: .12em; color: var(--muted); text-transform: uppercase; }
.teaching-card .course { font-weight: 600; margin: 5px 0 12px; font-size: 14px; }
.teaching-card .who { display: flex; align-items: center; gap: 10px; }

.tz-picker { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.tz-picker label { font-size: 10.5px; font-weight: 700; letter-spacing: .12em; color: var(--muted); text-transform: uppercase; }
.tz-picker .course-select { width: 100%; }

/* ---------- main ---------- */
.main { padding: 34px 46px 60px; max-width: 1160px; margin-inline: auto; width: 100%; }
.topline { color: var(--ink-2); font-size: 13.5px; font-weight: 500; margin-bottom: 6px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; }
h1.display { font-family: var(--serif); font-weight: 700; font-size: 38px; letter-spacing: -.015em; margin: 0; }
.page-head .meta { color: var(--ink-2); font-size: 14px; font-weight: 500; }

.section-title { font-family: var(--serif); font-weight: 600; font-size: 22px; margin: 0 0 14px; }

/* ---------- avatars ---------- */
.avatar {
  width: 38px; height: 38px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-size: 13px; font-weight: 700;
  background: #EDE8E1; color: var(--ink-2); letter-spacing: .02em;
}
.avatar.red { background: var(--red); color: #fff; }
.avatar.sm { width: 32px; height: 32px; font-size: 12px; }
.who .name { font-weight: 600; font-size: 14px; }
.who .muted { color: var(--muted); font-size: 12.5px; }

/* ---------- stat cards ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin: 26px 0; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 20px 20px 18px; box-shadow: var(--shadow-sm); min-height: 104px;
}
.stat .num { font-family: var(--serif); font-weight: 700; font-size: 40px; line-height: 1; letter-spacing: -.02em; }
.stat .lbl { color: var(--ink-2); font-size: 13.5px; margin-top: 12px; font-weight: 500; }
.stat.accent { background: var(--red); border-color: var(--red); color: #fff; }
.stat.accent .lbl { color: rgba(255,255,255,.85); }

/* ---------- dark "next class" card ---------- */
.dark-card + .dark-card { margin-top: 16px; }   /* stacked lesson-review panels */
.dark-card {
  background: var(--black); color: #fff; border-radius: var(--r-lg);
  padding: 26px 30px; display: flex; align-items: center; justify-content: space-between;
  gap: 24px; flex-wrap: wrap; box-shadow: var(--shadow-md);
}
.dark-card .eyebrow { color: var(--red); font-size: 11.5px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
.dark-card h2 { font-family: var(--serif); font-weight: 700; font-size: 30px; margin: 8px 0 8px; letter-spacing: -.01em; }
.dark-card .sub { color: rgba(255,255,255,.6); font-size: 14px; }
.dark-card .actions { display: flex; gap: 12px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: none; border-radius: 999px; padding: 12px 22px; font-weight: 600; font-size: 14px;
  transition: background .15s, transform .05s, opacity .15s; white-space: nowrap;
}
/* Full-width buttons need to sit on their own line (matters for <a> buttons). */
.btn.block { display: flex; }
.btn:active { transform: translateY(1px); }
.btn.red { background: var(--red); color: #fff; }
.btn.red:hover { background: var(--red-hover); }
.btn.dark { background: var(--black-soft); color: #fff; }
.btn.dark:hover { background: #35302a; }
.btn.ghost-light { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.28); }
.btn.ghost-light:hover { background: rgba(255,255,255,.08); }
.btn.outline { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn.outline:hover { background: #F6F2EC; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.lg { padding: 15px 26px; font-size: 15px; }
.btn.sm { padding: 8px 14px; font-size: 13px; }

/* ---------- generic card / panel ---------- */
.panel {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.panel.soft { background: #FBFAF7; }
/* Live in-class activities — stands out from the other home sections. */
.panel-activities {
  background: var(--red-softer); border-color: var(--red-soft);
  box-shadow: 0 8px 26px rgba(255, 59, 48, .10);
}
.panel-activities .panel-head h3 { color: var(--red); }
.panel-activities .row:hover { background: #FFE7E4; }
.panel-activities .row + .row { border-top-color: var(--red-soft); }
.panel-pad { padding: 22px 24px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px 4px; }
.panel-head h3 { font-family: var(--serif); font-weight: 600; font-size: 19px; margin: 0; }
.link-red { color: var(--red); font-weight: 600; font-size: 13.5px; }

/* ---------- list rows ---------- */
.rows { padding: 8px 12px 14px; }
.row {
  display: flex; align-items: center; gap: 14px; padding: 13px 12px;
  border-radius: 12px; transition: background .12s;
}
.row:hover { background: #F7F3ED; }
.row + .row { border-top: 1px solid var(--line); border-radius: 0; }
.row + .row:hover { border-radius: 12px; }
.row .grow { flex: 1; min-width: 0; }
.row .title { font-weight: 600; font-size: 14.5px; }
.row .subtle { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

/* ---------- status pills ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 13px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.pill.pink { background: var(--red-soft); color: var(--red); }
.pill.gray { background: #F0ECE5; color: var(--ink-2); }
.pill.green { background: #E4F6EC; color: var(--ok); }
.pill.black { background: var(--black); color: #fff; }

/* ---------- table-ish student list ---------- */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 11.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); font-weight: 700; padding: 4px 14px 12px; }
.tbl td { padding: 14px; border-top: 1px solid var(--line); font-size: 14px; vertical-align: middle; }
.tbl tr:hover td { background: #FBF8F3; }

/* ---------- forms ---------- */
.field { display: block; margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 7px; color: var(--ink-2); }
.input, textarea.input, select.input {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-sm);
  font-family: inherit; font-size: 14.5px; background: #fff; color: var(--ink); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-softer); }
textarea.input { resize: vertical; min-height: 96px; }

/* ---------- dropzone (homework) ---------- */
.dropzone {
  border: 2px dashed #D9D2C8; border-radius: var(--r-md); padding: 34px; text-align: center;
  cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--red); background: var(--red-softer); }
.dropzone .up-ic { width: 46px; height: 46px; border-radius: 12px; background: #F0ECE5; display: grid; place-items: center; margin: 0 auto 12px; }
.dropzone .big { font-weight: 700; font-size: 15px; }
.dropzone .hint { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.or { text-align: center; color: var(--muted); font-size: 13px; margin: 16px 0; }

.file-chip {
  display: flex; align-items: center; gap: 13px; padding: 15px; border-radius: var(--r-md);
  border: 1.5px solid var(--red); background: var(--red-softer);
}
.file-chip .ficon { width: 40px; height: 40px; border-radius: 9px; background: #fff; border: 1px solid var(--red-soft); display: grid; place-items: center; font-size: 10px; font-weight: 800; color: var(--red); }
.file-chip .grow { flex: 1; min-width: 0; }
.file-chip .fname { font-weight: 700; font-size: 14px; }
.file-chip .fmeta { color: var(--ink-2); font-size: 12px; }
.file-chip .x { border: none; background: transparent; color: var(--ink-2); font-size: 18px; line-height: 1; padding: 4px; }

.progress-wrap { height: 10px; background: #F0ECE5; border-radius: 999px; overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: var(--red); border-radius: 999px; transition: width .2s; }

/* ---------- success screen ---------- */
.success {
  background: var(--black); color: #fff; border-radius: var(--r-lg); padding: 46px 40px; text-align: center;
}
.success .check { width: 66px; height: 66px; border-radius: 50%; background: var(--red); display: grid; place-items: center; margin: 0 auto 20px; }
.success h2 { font-family: var(--serif); font-weight: 700; font-size: 27px; margin: 0 0 8px; }
.success p { color: rgba(255,255,255,.62); margin: 0 0 22px; }

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(20,16,12,.42); backdrop-filter: blur(2px);
  display: none; align-items: center; justify-content: center; padding: 24px; z-index: 50;
}
.modal-backdrop.open { display: flex; }
body.modal-open { overflow: hidden; }
.modal {
  background: #fff; border-radius: var(--r-lg); width: min(560px, 100%); max-height: 90vh;
  overflow: auto; box-shadow: 0 30px 80px rgba(20,16,12,.3);
}
.modal .m-head { padding: 22px 26px; border-bottom: 1px solid var(--line); }
.modal .m-body { padding: 22px 26px; }
.modal .m-foot { padding: 18px 26px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 12px; }

/* ---------- misc ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.mt-24 { margin-top: 24px; }
.mt-16 { margin-top: 16px; }
.muted { color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 40px; }
.answer-box { background: #FBFAF7; border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px; font-size: 14.5px; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }

/* Prevent long feedback / emails / titles from overflowing their containers. */
.row .title, .row .subtle, .who .name, .who .muted, .muted, .fname, .stat .lbl {
  overflow-wrap: anywhere; word-break: break-word; min-width: 0;
}
.who > div { min-width: 0; }

/* Small round delete button used in Schedule / Materials rows. */
.del-btn {
  flex: none; border: none; background: transparent; color: var(--muted);
  width: 30px; height: 30px; border-radius: 8px; font-size: 15px; line-height: 1;
  cursor: pointer; transition: background .12s, color .12s;
}
.del-btn:hover { background: var(--red-softer); color: var(--red); }
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--black); color: #fff; padding: 13px 22px; border-radius: 999px; font-weight: 600;
  font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 100;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* timezone-mismatch suggestion bar (shown once per detected zone on login) */
.tz-suggest {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 150;
  width: max-content; max-width: min(620px, calc(100vw - 28px));
  display: flex; align-items: center; gap: 14px 18px; flex-wrap: wrap;
  background: var(--black); color: #fff; padding: 14px 20px;
  border-radius: 16px; box-shadow: var(--shadow-md); font-size: 14px;
}
.tz-suggest b { font-weight: 700; }
.tz-suggest-actions { display: flex; gap: 8px; margin-left: auto; }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { background: #fff; border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow-md); width: min(420px, 100%); padding: 38px 36px; }
.login-card .brand { text-align: center; margin-bottom: 26px; }
.login-card .role { justify-content: center; }
.demo-note { margin-top: 20px; padding: 14px 16px; background: #FBFAF7; border: 1px solid var(--line); border-radius: var(--r-md); font-size: 12.5px; color: var(--ink-2); }
.demo-note b { color: var(--ink); }
.demo-note .demo-row { cursor: pointer; padding: 3px 0; }
.demo-note .demo-row:hover { color: var(--red); }
.err { color: var(--red); font-size: 13px; font-weight: 600; min-height: 18px; margin-bottom: 4px; }

/* ---------- responsive ---------- */
/* ---------- quizzes ---------- */
.quiz-q {
  border: 1px solid var(--line); border-radius: 14px; padding: 14px;
  background: #FBFAF7; margin-bottom: 14px;
}
.quiz-opt { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.quiz-opt input[type="radio"], .quiz-opt input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--red); flex: none; cursor: pointer; }
.quiz-opt .input { flex: 1; min-width: 0; }
.quiz-answer {
  display: flex; align-items: center; gap: 10px; padding: 11px 13px;
  border: 1px solid var(--line); border-radius: 11px; margin-bottom: 8px;
  background: #fff; cursor: pointer;
}
.quiz-answer:hover { border-color: var(--red); }
.quiz-answer.right { border-color: var(--ok); background: #F2FBF6; }
.quiz-answer.wrong { border-color: var(--red); background: var(--red-softer); }
.quiz-answer input[type="radio"], .quiz-answer input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--red); flex: none; }
.score-card {
  background: var(--black); color: #fff; border-radius: var(--r-lg);
  padding: 30px; text-align: center; margin-bottom: 22px;
}
.score-card .pct { font-family: var(--serif); font-weight: 700; font-size: 52px; line-height: 1; }
.score-card .sub { color: rgba(255,255,255,.62); margin-top: 8px; }

/* ---------- video lesson player ---------- */
.video-wrap {
  position: relative; width: 100%; padding-top: 56.25%;   /* 16:9 */
  border-radius: var(--r-lg); overflow: hidden; background: #000;
  box-shadow: var(--shadow-md);
}
.video-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ---------- course progress chips ---------- */
.progress-chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center;
  font-weight: 700; font-size: 15px; flex: none; border: 2px solid transparent;
}
.chip.done     { background: var(--red); color: #fff; }
.chip.attended { background: var(--red); color: #fff; }
.chip.missed   { background: var(--black); color: #fff; }
.chip.next     { background: #fff; color: var(--red); border-color: var(--red); }
.chip.upcoming { background: #EDE8E1; color: var(--muted); }
.chip.sm { width: 36px; height: 36px; font-size: 13px; border-radius: 10px; }
.att-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); flex: none; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: sticky; top: 0; z-index: 50; height: auto;
    align-self: start; align-content: flex-start; overflow: visible;
    flex-direction: row; flex-wrap: wrap;
    align-items: center; gap: 10px 16px; padding: 12px 16px;
    border-right: none; border-bottom: 1px solid var(--line);
    background: #FBFAF8; box-shadow: 0 4px 16px rgba(30, 24, 16, .06);
  }
  .brand { flex: 1 1 auto; }
  .brand .name { font-size: 21px; }
  .course-switch { order: 1; width: auto; }
  .course-switch-label { display: none; }
  .course-select { max-width: 190px; }
  /* On phones the sidebar list becomes a horizontal pill tab-bar: the bullet
     dots read as stray list markers here, so hide them and give each item a
     pill background — active turns solid red. */
  .nav { flex-direction: row; flex-wrap: wrap; gap: 8px; width: 100%; order: 3; }
  .nav a {
    padding: 7px 14px; border-radius: 999px; gap: 7px;
    background: #EEEAE3; color: var(--ink-2);
    font-weight: 600; font-size: 13.5px;
  }
  .nav a .dot { display: none; }
  .nav a:hover { background: #E7E2DA; }
  .nav a.active { background: var(--red); color: #fff; }
  .nav a .badge { margin-left: 0; min-width: 18px; height: 18px; font-size: 11px; }
  .nav a.active .badge { background: #fff; color: var(--red); }
  .teaching-card { margin: 0; order: 4; padding: 9px 13px; }
  .teaching-card .label, .teaching-card .course { display: none; }
  .tz-picker { order: 5; margin-top: 0; width: auto; }
  .tz-picker label { display: none; }
  .tz-picker .course-select { max-width: 180px; }
  /* Collapsible top bar: only brand + course + hamburger show until tapped. */
  .nav-toggle { display: inline-flex; order: 2; }
  .sidebar .nav, .sidebar .teaching-card, .sidebar .tz-picker { display: none; }
  .sidebar.open { gap: 12px 16px; }
  .sidebar.open .nav { display: flex; }
  .sidebar.open .teaching-card { display: block; }
  .sidebar.open .tz-picker { display: flex; }
  .main { padding: 24px 18px 50px; }
  .stats { grid-template-columns: 1fr 1fr; }
  h1.display { font-size: 30px; }
  .grid-2 { grid-template-columns: 1fr; }
  .page-head { align-items: flex-start; }
  .dark-card { flex-direction: column; align-items: flex-start; }
  .dark-card .actions { width: 100%; }
  .dark-card .actions .btn, .dark-card .actions a { flex: 1; text-align: center; }
}

/* On phones the students table reflows into stacked cards so it always fits. */
@media (max-width: 640px) {
  /* List rows: let trailing pills/buttons wrap to a second line instead of
     crushing the title into a letter-by-letter column. */
  .rows .row { flex-wrap: wrap; row-gap: 8px; }
  .rows .row .grow { flex: 1 1 60%; min-width: 150px; }
  .rows .row .avatar { align-self: flex-start; }

  .table-wrap { overflow: visible; }
  .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; width: 100%; }
  .tbl thead { display: none; }
  .tbl tr { border: 1px solid var(--line); border-radius: 14px; padding: 6px 6px 10px; margin-bottom: 12px; }
  .tbl tr:hover td { background: transparent; }
  .tbl td { border: none; padding: 8px 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  .tbl td::before { content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 600; flex: none; }
  .tbl td[data-label="Student"] { padding-bottom: 4px; }
  .tbl td[data-label="Student"]::before { display: none; }
  .tbl td[data-label="Student"] .who { min-width: 0; }
}
@media (max-width: 520px) {
  .stats { grid-template-columns: 1fr; }
  h1.display { font-size: 25px; }
  .main { padding: 20px 14px 44px; }
  .chip { width: 40px; height: 40px; font-size: 13.5px; }
  .modal .m-foot { flex-wrap: wrap; }
  .dark-card h2 { font-size: 24px; }
}
