
:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --panel-soft: #f8fbff;
  --text: #132238;
  --muted: #5f728c;
  --line: #d9e3f0;
  --brand: #1366d6;
  --brand-dark: #0f4fa8;
  --accent: #7a4bff;
  --success: #1d8f5c;
  --warn: #d67a10;
  --danger: #c74040;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 12px 30px rgba(20, 53, 95, 0.08);
  --shadow-soft: 0 6px 16px rgba(20, 53, 95, 0.06);
  --maxw: 1180px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(19, 102, 214, 0.12), transparent 28%),
    radial-gradient(circle at top right, rgba(122, 75, 255, 0.10), transparent 24%),
    var(--bg);
  line-height: 1.65;
}

a { color: var(--brand-dark); text-decoration: none; }
a:hover { text-decoration: none; }
img { max-width: 100%; display: block; }

.container {
  width: min(100% - 2rem, var(--maxw));
  margin-inline: auto;
}

.site-shell {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(10px);
  background: rgba(244, 247, 251, 0.88);
  border-bottom: 1px solid rgba(217, 227, 240, 0.9);
}

.topbar {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  min-height: 74px;
  padding-block: 0.85rem;
}

.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.9rem;
  color: var(--text);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  box-shadow: var(--shadow-soft);
  letter-spacing: 0.04em;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
}

.brand-copy strong { font-size: 1.05rem; }
.brand-copy small { color: var(--muted); }

.main-nav {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.main-nav a {
  padding: 0.62rem 0.9rem;
  border-radius: 999px;
  font-weight: 600;
  color: var(--muted);
  transition: 0.2s ease;
}

.main-nav a:hover,
.main-nav a.active {
  color: var(--brand-dark);
  background: rgba(19, 102, 214, 0.10);
}

.page-shell {
  padding-block: 1.5rem 2.5rem;
  min-height: calc(100vh - 150px);
}

.section-card,
.hero-card,
.mini-card,
.meta-card,
.info-card,
.po-card,
.unit-card,
.lecture-item a,
.flash {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}

.hero-card,
.section-card,
.unit-card {
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

.section-card.compact-header { padding: 1.35rem 1.5rem; }

.hero-card {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: 1.4rem;
  background:
    linear-gradient(135deg, rgba(19, 102, 214, 0.08), transparent 48%),
    linear-gradient(180deg, #ffffff, #fbfdff);
}

.hero-panel {
  border-radius: calc(var(--radius) - 4px);
  padding: 1.25rem;
  background: linear-gradient(180deg, rgba(122, 75, 255, 0.08), rgba(19, 102, 214, 0.04));
  border: 1px solid rgba(122, 75, 255, 0.12);
}

h1, h2, h3, h4 {
  margin: 0 0 0.8rem;
  line-height: 1.25;
  color: var(--text);
}

h1 { font-size: clamp(1.8rem, 3vw, 2.5rem); }
h2 { font-size: clamp(1.25rem, 2vw, 1.65rem); }
h3 { font-size: 1.1rem; }
p { margin: 0 0 0.9rem; color: var(--text); }
.hero-lead, .section-note, .hero-panel p, .info-card p, .po-card p, small { color: var(--muted); }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--brand-dark);
  margin-bottom: 0.7rem;
}

.meta-pills, .legend-row {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin: 0.9rem 0 1.15rem;
}

.pill, .legend-chip, .card-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.78rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 700;
  border: 1px solid var(--line);
  background: var(--panel-soft);
}

.card-tag {
  width: fit-content;
  color: var(--brand-dark);
  background: rgba(19, 102, 214, 0.08);
  margin-bottom: 0.9rem;
}

.hero-actions, .form-actions, .lecture-actions, .pager-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.78rem 1.1rem;
  border-radius: 12px;
  border: 1px solid transparent;
  font-weight: 700;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  cursor: pointer;
}

.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-soft); }
.btn.primary {
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
}
.btn.secondary {
  color: var(--brand-dark);
  background: rgba(19, 102, 214, 0.08);
  border-color: rgba(19, 102, 214, 0.14);
}
.btn.ghost {
  color: var(--text);
  background: #fff;
  border-color: var(--line);
}

.info-grid,
.card-grid,
.po-grid,
.lecture-meta-grid {
  display: grid;
  gap: 1rem;
}

