:root {
  --bg: #f5f7fa;
  --panel: #ffffff;
  --ink: #0b1220;
  --ink-2: #1f2937;
  --muted: #6b7280;
  --muted-2: #9ca3af;
  --border: #edf0f5;
  --border-2: #e5e9f0;

  --brand: #16a34a;
  --brand-deep: #0f8a3e;
  --brand-soft: #d1f7e0;
  --brand-soft-2: #e8faef;
  --brand-ink: #0f6b34;

  --amber: #f59e0b;
  --amber-soft: #fef3c7;
  --amber-ink: #b45309;

  --blue: #3b82f6;
  --blue-soft: #dbeafe;
  --blue-ink: #1d4ed8;

  --rose: #ec4899;
  --rose-soft: #fce7f3;
  --rose-ink: #9d174d;

  --red: #ef4444;
  --red-soft: #fee2e2;

  --radius: 18px;
  --radius-sm: 12px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 6px 20px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 1px 2px rgba(15, 23, 42, 0.04), 0 12px 32px rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  display: flex;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.01em;
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: 260px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 6px 8px; }
.logo {
  width: 42px; height: 42px; border-radius: 12px;
  background: linear-gradient(135deg, var(--brand), var(--brand-deep));
  color: #fff;
  display: grid; place-items: center;
  font-weight: 700; font-size: 20px;
  box-shadow: 0 6px 14px rgba(22, 163, 74, 0.25);
}
.brand-text h1 { font-size: 16px; margin: 0; font-weight: 700; }
.brand-text p { font-size: 12px; margin: 2px 0 0; color: var(--muted); }

.nav { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px;
  border: none; background: transparent;
  border-radius: 12px;
  font: inherit; font-size: 14px;
  color: var(--muted);
  cursor: pointer; text-align: left;
  font-weight: 500;
  transition: all .15s ease;
}
.nav-item:hover { background: var(--bg); color: var(--ink); }
.nav-item.active {
  background: var(--brand-soft);
  color: var(--brand-ink);
  font-weight: 600;
}
.nav-icon { width: 22px; text-align: center; font-size: 16px; }

.sidebar-footer { margin-top: auto; }
.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 10px;
  background: var(--bg);
  border-radius: 12px;
}
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand-ink);
  display: grid; place-items: center; font-weight: 600; font-size: 13px;
}
.user-name { font-size: 13px; font-weight: 600; }
.user-role { font-size: 11px; color: var(--muted); }

/* ---------- Main ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 28px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.menu-toggle {
  display: none;
  border: none; background: transparent;
  font-size: 22px; cursor: pointer; color: var(--ink);
}
.topbar-title { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.topbar-date { margin-left: auto; color: var(--muted); font-size: 13px; }

.view { padding: 28px; }
.view.hidden { display: none; }

.greeting { margin-bottom: 24px; }
.greeting h1 {
  font-size: 26px; margin: 0 0 4px;
  font-weight: 700; letter-spacing: -0.02em;
}
.greeting p { color: var(--muted); margin: 0; font-size: 14px; }

/* ---------- Summary strip (Natijalar-style) ---------- */
.summary-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 18px;
  box-shadow: var(--shadow-sm);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.summary-item {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  text-align: center;
}
.summary-icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center; font-size: 20px;
}
.summary-icon.green { background: var(--brand-soft); color: var(--brand-ink); }
.summary-icon.amber { background: var(--amber-soft); color: var(--amber-ink); }
.summary-icon.rose  { background: var(--rose-soft); color: var(--rose-ink); }
.summary-icon.blue  { background: var(--blue-soft); color: var(--blue-ink); }
.summary-num { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.summary-lbl { font-size: 12px; color: var(--muted); }

/* ---------- Stat grid ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-bottom: 8px;
}
.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 10px;
  transition: transform .15s ease, box-shadow .15s ease;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-top {
  display: flex; align-items: center; justify-content: space-between;
}
.stat-icon {
  width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center;
  font-size: 18px;
}
.stat-icon.green { background: var(--brand-soft); color: var(--brand-ink); }
.stat-icon.blue  { background: var(--blue-soft); color: var(--blue-ink); }
.stat-icon.amber { background: var(--amber-soft); color: var(--amber-ink); }
.stat-icon.rose  { background: var(--rose-soft); color: var(--rose-ink); }
.stat-value { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
.stat-label { font-size: 13px; color: var(--muted); }
.stat-foot { font-size: 11px; color: var(--muted-2); }

/* ---------- Section heading ---------- */
.section-title {
  font-size: 16px; font-weight: 700;
  margin: 26px 0 12px;
  display: flex; align-items: center; justify-content: space-between;
  letter-spacing: -0.01em;
}
.section-title .muted { color: var(--muted); font-weight: 500; font-size: 13px; }

/* ---------- Toolbar ---------- */
.toolbar {
  display: flex; gap: 10px; flex-wrap: wrap;
  margin-bottom: 16px;
}
.toolbar input, .toolbar select {
  border: 1px solid var(--border-2);
  border-radius: 12px;
  padding: 11px 14px;
  font: inherit; font-size: 14px;
  background: var(--panel);
  color: var(--ink);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.toolbar input { flex: 1; min-width: 180px; }
.toolbar input:focus, .toolbar select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.1);
}

