:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --ink: #1f2937;
  --ink-soft: #6b7280;
  --line: #e5e7eb;
  --brand: #4f46e5;
  --brand-soft: #eef2ff;
  --good: #16a34a;
  --good-soft: #ecfdf5;
  --improve: #d97706;
  --improve-soft: #fffbeb;
  --mentor: #2563eb;
  --mentor-soft: #eff6ff;
  --danger: #dc2626;
  --shadow: 0 6px 24px rgba(17, 24, 39, 0.06);
  --radius: 16px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Noto Sans KR", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  overflow-x: hidden;
}
a { color: var(--brand); }

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 16px 26px;
  background: linear-gradient(120deg, #4f46e5, #6366f1);
  color: #fff;
}
.topbar.mentor-bar { background: linear-gradient(120deg, #1d4ed8, #2563eb); }
.brand { display: flex; align-items: center; gap: 12px; }
.logo { font-size: 28px; }
.topbar h1 { margin: 0; font-size: 19px; font-weight: 900; }
.sub { margin: 2px 0 0; font-size: 12.5px; opacity: 0.85; }
.topbar .who { font-size: 13px; opacity: 0.92; }

/* Tabs */
.tabs { display: flex; gap: 6px; }
.tabs button {
  border: 0; background: rgba(255,255,255,0.16); color: #fff;
  padding: 8px 16px; border-radius: 999px; font-size: 13.5px; font-weight: 700;
  cursor: pointer; font-family: inherit;
}
.tabs button.active { background: #fff; color: var(--brand); }
.mentor-bar .tabs button.active { color: var(--mentor); }

/* Layout */
.layout { display: flex; min-height: calc(100vh - 64px); }
.sidebar {
  width: 270px; flex-shrink: 0; background: #fff; border-right: 1px solid var(--line);
  padding: 18px 16px; overflow-y: auto;
}
.sidebar h3 { margin: 0 0 12px; font-size: 14px; color: var(--ink-soft); }
.student-item {
  display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 12px;
  cursor: pointer; margin-bottom: 6px; border: 1px solid transparent;
}
.student-item:hover { background: var(--brand-soft); }
.student-item.active { background: var(--brand-soft); border-color: var(--brand); }
.student-item .avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0;
}
.student-item .meta { flex: 1; min-width: 0; }
.student-item .nm { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.student-item .sm { font-size: 11.5px; color: var(--ink-soft); }
.badge {
  background: var(--improve); color: #fff; font-size: 11px; font-weight: 700;
  border-radius: 999px; padding: 1px 7px; flex-shrink: 0;
}
.add-student { display: flex; gap: 6px; margin-top: 12px; }
.add-student input { flex: 1; border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; font-family: inherit; font-size: 13px; }
.btn {
  border: 0; background: var(--brand); color: #fff; border-radius: 9px;
  padding: 8px 14px; font-weight: 700; cursor: pointer; font-family: inherit; font-size: 13.5px;
}
.btn:disabled { opacity: 0.6; cursor: default; }
.btn.sm { padding: 6px 10px; font-size: 12.5px; }
.btn.good { background: var(--good); }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn.ghost:hover { background: var(--brand-soft); border-color: var(--brand); }

.content { flex: 1; min-width: 0; padding: 22px 26px; overflow-y: auto; max-width: 1080px; }
.center-wrap { max-width: 1080px; margin: 0 auto; padding: 22px 26px; }

/* Summary */
.summary {
  display: flex; flex-wrap: wrap; gap: 18px; align-items: center; justify-content: space-between;
  padding: 20px 24px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.summary-date label { display: block; font-size: 12.5px; color: var(--ink-soft); margin-bottom: 6px; font-weight: 700; }
input[type=date] {
  font-size: 20px; font-weight: 700; border: 1px solid var(--line); border-radius: 10px;
  padding: 7px 11px; font-family: inherit; color: var(--ink);
}
.date-nav { margin-top: 10px; display: flex; gap: 6px; }
.date-nav button { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 6px 12px; cursor: pointer; font-family: inherit; font-size: 14px; color: var(--ink); }
.date-nav button:hover { background: var(--brand-soft); border-color: var(--brand); }
.summary-rate { display: flex; align-items: center; gap: 16px; }
.ring { position: relative; width: 104px; height: 104px; }
.ring svg { transform: rotate(-90deg); width: 104px; height: 104px; }
.ring-bg { fill: none; stroke: var(--line); stroke-width: 12; }
.ring-fg { fill: none; stroke: var(--brand); stroke-width: 12; stroke-linecap: round; stroke-dasharray: 327; stroke-dashoffset: 327; transition: stroke-dashoffset .5s ease, stroke .3s; }
.ring-label { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-num { font-size: 23px; font-weight: 900; }
.ring-cap { font-size: 11px; color: var(--ink-soft); }
.rate-title { margin: 0; font-weight: 700; font-size: 15px; }
.rate-detail { margin: 6px 0 0; font-size: 13px; color: var(--ink-soft); }

/* Cards grid */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; }
.card.full { grid-column: 1 / -1; }
.card h2 { margin: 0 0 14px; font-size: 16px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.muted-tip { font-size: 11.5px; color: var(--ink-soft); font-weight: 400; }
.by { font-size: 11px; background: var(--brand-soft); color: var(--brand); padding: 2px 8px; border-radius: 999px; font-weight: 700; }

/* Uploader */
.upload-empty { border: 2px dashed var(--line); border-radius: 12px; padding: 36px 16px; text-align: center; color: var(--ink-soft); cursor: pointer; transition: .2s; }
.upload-empty:hover, .upload-empty.drag { border-color: var(--brand); background: var(--brand-soft); }
.up-icon { font-size: 30px; }
.upload-empty p { margin: 10px 0 4px; font-weight: 700; color: var(--ink); }
.upload-empty small { font-size: 12px; }
.upload-preview img { width: 100%; border-radius: 12px; display: block; max-height: 460px; object-fit: contain; background: #f9fafb; }
.remove-photo { margin-top: 10px; border: 1px solid var(--line); background: #fff; color: var(--danger); border-radius: 8px; padding: 7px 12px; cursor: pointer; font-family: inherit; font-size: 13px; }
.remove-photo:hover { background: #fef2f2; }
.readonly-photo-empty { text-align: center; color: var(--ink-soft); padding: 40px 0; }

/* Tasks */
.task-add { display: flex; gap: 8px; margin-bottom: 12px; }
#taskInput, .task-add input { flex: 1; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-family: inherit; font-size: 14px; }
.task-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.task-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.task-item.done { background: var(--good-soft); border-color: #bbf7d0; }
.task-item input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--good); cursor: pointer; }
.task-item .txt { flex: 1; font-size: 14px; }
.task-item.done .txt { text-decoration: line-through; color: var(--ink-soft); }
.task-item .del { border: 0; background: transparent; color: var(--ink-soft); cursor: pointer; font-size: 16px; padding: 2px 6px; }
.task-item .del:hover { color: var(--danger); }
.empty-hint { color: var(--ink-soft); font-size: 13px; text-align: center; padding: 8px 0; }

/* Feedback */
.feedback { display: flex; flex-direction: column; gap: 14px; }
.feedback label span { display: block; font-weight: 700; font-size: 13.5px; margin-bottom: 6px; }
.feedback .good span { color: var(--good); }
.feedback .improve span { color: var(--improve); }
textarea { width: 100%; min-height: 84px; border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; font-family: inherit; font-size: 14px; resize: vertical; line-height: 1.6; }
textarea[readonly], input[readonly] { background: #f9fafb; color: var(--ink-soft); }

/* Mentor comment */
.mentor-card { border: 1.5px solid var(--mentor-soft); }
.mentor-box { background: var(--mentor-soft); border: 1px solid #bfdbfe; border-radius: 12px; padding: 14px 16px; line-height: 1.7; font-size: 14px; white-space: pre-wrap; word-break: break-word; min-height: 90px; }
.mentor-card textarea { min-height: 120px; }
.comment-status { font-size: 12.5px; padding: 8px 12px; border-radius: 9px; margin-bottom: 12px; }
.comment-status.scheduled { background: var(--improve-soft); color: var(--improve); }
.comment-status.none { background: #f3f4f6; color: var(--ink-soft); }
.comment-status.posted { background: var(--good-soft); color: var(--good); }
.mentor-actions { margin-top: 12px; display: flex; gap: 8px; align-items: center; }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid #ffffff80; border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Calendar */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.cal-head h2 { margin: 0; font-size: 18px; }
.cal-nav button { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 6px 12px; cursor: pointer; font-family: inherit; font-size: 15px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.cal-dow { text-align: center; font-size: 12px; font-weight: 700; color: var(--ink-soft); padding-bottom: 4px; }
.cal-cell { aspect-ratio: 1 / 1; border: 1px solid var(--line); border-radius: 12px; padding: 8px; position: relative; cursor: pointer; background: #fff; display: flex; flex-direction: column; }
.cal-cell.empty { background: transparent; border: none; cursor: default; }
.cal-cell:hover:not(.empty) { border-color: var(--brand); }
.cal-cell .dnum { font-size: 13px; font-weight: 700; }
.cal-cell.today .dnum { color: var(--brand); }
.cal-cell .cal-rate { margin-top: auto; font-size: 18px; font-weight: 900; }
.cal-cell .cal-bar { height: 6px; border-radius: 999px; background: var(--line); margin-top: 4px; overflow: hidden; }
.cal-cell .cal-bar > i { display: block; height: 100%; border-radius: 999px; }
.cal-dot { position: absolute; top: 8px; right: 8px; font-size: 12px; }
.cal-legend { display: flex; gap: 16px; margin-top: 14px; font-size: 12.5px; color: var(--ink-soft); flex-wrap: wrap; }
.cal-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* 탭 배지 / 알림 버튼 */
.tab-badge { background: #ef4444; color: #fff; border-radius: 999px; font-size: 11px; font-weight: 700; padding: 1px 7px; margin-left: 2px; }
.push-btn { border: 0; background: rgba(255,255,255,0.16); color: #fff; padding: 8px 14px; border-radius: 999px; font-size: 13px; font-weight: 700; cursor: pointer; font-family: inherit; }
.push-btn.on { background: #fff; color: var(--good); }
.push-btn:disabled { opacity: 0.6; cursor: default; }

/* 승인 대기 */
.pending-head { margin-bottom: 14px; }
.pending-head .hint { margin-top: 6px; }
.pending-card { margin-bottom: 14px; }
.pending-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.pending-draft { background: var(--mentor-soft); border: 1px solid #bfdbfe; border-radius: 12px; padding: 14px 16px; line-height: 1.7; font-size: 14px; white-space: pre-wrap; word-break: break-word; min-height: 60px; }
.pending-actions { margin-top: 12px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.approve-flag { margin-left: 4px; }
.spinner-dark { display: inline-block; width: 14px; height: 14px; border: 2px solid #c7d2fe; border-top-color: var(--mentor); border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -2px; }

/* Submit (완료) — 그리드 셀 안에서 세로 배치 */
.submit-card { display: flex; flex-direction: column; }
.submit-row { display: flex; flex-direction: column; align-items: stretch; gap: 14px; height: 100%; }
.submit-row .hint { margin: 6px 0 0; }
.submit-btn { font-size: 16px; padding: 16px 34px; border-radius: 12px; width: 100%; margin-top: auto; }
.submit-btn:disabled { background: var(--good-soft); color: var(--good); cursor: default; }

/* Toast / misc */
.saved-flag { font-size: 12px; color: var(--good); opacity: 0; transition: .3s; }
.saved-flag.show { opacity: 1; }
.link-box { display: flex; gap: 6px; margin-top: 8px; }
.link-box input { flex: 1; min-width: 0; font-size: 12px; border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; font-family: inherit; }
.hidden { display: none !important; }
.hint { color: var(--ink-soft); font-size: 13px; }

/* 화면이 좁아지면 사이드바를 위로 쌓아 가로 넘침 방지 */
@media (max-width: 1024px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--line); }
  .content { max-width: 100%; }
}
/* 본문이 좁아지면 2단 카드를 1단으로 */
@media (max-width: 760px) {
  .grid { grid-template-columns: 1fr; }
  .summary { justify-content: center; text-align: center; }
  .cal-grid { gap: 4px; }
  .cal-cell { padding: 5px; }
  .cal-cell .cal-rate { font-size: 14px; }
}
