/* 멘토링 관리 UI - 단색 디자인, 8px 그리드, 모바일 우선 */
:root {
  --navy: #1a2332;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --green: #15803d;
  --amber: #b45309;
  --red: #b91c1c;
  --bg: #f5f7fa;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #1a2332;
  --muted: #475569;
  --radius: 8px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.6; color: var(--text); background: var(--bg); }
[hidden] { display: none !important; }
h1, h2, h3, h4 { line-height: 1.35; margin: 0 0 8px; }
h1 { font-size: 24px; } h2 { font-size: 20px; } h3 { font-size: 17px; } h4 { font-size: 16px; }
p { margin: 0 0 8px; }
a { color: var(--blue-dark); }
code { background: #eef2f7; padding: 1px 6px; border-radius: 4px; font-size: 0.92em; }
.muted { color: var(--muted); }
.small-text { font-size: 14px; }
.nowrap { white-space: nowrap; }
.pre-wrap { white-space: pre-wrap; word-break: break-word; }

:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 4px; }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--navy); color: #fff; padding: 8px 16px; z-index: 100; }
.skip-link:focus { left: 8px; top: 8px; }

/* ---------- top bar and nav ---------- */
.topbar { background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 20; }
.topbar-inner { max-width: 1200px; margin: 0 auto; padding: 0 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 0 24px; }
.brand { color: #fff; text-decoration: none; font-weight: 700; font-size: 18px; padding: 12px 0; }
.nav { display: flex; gap: 4px; overflow-x: auto; order: 3; width: 100%; scrollbar-width: thin; }
.nav a { color: #cbd5e1; text-decoration: none; padding: 8px 16px; white-space: nowrap; border-bottom: 3px solid transparent; min-height: 44px; display: inline-flex; align-items: center; }
.nav a:hover { color: #fff; }
.nav a[aria-current="page"] { color: #fff; border-bottom-color: #60a5fa; font-weight: 600; }
.user-box { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.user-name { font-size: 14px; color: #cbd5e1; }
@media (min-width: 760px) {
  .nav { order: 0; width: auto; }
  .topbar-inner { flex-wrap: nowrap; }
  .nav a { min-height: 56px; }
}

.view { max-width: 1200px; margin: 0 auto; padding: 24px 16px 80px; outline: none; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-bottom: 16px; }
.page-head h1 { margin: 0; }
.page-head .spacer { flex: 1; }
.back-link { display: inline-block; margin-bottom: 8px; }

/* ---------- buttons and forms ---------- */
.btn { font: inherit; font-size: 15px; min-height: 44px; padding: 8px 16px; border-radius: var(--radius); border: 1px solid #94a3b8; background: var(--surface); color: var(--text); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn:hover { background: #eef2f7; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-dark); }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.danger:hover { background: #991b1b; }
.btn.outline-danger { color: var(--red); border-color: #fca5a5; }
.btn.small { min-height: 36px; padding: 4px 12px; font-size: 14px; }
.btn.block { width: 100%; }
.btn.ghost-light { background: transparent; color: #e2e8f0; border-color: #64748b; }
.btn.ghost-light:hover { background: #2a3547; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.field { margin-bottom: 16px; }
.field > label, .field > .label { display: block; font-weight: 600; margin-bottom: 4px; font-size: 15px; }
.field .hint { font-size: 14px; color: var(--muted); margin-top: 4px; }
input[type=text], input[type=password], input[type=email], input[type=tel], input[type=url], input[type=number], input[type=date], input[type=time], select, textarea {
  font: inherit; width: 100%; min-height: 44px; padding: 8px 12px; border: 1px solid #94a3b8; border-radius: var(--radius); background: #fff; color: var(--text);
}
textarea { min-height: 96px; resize: vertical; }
input.invalid, select.invalid, textarea.invalid { border-color: var(--red); border-width: 2px; }
.field-error { color: var(--red); font-size: 14px; margin: 4px 0 0; font-weight: 600; }
.check { display: flex; align-items: center; gap: 8px; min-height: 36px; }
.check input { width: 20px; height: 20px; accent-color: var(--blue); }
.grid-2 { display: grid; gap: 0 16px; grid-template-columns: 1fr; }
.grid-3 { display: grid; gap: 0 16px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid-2 { grid-template-columns: 1fr 1fr; } .grid-3 { grid-template-columns: 1fr 1fr 1fr; } }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); margin: 0 0 16px; padding: 8px 16px 16px; }
legend { font-weight: 600; padding: 0 8px; }

/* ---------- cards and chips ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.card h2, .card h3 { margin-bottom: 12px; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.card-head h2, .card-head h3 { margin: 0; flex: 1; }
.stat-grid { display: grid; gap: 16px; grid-template-columns: repeat(2, 1fr); margin-bottom: 24px; }
@media (min-width: 760px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.stat .label { font-size: 14px; color: var(--muted); }
.stat .value { font-size: 28px; font-weight: 700; line-height: 1.3; }
.stat .value small { font-size: 16px; font-weight: 500; color: var(--muted); }
.stat .note { font-size: 13px; color: var(--muted); margin-top: 4px; }

.chip { display: inline-flex; align-items: center; gap: 4px; padding: 0 8px; border-radius: 999px; font-size: 13px; font-weight: 600; line-height: 24px; white-space: nowrap; background: #e2e8f0; color: #334155; }
.chip.ok { background: #dcfce7; color: #166534; }
.chip.warn { background: #fef3c7; color: #92400e; }
.chip.bad { background: #fee2e2; color: #991b1b; }
.chip.info { background: #dbeafe; color: #1e40af; }
.chip.navy { background: var(--navy); color: #fff; }

.notice { border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px; border: 1px solid var(--border); background: #eef2f7; }
.notice.warn { background: #fef3c7; border-color: #f59e0b; color: #78350f; }
.notice.bad { background: #fee2e2; border-color: #f87171; color: #7f1d1d; }
.notice.ok { background: #dcfce7; border-color: #4ade80; color: #14532d; }

.empty { text-align: center; padding: 32px 16px; color: var(--muted); background: var(--surface); border: 1px dashed #94a3b8; border-radius: var(--radius); margin-bottom: 16px; }
.empty h3 { color: var(--text); }
.loading { padding: 32px; text-align: center; color: var(--muted); }
.steps { text-align: left; max-width: 480px; margin: 16px auto; padding-left: 24px; }
.steps li { margin-bottom: 4px; }

/* ---------- mentee grid ---------- */
.mentee-grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 700px) { .mentee-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1040px) { .mentee-grid { grid-template-columns: 1fr 1fr 1fr; } }
.mentee-card { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.mentee-card h3 { margin: 0; }
.mentee-card h3 a { color: var(--navy); text-decoration: none; }
.mentee-card h3 a::after { content: ""; position: absolute; inset: 0; }
.mentee-card:hover { border-color: var(--blue); }
.mentee-card .actions { position: relative; z-index: 2; display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }
.mentee-card .meta { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; font-size: 14px; }
.progress { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--blue); }
.progress.full > span { background: var(--green); }
.url-box { display: flex; gap: 8px; }
.url-box input { flex: 1; }

/* ---------- lists and tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); margin-bottom: 16px; }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { padding: 8px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { background: #f1f5f9; font-weight: 600; font-size: 14px; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.center, th.center { text-align: center; }
tr.hl td { background: #dcfce7; }
.list { list-style: none; margin: 0 0 16px; padding: 0; }
.list > li { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 8px; display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.list .grow { flex: 1; min-width: 200px; }
.list .title { font-weight: 600; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; }

dl.kv { display: grid; grid-template-columns: 1fr; gap: 0; margin: 0; }
dl.kv dt { font-size: 14px; color: var(--muted); margin-top: 8px; }
dl.kv dd { margin: 0; word-break: break-word; }
@media (min-width: 640px) {
  dl.kv { grid-template-columns: 180px 1fr; }
  dl.kv dt { margin: 0; padding: 8px 0; border-bottom: 1px solid var(--border); }
  dl.kv dd { padding: 8px 0; border-bottom: 1px solid var(--border); }
}

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 2px solid var(--border); margin-bottom: 16px; scrollbar-width: thin; }
.tabs button { font: inherit; font-size: 15px; background: none; border: 0; border-bottom: 3px solid transparent; margin-bottom: -2px; padding: 8px 16px; min-height: 44px; cursor: pointer; white-space: nowrap; color: var(--muted); }
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected="true"] { color: var(--navy); border-bottom-color: var(--blue); font-weight: 700; }

/* ---------- survey answers ---------- */
.qa { margin-bottom: 16px; }
.qa .q { font-size: 14px; color: var(--muted); }
.qa .a { white-space: pre-wrap; word-break: break-word; }

/* ---------- charts ---------- */
.bars { display: grid; gap: 16px; }
.bar-row .bar-label { font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.bar-line { display: grid; grid-template-columns: 80px 1fr 56px; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 2px; }
.bar-track { height: 12px; background: #e2e8f0; border-radius: 6px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--navy); }
.bar-fill.self { background: #60a5fa; }
.bar-fill.mentor { background: var(--navy); }
.bar-fill.ai { background: #a16207; }
.bar-fill.total { background: var(--blue); }
.bar-val { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- dialog ---------- */
dialog { border: 0; border-radius: 12px; padding: 0; width: min(720px, calc(100vw - 16px)); max-height: calc(100vh - 16px); color: var(--text); font-family: var(--font); }
dialog::backdrop { background: rgba(26, 35, 50, 0.6); }
.dlg-head { display: flex; align-items: center; gap: 8px; padding: 16px 16px 0; }
.dlg-head h2 { margin: 0; flex: 1; }
.dlg-body { padding: 16px; overflow-y: auto; max-height: calc(100vh - 160px); }
.dlg-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 0 16px 16px; }
.icon-btn { font: inherit; background: none; border: 0; font-size: 24px; line-height: 1; width: 44px; height: 44px; cursor: pointer; border-radius: 8px; color: var(--muted); }
.icon-btn:hover { background: #eef2f7; }

/* ---------- toast ---------- */
.toasts { position: fixed; left: 8px; right: 8px; bottom: 8px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { pointer-events: auto; background: var(--navy); color: #fff; padding: 12px 16px; border-radius: var(--radius); max-width: 560px; width: 100%; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25); border-left: 6px solid #60a5fa; transition: opacity 0.2s, transform 0.2s; }
.toast.ok { border-left-color: #4ade80; }
.toast.err { background: #7f1d1d; border-left-color: #fca5a5; }
.toast.leaving { opacity: 0; transform: translateY(8px); }

/* ---------- login ---------- */
.login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 24px; width: 100%; max-width: 400px; }

.inline-form { background: #f8fafc; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.weight-sum { font-weight: 700; }
.weight-sum.bad { color: var(--red); }
.weight-sum.ok { color: var(--green); }
details > summary { cursor: pointer; min-height: 32px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ---------- item history, evidence, prep panel ---------- */
.timeline { list-style: none; margin: 0 0 8px; padding: 0 0 0 16px; border-left: 3px solid var(--border); }
.timeline > li { position: relative; padding: 0 0 16px 16px; }
.timeline > li::before { content: ""; position: absolute; left: -25px; top: 8px; width: 12px; height: 12px; border-radius: 50%; background: var(--blue); border: 2px solid #fff; }
.timeline.compact > li { padding-bottom: 8px; }
.list > li.ev-warn { border-color: #f59e0b; background: #fffbeb; }
.ev-warn-text { color: #92400e; font-weight: 600; }
.q-group, .q-groups details { border: 1px solid var(--border); border-radius: var(--radius); padding: 4px 12px 12px; margin-bottom: 8px; }
.q-group ul { margin: 8px 0; padding-left: 20px; }
.q-group li { margin-bottom: 4px; }
.q-item { align-items: flex-start; }
.q-item input { flex: none; margin-top: 2px; }
.q-pick { margin-top: 8px; }
.dlg-body table select { min-height: 36px; padding: 4px 8px; }