/* ---------- Student card ---------- */
.student-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 14px;
}
.student-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 14px;
}
.student-card:hover {
  transform: translateY(-2px);
  border-color: var(--brand-soft);
  box-shadow: var(--shadow);
}
.student-head { display: flex; align-items: center; gap: 12px; }
.student-avatar {
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand-ink);
  display: grid; place-items: center; font-weight: 700; font-size: 15px;
}
.student-name { font-weight: 600; font-size: 15px; }
.student-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
  white-space: nowrap;
}
.badge.green  { background: var(--brand-soft); color: var(--brand-ink); }
.badge.amber  { background: var(--amber-soft); color: var(--amber-ink); }
.badge.grey   { background: #f1f3f7; color: var(--muted); }

.metric-row { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.metric-row b { color: var(--ink); font-weight: 600; }

/* ---------- Progress ---------- */
.progress {
  height: 8px; background: #eef2f7; border-radius: 999px; overflow: hidden;
}
.progress > span {
  display: block; height: 100%;
  background: var(--brand);
  border-radius: 999px;
  transition: width .4s ease;
}
.progress.sm { height: 6px; }
.progress.amber > span { background: var(--amber); }
.progress.blue > span  { background: var(--blue); }
.progress.rose > span  { background: var(--rose); }

/* ---------- Circular progress ring ---------- */
.ring {
  --p: 0;
  --ring-color: var(--brand);
  width: 56px; height: 56px; border-radius: 50%;
  background:
    conic-gradient(var(--ring-color) calc(var(--p) * 1%), #eef2f7 0);
  display: grid; place-items: center;
  position: relative;
  flex-shrink: 0;
}
.ring::after {
  content: "";
  position: absolute; inset: 5px;
  background: var(--panel);
  border-radius: 50%;
}
.ring-text {
  position: relative;
  z-index: 1;
  font-size: 13px; font-weight: 700;
  color: var(--brand-ink);
}

/* ---------- Detail view ---------- */
.back-btn {
  border: 1px solid var(--border-2);
  background: var(--panel);
  padding: 9px 14px; border-radius: 12px;
  cursor: pointer; font: inherit; font-size: 13px;
  display: inline-flex; align-items: center; gap: 6px;
  margin-bottom: 16px;
  color: var(--ink-2); font-weight: 500;
  transition: all .15s ease;
}
.back-btn:hover { border-color: var(--brand); color: var(--brand-ink); }

.detail-head {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  display: flex; align-items: center; gap: 18px;
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.detail-head .student-avatar {
  width: 60px; height: 60px; font-size: 20px;
}
.detail-head h2 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.detail-head .meta { color: var(--muted); font-size: 13px; margin-top: 4px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.detail-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 18px;
  width: 100%;
}
.detail-stat {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: left;
}
.detail-stat .num { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.detail-stat .lbl { font-size: 12px; color: var(--muted); margin-top: 2px; }
.detail-stat.accent .num { color: var(--brand-ink); }

/* ---------- Module card (matches app "Darslar" cards) ---------- */
.module-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-top: 12px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .15s ease;
}
.module-card:hover { box-shadow: var(--shadow); }
.module-head {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.module-icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center;
  font-size: 20px;
  flex-shrink: 0;
}
.module-icon.green { background: var(--brand-soft); color: var(--brand-ink); }
.module-icon.amber { background: var(--amber-soft); color: var(--amber-ink); }
.module-icon.blue  { background: var(--blue-soft); color: var(--blue-ink); }
.module-icon.rose  { background: var(--rose-soft); color: var(--rose-ink); }

.module-title { font-weight: 600; font-size: 15px; flex: 1; min-width: 180px; }
.module-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

.module-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 14px;
}
.sub-title {
  font-size: 11px; font-weight: 700; color: var(--muted);
  margin-bottom: 10px;
  text-transform: uppercase; letter-spacing: .6px;
}

.lesson-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.lesson-list li {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: 10px;
  font-size: 13px;
}
.lesson-list .check {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--brand); color: #fff;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700;
  flex-shrink: 0;
}
.lesson-list .check.off {
  background: transparent;
  border: 1.5px solid var(--muted-2);
  color: transparent;
}

.quiz-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: 10px;
  margin-bottom: 8px;
  font-size: 13px;
}
.quiz-row:last-child { margin-bottom: 0; }
.quiz-name { display: flex; align-items: center; gap: 8px; }
.quiz-name .dot-icon {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--amber-soft); color: var(--amber-ink);
  display: grid; place-items: center; font-size: 11px;
}
.quiz-score {
  font-weight: 700; color: var(--brand-ink);
  background: var(--brand-soft);
  padding: 3px 9px; border-radius: 999px;
  font-size: 12px;
}