.three-up { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.two-up { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.po-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.lecture-meta-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.info-card,
.mini-card,
.po-card,
.meta-card {
  border-radius: 16px;
  padding: 1.15rem;
}

.po-card h3 { margin-bottom: 0.55rem; color: var(--brand-dark); }
.unit-overview-card .unit-kicker,
.lecture-number,
.edit-label {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--brand-dark);
}

.clean-list {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--text);
}
.clean-list.tight li + li { margin-top: 0.45rem; }

.section-head {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.search-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem;
  margin-top: 0.8rem;
}

.search-bar,
form input[type="text"],
form input[type="password"],
form input[type="number"],
form textarea,
.score-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.82rem 0.95rem;
  font: inherit;
  color: var(--text);
  background: #fff;
}

.search-bar { max-width: 620px; }
.search-count { color: var(--muted); font-weight: 600; }

.unit-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: transparent;
  border: 0;
  padding: 0;
  margin-bottom: 1rem;
  cursor: pointer;
  color: inherit;
  text-align: left;
}

.unit-toggle span:first-child {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.unit-toggle strong { font-size: 1.12rem; }
.unit-toggle small, .unit-meta { color: var(--muted); font-weight: 600; }

.lecture-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.8rem;
}

.lecture-item a {
  border-radius: 16px;
  padding: 0.95rem 1rem;
  display: flex;
  gap: 0.95rem;
  align-items: flex-start;
  justify-content: space-between;
}

.lecture-copy { display: flex; flex-direction: column; gap: 0.18rem; flex: 1; }
.lecture-copy small { line-height: 1.5; }
.lecture-number {
  min-width: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(19, 102, 214, 0.08);
  border-radius: 12px;
  padding: 0.45rem 0.55rem;
}

.breadcrumb {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin-bottom: 0.9rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.lecture-hero {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  justify-content: space-between;
}

.lecture-body { padding-top: 1.2rem; }
.notes-content {
  font-size: 1.02rem;
  color: var(--text);
}

.notes-content .lecture {
  margin: 0;
  padding: 0;
  box-shadow: none;
  border: 0;
  background: transparent;
  max-width: none;
}

.notes-content hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 1.35rem 0;
}

.notes-content .grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}

.notes-content .card {
  grid-column: span 12;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1rem;
  box-shadow: var(--shadow-soft);
}

.notes-content .span4 { grid-column: span 4; }
.notes-content .span6 { grid-column: span 6; }
.notes-content .span8 { grid-column: span 8; }
.notes-content .span12 { grid-column: span 12; }

.callout {
  border-radius: 16px;
  padding: 1rem 1.05rem;
  border: 1px solid var(--line);
  margin: 1rem 0;
  background: linear-gradient(180deg, rgba(19, 102, 214, 0.06), rgba(255, 255, 255, 0.92));
}

.callout.info { background: linear-gradient(180deg, rgba(19, 102, 214, 0.08), rgba(255,255,255,0.94)); }
.callout.warn { background: linear-gradient(180deg, rgba(214, 122, 16, 0.10), rgba(255,255,255,0.94)); }
.callout.outcomes { background: linear-gradient(180deg, rgba(29, 143, 92, 0.10), rgba(255,255,255,0.94)); }

.notes-content figure {
  margin: 1rem 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 0.9rem;
  background: #fff;
  overflow: auto;
}

.notes-content figcaption {
  color: var(--muted);
  font-size: 0.95rem;
  margin-top: 0.75rem;
}

.notes-content table,
.matrix-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.96rem;
}

.notes-content th,
.notes-content td,
.matrix-table th,
.matrix-table td {
  border: 1px solid var(--line);
  padding: 0.7rem 0.8rem;
  vertical-align: top;
}

.notes-content th,
.matrix-table th {
  background: #edf4fd;
  text-align: left;
}

.notes-content pre {
  background: #0f172a;
  color: #e2e8f0;
  padding: 1rem;
  border-radius: 16px;
  overflow-x: auto;
  font-size: 0.94rem;
}

.notes-content code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.94em;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
}

.matrix-table-wrap { padding: 0; }
.matrix-table th:first-child,
.matrix-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #f6f9ff;
}

.matrix-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
}

.matrix-table td {
  text-align: center;
  font-weight: 700;
  min-width: 82px;
}

