* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0; background: #0d1117; color: #e6edf3;
  font-family: "Pretendard", -apple-system, "Noto Sans KR", sans-serif;
  min-height: 100vh;
}
.view { min-height: 100vh; }
.login-box {
  max-width: 420px; margin: 12vh auto; background: #161b22; border: 1px solid #2d3748;
  border-radius: 20px; padding: 40px 34px; text-align: center;
}
.login-box h1 { margin: 0 0 6px; font-size: 30px; }
.sub { color: #8b949e; font-size: 14px; margin: 0 0 24px; }
.demo-banner {
  background: #3a2f0e; border: 1px solid #d29922; color: #ffd479; border-radius: 10px;
  padding: 12px; font-size: 13px; margin-bottom: 16px; line-height: 1.6;
}
.demo-row { display: flex; gap: 8px; margin-top: 10px; }
.demo-row .btn { flex: 1; }
.hint { color: #8b949e; font-size: 12px; margin-top: 16px; line-height: 1.7; }
.btn {
  background: #212b3d; border: 1px solid #2d3748; color: #e6edf3; border-radius: 10px;
  padding: 11px 20px; font-size: 14px; font-weight: 700; cursor: pointer;
}
.btn.primary { background: #e0509a; border-color: #e0509a; }
.btn.ghost { background: transparent; }
.btn.small { padding: 8px 14px; font-size: 12px; }
.btn.big { width: 100%; padding: 15px; font-size: 16px; }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: default; }
.app-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 22px; background: #161b22; border-bottom: 1px solid #2d3748;
  position: sticky; top: 0; z-index: 10;
}
.app-head h1 { margin: 0; font-size: 19px; }
.badge {
  font-size: 11px; background: #e0509a; color: #fff; border-radius: 20px;
  padding: 3px 10px; vertical-align: middle; margin-left: 6px;
}
.badge.student { background: #2f81f7; }
.head-right { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.tabs { display: flex; gap: 8px; padding: 12px 22px 0; flex-wrap: wrap; max-width: 1100px; margin: 0 auto; }
.tab {
  background: #161b22; border: 1px solid #2d3748; border-bottom: none; color: #8b949e;
  border-radius: 12px 12px 0 0; padding: 11px 18px; font-size: 14px; font-weight: 700; cursor: pointer;
}
.tab.active { background: #1c2330; color: #fff; box-shadow: inset 0 3px 0 #e0509a; }
main { max-width: 1100px; margin: 0 auto; padding: 0 22px 40px; }
.tpanel {
  display: none; background: #1c2330; border: 1px solid #2d3748;
  border-radius: 0 0 16px 16px; padding: 20px;
}
.tpanel.active { display: block; }
.tpanel h2 { font-size: 16px; margin: 0 0 12px; }
.tpanel h2:not(:first-child) { margin-top: 26px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.row input[type="text"], .row input[type="url"], .row input[type="number"], .row input[type="date"], .row select {
  background: #0d1117; border: 1px solid #2d3748; color: #e6edf3;
  border-radius: 10px; padding: 10px 12px; font-size: 13px;
}
.row input[type="file"] { font-size: 12px; color: #8b949e; max-width: 220px; }
.chk { font-size: 13px; display: flex; align-items: center; gap: 6px; }
.list { list-style: none; margin: 0; padding: 0; }
.list li {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  background: #0d1117; border: 1px solid #2d3748; border-radius: 10px;
  padding: 12px 14px; margin-bottom: 8px; font-size: 14px;
}
.list .meta { color: #8b949e; font-size: 12px; }
.week-group { margin-bottom: 18px; }
.week-title {
  font-size: 14px; font-weight: 800; color: #ffb3d9; margin-bottom: 8px;
  border-left: 4px solid #e0509a; padding-left: 10px;
}
.mat-item {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  background: #0d1117; border: 1px solid #2d3748; border-radius: 10px;
  padding: 12px 14px; margin-bottom: 8px; font-size: 14px;
}
.mat-item a { color: #58a6ff; text-decoration: none; font-weight: 700; }
.assign-card {
  background: #0d1117; border: 1px solid #2d3748; border-radius: 12px;
  padding: 16px; margin-bottom: 12px;
}
.assign-card h3 { margin: 0 0 6px; font-size: 15px; }
.assign-card .meta { color: #8b949e; font-size: 12px; margin-bottom: 10px; }
.sub-row {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 9px 4px; border-top: 1px solid #1c2330; font-size: 13px; flex-wrap: wrap;
}
.sub-row a { color: #58a6ff; }
.sub-row .no { color: #8b949e; }
.pill {
  font-size: 11px; border-radius: 20px; padding: 3px 10px; font-weight: 700;
}
.pill.done { background: #0e2e1a; color: #3fb950; }
.pill.wait { background: #3a2f0e; color: #d29922; }
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-box { background: #161b22; border-radius: 16px; padding: 20px; width: 100%; max-width: 480px; }
.modal-box.wide { max-width: 900px; height: 85vh; display: flex; flex-direction: column; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
#pdfFrame { flex: 1; width: 100%; border: 1px solid #2d3748; border-radius: 8px; background: #fff; }

/* ===== LMS (출석·진도·퀴즈·수료증) ===== */
.tpanel input[type="text"], .tpanel input[type="url"], .tpanel input[type="number"],
.tpanel input[type="date"], .tpanel input[type="password"], .tpanel select, .tpanel textarea {
  background: #0d1117; border: 1px solid #2d3748; color: #e6edf3;
  border-radius: 10px; padding: 10px 12px; font-size: 13px; font-family: inherit;
}
.tpanel textarea { line-height: 1.6; resize: vertical; }
.stat-cards { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.stat-card {
  background: #0d1117; border: 1px solid #2d3748; border-radius: 12px;
  padding: 14px 16px; min-width: 150px; flex: 1;
}
.stat-num { font-size: 26px; font-weight: 800; color: #ffb3d9; }
.stat-label { font-size: 12px; color: #8b949e; margin: 2px 0 8px; }
.stat-card .meta { color: #8b949e; font-size: 12px; margin-top: 6px; }
.bar { background: #212b3d; border-radius: 8px; height: 14px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, #e0509a, #9a5fe0); border-radius: 8px; }
.bar.mini { height: 10px; margin-bottom: 4px; }
.table-wrap { overflow-x: auto; }
.lms-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 560px; }
.lms-table th, .lms-table td { border: 1px solid #2d3748; padding: 8px 10px; text-align: center; }
.lms-table th { background: #161b22; color: #ffb3d9; }
.att-btns { display: flex; gap: 4px; justify-content: center; flex-wrap: wrap; }
.att-btns .btn.small { padding: 6px 10px; }
.quiz-q {
  background: #0d1117; border: 1px solid #2d3748; border-radius: 12px;
  padding: 14px; margin-bottom: 10px;
}
.quiz-q .hint { margin: 6px 0 0; }
.choice-row { display: flex; gap: 8px; align-items: center; margin-top: 8px; font-size: 14px; }
.choice-row input[type="text"] { flex: 1; }
@media (max-width: 640px) {
  .stat-card { min-width: 44%; }
  .lms-table { font-size: 12px; min-width: 520px; }
}

/* ===== AI (Gemini BYOK) ===== */
.chat-log {
  background: #0d1117; border: 1px solid #2d3748; border-radius: 12px;
  padding: 14px; margin-bottom: 10px; max-height: 320px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 8px;
}
.chat-bubble {
  max-width: 85%; padding: 10px 14px; border-radius: 14px;
  font-size: 13px; line-height: 1.7; white-space: pre-wrap; word-break: break-word;
}
.chat-bubble.user { align-self: flex-end; background: #e0509a; color: #fff; border-bottom-right-radius: 4px; }
.chat-bubble.ai { align-self: flex-start; background: #212b3d; color: #e6edf3; border-bottom-left-radius: 4px; }
.chat-bubble.loading { opacity: 0.6; }
.ai-fb {
  background: #141b2e; border: 1px solid #2f4a7a; border-radius: 10px;
  padding: 10px 12px; margin-top: 8px; font-size: 13px;
}
.ai-fb b { color: #9ecbff; }
.ai-fb p { margin: 6px 0 0; line-height: 1.7; white-space: pre-wrap; }
#aiFbText { font-family: inherit; line-height: 1.7; }
@media (max-width: 640px) {
  .chat-bubble { max-width: 92%; }
}
