:root {
  color-scheme: light;
  --ink: #1d2433;
  --muted: #657087;
  --line: #d9dee8;
  --panel: #ffffff;
  --canvas: #f3f5f8;
  --accent: #2d4f8f;
  --accent-2: #9b2f3f;
  --gold: #bd8d2f;
  --blue-soft: #e4eaf6;
  --red-soft: #f7e4e7;
  --shadow: 0 14px 40px rgba(29, 36, 51, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(45, 79, 143, 0.06) 1px, transparent 1px),
    linear-gradient(180deg, rgba(155, 47, 63, 0.05) 1px, transparent 1px),
    var(--canvas);
  background-size: 32px 32px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input {
  font: inherit;
}

button {
  cursor: pointer;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 28px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar h1, .hero h2, .panel h3, .module h3 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: 28px;
  line-height: 1.1;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topbar-meta {
  display: grid;
  gap: 4px;
  text-align: right;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 300px;
  gap: 18px;
  padding: 18px;
}

.sidebar, .rightbar {
  display: grid;
  align-content: start;
  gap: 14px;
  position: sticky;
  top: 96px;
  max-height: calc(100vh - 112px);
  overflow: auto;
}

.sidebar { grid-column: 1; }
.content { grid-column: 2; }
.rightbar { grid-column: 3; }

.panel, .module, .practice, .hero {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel { padding: 16px; }
.panel.tight { padding: 12px; }

.search-row input { width: 100%; }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.filters button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 9px 11px;
  font-weight: 700;
}

.filters button.active {
  border-color: var(--accent);
  background: var(--blue-soft);
}

.concepts-nav-btn {
  width: 100%;
  border: 1px solid var(--gold);
  border-radius: 8px;
  background: #fdf6e6;
  color: #6b4f14;
  padding: 12px;
  font-weight: 800;
  text-align: left;
}

.concepts-nav-btn.active {
  background: var(--gold);
  color: #fff;
}

.unit-list {
  display: grid;
  gap: 10px;
}

.unit-card {
  display: grid;
  gap: 7px;
  width: 100%;
  padding: 14px;
  text-align: left;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.unit-card.active {
  border-color: var(--accent);
  box-shadow: inset 4px 0 0 var(--accent);
}

.unit-card .group-tag {
  color: var(--accent-2);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.unit-card small {
  color: var(--muted);
  line-height: 1.35;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badges span {
  border-radius: 999px;
  background: #eef1f5;
  color: #394255;
  padding: 3px 7px;
  font-size: 11px;
  font-weight: 800;
}

.content {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.hero {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  min-height: 140px;
  padding: 26px;
  background:
    linear-gradient(135deg, rgba(45, 79, 143, 0.12), rgba(189, 141, 47, 0.12)),
    #fff;
}

.hero h2 {
  font-size: 30px;
  line-height: 1.15;
  margin-bottom: 10px;
}

.hero p:last-child {
  max-width: 760px;
  margin: 0;
  color: #465064;
  font-size: 15px;
  line-height: 1.55;
}

.studied-btn {
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: #fff;
  color: var(--accent);
  padding: 12px 16px;
  font-weight: 800;
  white-space: nowrap;
}

.studied-btn.done {
  background: var(--accent);
  color: #fff;
}

.study-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.module, .practice {
  padding: 18px;
}

.module-head, .section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.module-head span {
  display: grid;
  place-items: center;
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
  font-weight: 900;
  font-size: 12px;
}

.clean-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.clean-list li {
  padding: 10px 0;
  border-top: 1px solid var(--line);
  line-height: 1.5;
}

.warning li::before {
  content: "\2713";
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--blue-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 900;
}

.prose p {
  margin: 0 0 12px;
  color: #3f4859;
  line-height: 1.7;
}

.calc-list {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.calc-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfe;
}

.calc-card h4 {
  margin: 0 0 6px;
  font-size: 13px;
  color: var(--accent);
}

.calc-card p {
  margin: 0;
  font-size: 13px;
  color: #465064;
  line-height: 1.5;
}

.section-title h3, .section-title span {
  margin: 0;
}

.section-title span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.progress-panel {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 14px;
  align-items: center;
}

.ring {
  display: grid;
  place-items: center;
  width: 88px;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, #fff 0 58%, transparent 59%),
    conic-gradient(var(--accent) var(--progress, 0deg), #e7ebf1 0);
  color: var(--ink);
  font-weight: 900;
  font-size: 20px;
}

.stats-list {
  display: grid;
  gap: 10px;
  margin: 0;
}

.stats-list div {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 10px;
  align-items: baseline;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.stats-list dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.stats-list dd {
  margin: 0;
  font-weight: 800;
}

.small, .empty {
  color: var(--muted);
  line-height: 1.55;
  margin: 0;
}

.concepts-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.concept-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 16px;
  display: grid;
  gap: 8px;
}

.concept-card .num {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--gold);
  color: #fff;
  font-weight: 900;
  font-size: 13px;
}

.concept-card h4 {
  margin: 4px 0 0;
  font-size: 17px;
}

.concept-card .guiding-q {
  color: var(--accent-2);
  font-weight: 700;
  font-size: 13px;
  line-height: 1.4;
}

.concept-card p {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  color: #3f4859;
}

.concept-card .aok-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.concept-card .aok-tags span {
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--accent);
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 800;
}

@media (max-width: 1180px) {
  .layout {
    grid-template-columns: 260px minmax(0, 1fr);
  }
  .rightbar {
    grid-column: 1 / -1;
    position: static;
    max-height: none;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .concepts-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 780px) {
  .topbar, .hero {
    align-items: stretch;
    grid-template-columns: 1fr;
  }
  .topbar { position: static; }
  .topbar-meta { text-align: left; }
  .layout, .study-grid, .rightbar, .calc-list, .concepts-grid {
    grid-template-columns: 1fr;
  }
  .sidebar, .content, .rightbar {
    grid-column: 1;
  }
  .sidebar, .rightbar {
    position: static;
    max-height: none;
  }
  .hero h2 { font-size: 24px; }
}