.level-0 { background: #f8fafc; color: #6b7a8e; }
.level-1 { background: #eef5ff; color: var(--brand-dark); }
.level-2 { background: #dbeafe; color: #1248a2; }
.level-3 { background: #bfdcff; color: #083679; }

.score-input {
  width: 72px;
  text-align: center;
  padding-inline: 0.4rem;
  margin: 0 auto;
}

form label {
  display: block;
  font-weight: 700;
  margin: 0.8rem 0 0.35rem;
}

form textarea { min-height: 150px; resize: vertical; }

.flash-stack { display: grid; gap: 0.7rem; margin-bottom: 1rem; }
.flash {
  border-radius: 14px;
  padding: 0.9rem 1rem;
  font-weight: 600;
}
.flash.success { color: #0e5a36; background: #e8f8ef; border-color: #bfe6cf; }
.flash.error { color: #8d2d2d; background: #fdecec; border-color: #f4c5c5; }

.empty-state { color: var(--muted); }
.hidden { display: none !important; }

.site-footer {
  border-top: 1px solid var(--line);
  padding: 1.15rem 0 2rem;
  background: rgba(255, 255, 255, 0.55);
}

.footer-grid {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.footer-grid p, .footer-meta { color: var(--muted); margin: 0; }
.footer-meta { display: flex; gap: 0.75rem; flex-wrap: wrap; font-weight: 600; }

@media (max-width: 960px) {
  .hero-card,
  .lecture-hero,
  .three-up,
  .two-up,
  .po-grid,
  .lecture-meta-grid {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .hero-card { grid-template-columns: 1fr; }
  .section-head, .lecture-hero { flex-direction: column; }
  .notes-content .span4,
  .notes-content .span6,
  .notes-content .span8 { grid-column: span 12; }
}

@media (max-width: 720px) {
  .topbar { align-items: flex-start; }
  .main-nav { width: 100%; }
  .main-nav a { padding-inline: 0.75rem; }
  .hero-card, .section-card, .unit-card { padding: 1.1rem; }
  .lecture-item a { flex-direction: column; align-items: stretch; }
  .lecture-number { width: fit-content; }
  .notes-content figure { padding: 0.6rem; }
}


.admin-form label {
  display: block;
  font-weight: 700;
  margin-bottom: 0.42rem;
  color: var(--text);
}

.admin-form input,
.admin-form textarea,
.admin-form select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.82rem 0.9rem;
  background: #fff;
  color: var(--text);
  font: inherit;
  margin-bottom: 1rem;
}

.admin-form textarea {
  resize: vertical;
  min-height: 110px;
}

.admin-form input:focus,
.admin-form textarea:focus,
.admin-form select:focus {
  outline: none;
  border-color: rgba(19, 102, 214, 0.65);
  box-shadow: 0 0 0 4px rgba(19, 102, 214, 0.10);
}

.form-grid {
  display: grid;
  gap: 1rem;
}

.form-grid.two-up { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.three-up { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stacked-form { max-width: 100%; }
.stack-grid { display: grid; gap: 1rem; }
.inline-fields {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr) 110px;
  gap: 1rem;
  align-items: end;
}
.field-sm, .field-lg, .field-meta { min-width: 0; }
.readonly-pill {
  min-height: 48px;
  border-radius: 12px;
  border: 1px dashed var(--line);
  display: grid;
  place-items: center;
  font-weight: 700;
  background: var(--panel-soft);
}
.muted-note {
  color: var(--muted);
  font-size: 0.92rem;
}
.admin-list-card { padding: 1rem 1rem 0.35rem; border-radius: 16px; }
.split-actions { justify-content: space-between; }
.btn.danger {
  background: rgba(199, 64, 64, 0.08);
  color: var(--danger);
  border-color: rgba(199, 64, 64, 0.2);
}
.btn.ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--brand-dark);
}
.admin-stats-grid .stat-card h2 {
  font-size: 2rem;
  margin-bottom: 0.25rem;
}
.login-card-wrap { max-width: 520px; margin-inline: auto; }
.login-form { display: grid; }
.empty-admin-state {
  padding: 1rem;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 14px;
}

@media (max-width: 860px) {
  .form-grid.two-up,
  .form-grid.three-up,
  .inline-fields {
    grid-template-columns: 1fr;
  }
  .split-actions { gap: 1rem; flex-direction: column; align-items: stretch; }
}