/* ---------- Expandable lesson rows ---------- */
.lessons-block {
  display: flex; flex-direction: column; gap: 8px;
  margin-top: 14px;
}
.lesson-block {
  background: var(--bg);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid transparent;
  transition: border-color .15s ease;
}
.lesson-block.open { border-color: var(--border-2); background: var(--panel); }

.lesson-row {
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px;
  border: none; background: transparent;
  font: inherit; font-size: 13px;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: background .15s ease;
}
.lesson-row:hover:not(:disabled) { background: rgba(22,163,74,0.04); }
.lesson-row:disabled { cursor: default; opacity: 0.65; }
.lesson-row-title { flex: 1; font-weight: 500; }
.lesson-row .chev { color: var(--muted); font-size: 11px; }
.lesson-row .check {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--brand); color: #fff;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700;
  flex-shrink: 0;
}
.lesson-row .check.off {
  background: transparent;
  border: 1.5px solid var(--muted-2);
  color: transparent;
}

.questions-list {
  padding: 6px 14px 14px;
  display: flex; flex-direction: column; gap: 10px;
  border-top: 1px solid var(--border);
}

/* ---------- Question result card ---------- */
.q-card {
  background: var(--bg);
  border: 1px solid var(--border-2);
  border-radius: 12px;
  padding: 12px 14px;
  border-left: 4px solid var(--brand);
}
.q-card.bad { border-left-color: var(--red); background: #fff7f7; }

.q-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.q-mark {
  width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700;
  color: #fff; flex-shrink: 0;
}
.q-mark.ok { background: var(--brand); }
.q-mark.bad { background: var(--red); }
.q-title { flex: 1; min-width: 180px; font-weight: 600; font-size: 13px; }
.q-status {
  font-size: 11px; font-weight: 700;
  padding: 3px 9px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand-ink);
}
.q-card.bad .q-status { background: var(--red-soft); color: #991b1b; }

.q-options { display: flex; flex-direction: column; gap: 6px; }
.q-option {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  background: var(--panel);
  border: 1px solid var(--border-2);
  border-radius: 10px;
  font-size: 13px;
  color: var(--ink-2);
}
.q-option .opt-dot {
  width: 10px; height: 10px; border-radius: 50%;
  border: 1.5px solid var(--muted-2);
  flex-shrink: 0;
}
.q-option.right {
  background: var(--brand-soft-2);
  border-color: var(--brand-soft);
  color: var(--brand-ink);
  font-weight: 600;
}
.q-option.right .opt-dot {
  background: var(--brand); border-color: var(--brand);
}
.q-option.wrong {
  background: var(--red-soft);
  border-color: #fecaca;
  color: #991b1b;
  font-weight: 600;
}
.q-option.wrong .opt-dot {
  background: var(--red); border-color: var(--red);
}
.opt-tag {
  margin-left: auto;
  font-size: 10px; font-weight: 700;
  padding: 3px 8px; border-radius: 999px;
  background: var(--red); color: #fff;
  text-transform: uppercase; letter-spacing: .3px;
}
.opt-tag.right-tag { background: var(--brand); }

/* ---------- Module footer ---------- */
.module-footer {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px;
}
.module-footer.muted-text { color: var(--muted); justify-content: center; font-style: italic; }

/* ---------- Empty state ---------- */
.empty {
  color: var(--muted);
  padding: 40px 20px;
  text-align: center;
  background: var(--panel);
  border: 1px dashed var(--border-2);
  border-radius: var(--radius);
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .menu-toggle { display: inline-block; }
  .module-grid { grid-template-columns: 1fr; }
  .detail-stats { grid-template-columns: repeat(2, 1fr); }
  .summary-card { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 520px) {
  .view { padding: 18px; }
  .topbar { padding: 16px 18px; }
  .topbar-date { display: none; }
  .greeting h1 { font-size: 22px; }
  .stat-value { font-size: 22px; }
  .detail-head { flex-direction: column; align-items: flex-start; }
  .detail-head .student-avatar { width: 52px; height: 52px; }
}
