/* 당곡 배움이음 v3 화면 · 커리큘럼 위버 디자인 토큰과 화면 구성(넓은 여백, 머리줄 없는 흰 카드, 검은 주 버튼, 파란 현재 표시)을 따른다 */
:root {
  --bg: #FAFBFC;
  --surface: #FFFFFF;
  --surface-2: #F3F4F6;
  --surface-3: #F9FAFB;
  --border: #E5E7EB;
  --border-subtle: #F3F4F6;
  --border-strong: #D1D5DB;
  --text: #111827;
  --text-2: #6B7280;
  --text-3: #9CA3AF;
  --text-body: #374151;
  --primary: #3B82F6;
  --primary-hover: #2563EB;
  --primary-soft: #EFF6FF;
  --primary-line: #BFDBFE;
  --accent: #7C3AED;
  --brand-grad: linear-gradient(135deg, #6366F1 0%, #8B5CF6 55%, #A855F7 100%);

  --prep: #0EA5E9; --prep-bg: #F0F9FF;
  --t: #F97316; --t-bg: #FFF7ED;
  --a: #22C55E; --a-bg: #F0FDF4;
  --ds: #A855F7; --ds-bg: #FAF5FF;
  --di: #F43F5E; --di-bg: #FFF1F2;
  --e: #EAB308; --e-bg: #FFFBEB;
  --chk: #111827; --chk-bg: #F3F4F6;

  --green: #16A34A; --green-bg: #F0FDF4; --green-line: #86EFAC;
  --amber: #B45309; --amber-bg: #FFFBEB; --amber-line: #FCD34D;
  --orange: #C2410C; --orange-bg: #FFF7ED; --orange-line: #FDBA74;
  --red: #DC2626; --red-bg: #FEE2E2; --red-line: #FCA5A5;
  --purple: #7E22CE; --purple-bg: #FAF5FF; --purple-line: #D8B4FE;
  --blue: #1D4ED8; --blue-bg: #EFF6FF; --blue-line: #93C5FD;
  --sky: #0369A1; --sky-bg: #F0F9FF;
  --gray: #4B5563; --gray-bg: #F3F4F6;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.06), 0 4px 6px -4px rgba(0, 0, 0, 0.03);
  --shadow-xl: 0 20px 50px -12px rgba(0, 0, 0, 0.08);

  --font-sans: 'Pretendard Variable', 'Pretendard', -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Segoe UI', Roboto, sans-serif;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --normal: 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; overflow-x: hidden; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
* { -webkit-tap-highlight-color: transparent; }
h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.35; }
h2 { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.45; }
h3 { font-size: 15.5px; font-weight: 650; line-height: 1.45; }
h4 { font-size: 13px; font-weight: 650; color: var(--text-body); }
ul, ol { margin: 0; padding-left: 1.2em; }
a { color: var(--primary-hover); text-underline-offset: 3px; }
img { max-width: 100%; }
:focus { outline: none; }
:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.35); }
input:focus-visible, textarea:focus-visible, select:focus-visible { box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12); }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #D1D5DB; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #9CA3AF; }

.skip-link { position: absolute; left: -999px; top: 8px; background: var(--text); color: #fff; padding: 8px 12px; border-radius: var(--radius-md); z-index: 100; }
.skip-link:focus { left: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid var(--border);
  backdrop-filter: saturate(1.6) blur(10px);
  -webkit-backdrop-filter: saturate(1.6) blur(10px);
}
.topbar-inner { max-width: 1320px; margin: 0 auto; padding: 0 24px; min-height: 64px; display: flex; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-weight: 700; font-size: 16px; letter-spacing: -0.01em; white-space: nowrap; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--brand-grad); color: #fff; display: grid; place-items: center; font-size: 14px; font-weight: 800; box-shadow: 0 2px 8px rgba(99, 102, 241, 0.28); }
.nav { display: flex; align-items: center; gap: 2px; }
.nav a { display: inline-flex; align-items: center; gap: 6px; padding: 8px 11px; border-radius: var(--radius-md); color: #4B5563; text-decoration: none; font-weight: 500; font-size: 14px; white-space: nowrap; transition: background var(--fast), color var(--fast); }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a[aria-current="page"] { background: var(--primary-soft); color: var(--primary-hover); font-weight: 600; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.user-chip { display: flex; flex-direction: column; line-height: 1.3; text-align: right; }
.user-chip strong { font-size: 13.5px; }
.user-chip span { font-size: 12px; color: var(--text-2); }
.topbar .menu-toggle { display: none; }
@media (min-width: 961px) and (max-width: 1340px) { .nav a { padding: 8px 9px; font-size: 13.5px; } }
.user-chip strong, .user-chip span { white-space: nowrap; }

/* ---------- layout ---------- */
.main { max-width: 1320px; margin: 0 auto; padding: 40px 24px 96px; outline: none; }
.main.narrow { max-width: 720px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.stack > .page-head { margin-bottom: 4px; }
.page-head .lead { color: var(--text-2); margin-top: 6px; font-size: 15px; max-width: 72ch; }
.eyebrow { font-size: 12.5px; color: var(--accent); font-weight: 600; letter-spacing: 0.04em; margin-bottom: 6px; }
.crumbs { display: flex; gap: 6px; align-items: center; font-size: 12.5px; color: var(--text-3); margin-bottom: 6px; flex-wrap: wrap; }
.crumbs a { color: var(--text-2); text-decoration: none; }
.crumbs a:hover { color: var(--text); text-decoration: underline; }
.stack { display: flex; flex-direction: column; gap: 20px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.split-wide { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 400px); gap: 24px; align-items: start; }
.sticky { position: sticky; top: 88px; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.pre { white-space: pre-wrap; }
.strong { font-weight: 650; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.hide { display: none !important; }
hr.sep { border: 0; border-top: 1px solid var(--border-subtle); margin: 12px 0; }

/* ---------- cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--normal), border-color var(--normal);
}
.card-pad { padding: 24px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 20px 24px 4px; flex-wrap: wrap; }
.card-head > svg { color: var(--text-2); }
.card-head h2, .card-head h3 { font-size: 16px; font-weight: 700; }
.card-head .actions { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.card-body { padding: 14px 24px 24px; }
.card > .card-body:first-child { padding-top: 24px; }
.card.flat:hover { box-shadow: var(--shadow-sm); }
.card.accent-left { border-left-width: 3px; }
.item { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px 16px; background: var(--surface); transition: border-color var(--fast), box-shadow var(--fast); }
.item + .item { margin-top: 10px; }
.item.selected { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12); }
/* 카드 안의 목록 항목은 테두리 상자를 겹치지 않고 연한 바탕의 줄로 보여 준다 */
.card .item { background: var(--surface-3); border-color: var(--border-subtle); }
.card a.item:hover, .card .item.link-item:hover { background: #fff; border-color: var(--primary-line); box-shadow: var(--shadow-sm); }
.card .item.selected { background: #fff; }
.item-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.item-head .actions { margin-left: auto; display: flex; gap: 4px; flex-wrap: wrap; }
.item-text { color: var(--text); white-space: pre-wrap; }
.kv { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 6px 12px; font-size: 13px; }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 38px; padding: 0 16px; border-radius: var(--radius-md);
  font-size: 14px; font-weight: 500; font-family: var(--font-sans); line-height: 1.2;
  transition: background var(--fast), border-color var(--fast), color var(--fast), box-shadow var(--fast);
  cursor: pointer; border: 1px solid transparent; text-decoration: none; white-space: nowrap;
  background: transparent; color: inherit;
}
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: #111827; color: #fff; font-weight: 600; }
.btn-primary:hover:not(:disabled) { background: #1F2937; }
.btn-secondary { background: #fff; color: #374151; border-color: var(--border); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03); }
.btn-secondary:hover:not(:disabled) { background: #F9FAFB; border-color: #D1D5DB; }
.btn-ghost { background: transparent; color: #4B5563; }
.btn-ghost:hover:not(:disabled) { background: #F3F4F6; color: #111827; }
.btn-danger { background: #FEE2E2; color: #DC2626; }
.btn-danger:hover:not(:disabled) { background: #FECACA; }
.btn-blue { background: var(--primary-hover); color: #fff; font-weight: 600; }
.btn-blue:hover:not(:disabled) { background: #1D4ED8; }
.btn-green { background: #F0FDF4; color: #15803D; border-color: #BBF7D0; }
.btn-green:hover:not(:disabled) { background: #BBF7D0; }
.btn-sm { min-height: 32px; padding: 0 12px; font-size: 13px; }
.btn-xs { min-height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: var(--radius-sm); }
.btn-block { width: 100%; }
.btn svg { flex-shrink: 0; }
.btn-group { display: inline-flex; gap: 6px; flex-wrap: wrap; }

/* ---------- badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 10px; border-radius: 9999px;
  font-size: 12px; font-weight: 600; line-height: 1.6; white-space: nowrap;
  background: var(--gray-bg); color: var(--gray); border: 1px solid var(--border);
}
.badge svg { width: 12px; height: 12px; }
.badge-gray { background: var(--gray-bg); color: var(--gray); border-color: var(--border); }
.badge-dark { background: #111827; color: #fff; border-color: #111827; }
.badge-blue { background: var(--blue-bg); color: var(--blue); border-color: #BFDBFE; }
.badge-sky { background: var(--sky-bg); color: var(--sky); border-color: #BAE6FD; }
.badge-green { background: #F0FDF4; color: #15803D; border-color: #BBF7D0; }
.badge-amber { background: #FFFBEB; color: #92400E; border-color: #FDE68A; }
.badge-orange { background: #FFF7ED; color: #C2410C; border-color: #FED7AA; }
.badge-red { background: #FEF2F2; color: #B91C1C; border-color: #FECACA; }
.badge-purple { background: #F5F3FF; color: #6D28D9; border-color: #DDD6FE; }
.badge-rose { background: #FFF1F2; color: #BE123C; border-color: #FECDD3; }
.badge-outline { background: #fff; border-color: var(--border); color: var(--text-body); }
/* 상태 유형별 모양 구분: 관찰 확인(사각), 재수행 확인(점선 테두리), 기재 적합성(굵은 테두리) */
.badge-obs { border-radius: 6px; }
.badge-recheck { border-style: dashed; border-color: currentColor; background: #fff; }
.badge-suit { border-width: 1.5px; border-color: currentColor; background: #fff; }
.badge-kind { border-radius: 6px; font-weight: 600; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 8px; font-size: 12px; background: var(--surface-2); color: var(--text-body); border: 1px solid var(--border); white-space: nowrap; }
.chip-btn { cursor: pointer; }
.chip-btn:hover { border-color: var(--border-strong); background: #fff; }
.id-tag { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; padding: 1px 6px; border-radius: 4px; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }

/* ---------- forms ---------- */
input, textarea, select {
  border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 9px 12px; font-size: 14px; font-family: var(--font-sans); color: var(--text);
  background: #fff; width: 100%; max-width: 100%;
  transition: border-color var(--fast), box-shadow var(--fast);
}
textarea { resize: vertical; min-height: 64px; line-height: 1.55; }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; padding: 0; margin: 0; accent-color: #111827; flex-shrink: 0; }
input:hover:not(:disabled), textarea:hover:not(:disabled), select:hover:not(:disabled) { border-color: var(--border-strong); }
input:focus, textarea:focus, select:focus { outline: none; border-color: #3B82F6; box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1); }
input:disabled, textarea:disabled, select:disabled { background: var(--surface-3); color: var(--text-2); }
label { font-size: 13px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field > .field-label { font-weight: 600; color: var(--text-body); font-size: 13px; }
.field .hint { font-size: 12px; color: var(--text-2); }
.field .req { color: var(--red); margin-left: 2px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .span-2 { grid-column: span 2; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 13px; padding: 3px 0; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.inline-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { flex: 1 1 160px; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 12px 14px; margin: 0; min-width: 0; }
legend { font-size: 12.5px; font-weight: 600; color: var(--text-body); padding: 0 4px; }

/* ---------- notices ---------- */
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius-lg); border: 1px solid #FDE68A; background: #FFFBEB; color: #78350F; font-size: 13.5px; line-height: 1.6; }
.notice svg { flex-shrink: 0; margin-top: 2px; }
.notice strong { color: #78350F; }
.notice-info { border-color: #BFDBFE; background: #EFF6FF; color: #1E3A8A; }
.notice-info strong { color: #1E3A8A; }
.notice-gray { border-color: var(--border); background: var(--surface-3); color: var(--text-body); }
.notice-red { border-color: #FECACA; background: #FEF2F2; color: #991B1B; }
.notice-green { border-color: #BBF7D0; background: #F0FDF4; color: #14532D; }
.inline-error { color: #B91C1C; font-size: 12.5px; }

/* ---------- loading / empty ---------- */
.loading-block { display: flex; align-items: center; gap: 10px; justify-content: center; padding: 48px 16px; color: var(--text-2); }
.spinner { width: 16px; height: 16px; border: 2px solid var(--border); border-top-color: var(--text-2); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { padding: 22px 16px; text-align: center; color: var(--text-2); border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); font-size: 13.5px; background: var(--surface-3); }
.error-block { padding: 24px; border: 1px solid #FECACA; background: #FEF2F2; color: #991B1B; border-radius: var(--radius-lg); }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a, .tabs button { padding: 10px 14px; font-size: 14px; font-weight: 600; color: var(--text-2); text-decoration: none; border: none; background: none; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap; font-family: var(--font-sans); }
.tabs a:hover, .tabs button:hover { color: var(--text); }
.tabs [aria-selected="true"], .tabs [aria-current="page"] { color: var(--text); border-bottom-color: var(--text); }
.seg { display: inline-flex; padding: 3px; background: var(--surface-2); border-radius: 10px; gap: 2px; flex-wrap: wrap; }
.seg button { border: none; background: transparent; padding: 6px 14px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer; font-family: var(--font-sans); }
.seg button[aria-pressed="true"] { background: #fff; color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); background: #fff; }
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-weight: 600; color: var(--text-2); font-size: 12.5px; padding: 11px 14px; background: var(--surface-3); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border-subtle); vertical-align: top; }
.table tr:last-child td { border-bottom: none; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--surface-3); }
.num { font-variant-numeric: tabular-nums; }

/* ---------- toasts ---------- */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; background: #111827; color: #fff; padding: 12px 14px; border-radius: var(--radius-lg); box-shadow: var(--shadow-xl); font-size: 13px; animation: slideUp 200ms ease forwards; }
.toast-error { background: #7F1D1D; }
.toast-conflict { background: #78350F; }
.toast-success { background: #14532D; }
.toast .toast-kind { font-weight: 700; white-space: nowrap; }
.toast button { margin-left: auto; background: transparent; border: none; color: inherit; opacity: 0.7; cursor: pointer; padding: 0 2px; font-size: 16px; line-height: 1; }
@keyframes slideUp { from { transform: translateY(8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ---------- dialog ---------- */
dialog.dlg { border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 48px); box-shadow: var(--shadow-xl); color: var(--text); overflow: hidden; }
dialog.dlg.wide { width: min(860px, calc(100vw - 24px)); }
dialog.dlg::backdrop { background: rgba(17, 24, 39, 0.4); backdrop-filter: blur(2px); }
.dlg-head { padding: 20px 24px 8px; display: flex; align-items: center; gap: 8px; }
.dlg-head h2 { font-size: 18px; }
.dlg-body { padding: 8px 24px 20px; overflow-y: auto; max-height: calc(100vh - 200px); }
.dlg-foot { padding: 14px 24px; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--border); background: var(--bg); flex-wrap: wrap; }

/* ---------- progress ---------- */
.progress { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--primary); border-radius: 999px; }
.progress.warn > span { background: #F59E0B; }
.progress.over > span { background: #DC2626; }

/* ---------- stat cards ---------- */
.stat { padding: 18px 20px; }
.stat .stat-label { font-size: 12.5px; color: var(--text-2); font-weight: 600; }
.stat .stat-value { font-size: 26px; letter-spacing: -0.02em; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .stat-value small { font-size: 13px; color: var(--text-2); font-weight: 550; margin-left: 2px; }
.stat .stat-detail { font-size: 12px; color: var(--text-2); margin-top: 4px; }
.todo-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.todo { padding: 14px 16px; border-radius: var(--radius-lg); border: 1px solid var(--border); background: #fff; }
.todo .n { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.todo .l { font-size: 12px; color: var(--text-2); font-weight: 600; }
.todo.has { border-color: #FDBA74; background: #FFF7ED; }
.todo.has .n { color: #C2410C; }

/* ---------- login ---------- */
.login-wrap { max-width: 1040px; margin: 0 auto; }
.account-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.account { text-align: left; display: flex; flex-direction: column; gap: 6px; padding: 16px 18px; cursor: pointer; font-family: var(--font-sans); color: var(--text); }
.account:hover { border-color: var(--primary-line); box-shadow: var(--shadow-md); }
.account .name { font-weight: 700; font-size: 15px; }
.account .sub { color: var(--text-2); font-size: 12.5px; }

/* ---------- program cards ---------- */
.prog-card { display: flex; flex-direction: column; gap: 10px; padding: 20px 22px; }
.prog-card .title { font-weight: 700; font-size: 16px; line-height: 1.45; color: var(--text); text-decoration: none; }
.prog-card .title:hover { text-decoration: underline; }
.prog-card .meta { font-size: 12.5px; color: var(--text-2); }
.prog-card .foot { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; padding-top: 6px; border-top: 1px solid var(--border-subtle); }
.counts { display: flex; gap: 10px; font-size: 12px; color: var(--text-2); flex-wrap: wrap; }
.counts b { color: var(--text); font-variant-numeric: tabular-nums; }
.filter-bar { display: grid; grid-template-columns: 2fr repeat(5, minmax(0, 1fr)); gap: 8px; }
.filter-bar + .filter-bar, details .filter-bar { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.filter-bar .field label { font-size: 11.5px; }
.filter-bar input, .filter-bar select { padding: 6px 10px; font-size: 13px; }

/* ---------- design studio ---------- */
.studio-head { margin-bottom: 14px; }
.step-nav { display: flex; gap: 4px; padding: 6px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-xl); overflow-x: auto; margin-bottom: 16px; }
.step-nav a { display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; border-radius: var(--radius-md); font-size: 13px; font-weight: 600; text-decoration: none; color: var(--text-2); white-space: nowrap; transition: background var(--fast), color var(--fast); }
.step-nav a:hover { background: var(--surface-2); color: var(--text); }
.step-nav a .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--phase); flex-shrink: 0; }
.step-nav a .no { font-variant-numeric: tabular-nums; opacity: 0.8; }
.step-nav a .cnt { font-size: 11px; opacity: 0.65; font-weight: 550; }
.step-nav a[aria-current="page"] { background: var(--phase); color: #fff; }
.step-nav a[aria-current="page"] .dot { background: rgba(255, 255, 255, 0.6); }
.step-head { padding: 16px 20px; border-left: 3px solid var(--phase); }
.step-head .step-code { display: inline-block; font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 4px; color: var(--phase); background: var(--phase-bg); margin-bottom: 4px; }
.step-head p { color: var(--text-2); margin-top: 4px; font-size: 13px; }
.phase-prep { --phase: var(--prep); --phase-bg: var(--prep-bg); }
.phase-t { --phase: var(--t); --phase-bg: var(--t-bg); }
.phase-a { --phase: var(--a); --phase-bg: var(--a-bg); }
.phase-ds { --phase: var(--ds); --phase-bg: var(--ds-bg); }
.phase-di { --phase: var(--di); --phase-bg: var(--di-bg); }
.phase-e { --phase: var(--e); --phase-bg: var(--e-bg); }
.phase-chk { --phase: var(--chk); --phase-bg: var(--chk-bg); }
.phase-border { border-left: 3px solid var(--phase); }

/* chain diagram */
.chain { display: flex; align-items: stretch; gap: 0; padding: 14px; overflow-x: auto; }
.chain-node { flex: 1 1 0; min-width: 130px; border-radius: var(--radius-md); background: var(--phase-bg); border: 1px solid color-mix(in srgb, var(--phase) 30%, transparent); padding: 10px 12px; text-decoration: none; color: var(--text); display: flex; flex-direction: column; gap: 2px; transition: box-shadow var(--fast); }
.chain-node:hover { box-shadow: var(--shadow-md); }
.chain-node .lbl { font-size: 12px; font-weight: 700; color: var(--phase); }
.chain-node .val { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }
.chain-node .sub { font-size: 11.5px; color: var(--text-2); }
.chain-link { flex: 0 0 120px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 0 6px; position: relative; }
.chain-link .line { width: 100%; height: 2px; background: var(--border-strong); position: relative; }
.chain-link .line::after { content: ""; position: absolute; right: -1px; top: -4px; border-left: 7px solid var(--border-strong); border-top: 5px solid transparent; border-bottom: 5px solid transparent; }
.chain-link.broken .line { background: repeating-linear-gradient(90deg, #F87171 0 6px, transparent 6px 10px); }
.chain-link.broken .line::after { border-left-color: #F87171; }
.chain-link .gap { font-size: 11px; text-align: center; line-height: 1.35; }
.chain-link .gap.ok { color: #15803D; }
.chain-link .gap.bad { color: #B91C1C; font-weight: 600; }

/* suggestions */
.suggest-box { border: 1px dashed #93C5FD; background: #F8FAFF; border-radius: var(--radius-lg); padding: 14px; }
.suggest-box .label { font-size: 12px; color: var(--blue); font-weight: 600; }
.suggestion { background: #fff; border: 1px solid #DBEAFE; border-radius: var(--radius-md); padding: 12px 14px; }
.suggestion + .suggestion { margin-top: 8px; }
.suggestion .why { font-size: 12px; color: var(--text-2); margin-top: 4px; }
.suggestion .actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.decided { font-size: 12px; color: var(--text-2); }

.savebar { position: sticky; bottom: 12px; z-index: 20; margin-top: 20px; background: rgba(255, 255, 255, 0.94); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); padding: 10px 16px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.savebar .state { font-size: 13px; color: var(--text-2); }
.savebar.dirty { border-color: #FDBA74; }
.savebar.dirty .state { color: #9A3412; font-weight: 600; }
.savebar .actions { margin-left: auto; display: flex; gap: 6px; }

.check-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius-md); border: 1px solid var(--border); background: #fff; }
.check-item + .check-item { margin-top: 6px; }
.check-item.error { border-color: #FECACA; background: #FEF2F2; }
.check-item.warning { border-color: #FDE68A; background: #FFFBEB; }
.check-item.info { border-color: var(--border); background: var(--surface-3); }
.flow { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.flow .st { padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--text-3); }
.flow .st.done { color: var(--text-2); }
.flow .st.now { background: var(--primary-hover); color: #fff; }
.flow .arr { color: var(--text-3); font-size: 12px; }

/* survey */
.qr-box { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; }
.qr-box img { width: 168px; height: 168px; border: 1px solid var(--border); border-radius: var(--radius-md); background: #fff; padding: 6px; }
.item-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }

/* recruitment card */
.recruit { display: flex; flex-direction: column; gap: 12px; padding: 18px; }
.recruit .headline { font-size: 16px; font-weight: 700; line-height: 1.45; }
.recruit section h4 { margin-bottom: 4px; }
.recruit ul { color: var(--text-body); }
.recruit .load { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px; font-size: 13px; }
.recruit .load div span { color: var(--text-2); margin-right: 6px; }
.sample { border: 1px dashed #FCD34D; background: #FFFBEB; border-radius: var(--radius-md); padding: 10px 12px; }
.sample .tag { font-size: 11.5px; font-weight: 700; color: #92400E; }
.sample p { margin-top: 4px; }
.sample .promise { font-size: 12px; color: #92400E; margin-top: 6px; }

/* evidence separation: five kinds, colour plus label plus icon */
.ev-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.ev-col { border-radius: var(--radius-lg); padding: 10px; min-width: 0; }
.ev-col h3 { display: flex; align-items: center; gap: 6px; font-size: 13.5px; margin-bottom: 2px; }
.ev-col .ev-desc { font-size: 11.5px; margin-bottom: 8px; }
.ev-card { border-radius: var(--radius-md); padding: 8px 10px; background: #fff; font-size: 12.5px; }
.ev-card + .ev-card { margin-top: 6px; }
.ev-card .ev-tag { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; }
.ev-card .ev-text { margin-top: 3px; white-space: pre-wrap; }
.ev-card .ev-reason { margin-top: 4px; font-size: 11.5px; color: var(--text-2); }
.ev-fact { background: #F0FDF4; border: 1px solid #BBF7D0; }
.ev-fact h3 { color: #15803D; }
.ev-fact .ev-desc { color: #166534; }
.ev-fact .ev-card { border: 1.5px solid #22C55E; }
.ev-fact .ev-tag { color: #15803D; }
.ev-self { background: #FFF7ED; border: 1px solid #FED7AA; }
.ev-self h3 { color: #C2410C; }
.ev-self .ev-desc { color: #9A3412; }
.ev-self .ev-card { border: 1.5px dashed #F97316; }
.ev-self .ev-tag { color: #C2410C; }
.ev-interp { background: #FAF5FF; border: 1px solid #E9D5FF; }
.ev-interp h3 { color: #7E22CE; }
.ev-interp .ev-desc { color: #6B21A8; }
.ev-interp .ev-card { border: 1.5px dotted #A855F7; }
.ev-interp .ev-tag { color: #7E22CE; }
.ev-unver { background: repeating-linear-gradient(135deg, #F3F4F6 0 8px, #FAFAFA 8px 16px); border: 1px solid #E5E7EB; }
.ev-unver h3 { color: #4B5563; }
.ev-unver .ev-desc { color: #4B5563; }
.ev-unver .ev-card { border: 1.5px solid #D1D5DB; background: rgba(255, 255, 255, 0.92); }
.ev-unver .ev-tag { color: #4B5563; }
.ev-excl { background: #FEF2F2; border: 1px solid #FECACA; }
.ev-excl h3 { color: #B91C1C; }
.ev-excl .ev-desc { color: #991B1B; }
.ev-excl .ev-card { border: 1.5px solid #FCA5A5; }
.ev-excl .ev-card .ev-text { text-decoration: line-through; text-decoration-color: #DC2626; color: #6B7280; }
.ev-excl .ev-tag { color: #B91C1C; }
.ev-empty { font-size: 12px; color: var(--text-3); padding: 6px 2px; }

/* draft sentences */
.sentence { border: 1px solid var(--border); border-radius: var(--radius-md); padding: 12px 14px; background: #fff; cursor: pointer; transition: border-color var(--fast), box-shadow var(--fast); }
.sentence + .sentence { margin-top: 8px; }
.sentence:hover { border-color: var(--border-strong); }
.sentence.selected { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12); }
.sentence.st-needs_review { border-left: 3px solid #F59E0B; }
.sentence.st-confirmed { border-left: 3px solid #22C55E; }
.sentence.st-removed { opacity: 0.6; }
.sentence.st-removed .s-text { text-decoration: line-through; }
.sentence .s-text { font-size: 14.5px; line-height: 1.7; }
.sentence .s-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; align-items: center; }
.sentence .s-foot { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; align-items: center; }
.flag { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 2px 8px; border-radius: 6px; }
.flag-block { background: #FEE2E2; color: #B91C1C; border: 1px solid #FCA5A5; font-weight: 600; }
.flag-warn { background: #FFFBEB; color: #92400E; border: 1px solid #FDE68A; }

/* trace chain */
.trace { position: relative; }
.trace-step { position: relative; padding: 0 0 14px 26px; }
.trace-step::before { content: ""; position: absolute; left: 8px; top: 20px; bottom: 0; width: 2px; background: var(--border); }
.trace-step:last-child::before { display: none; }
.trace-step .pin { position: absolute; left: 0; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--phase-bg); border: 2px solid var(--phase); }
.trace-step .t-label { font-size: 11.5px; font-weight: 700; color: var(--phase); letter-spacing: 0.2px; }
.trace-step .t-box { margin-top: 4px; border: 1px solid var(--border); border-radius: var(--radius-md); padding: 8px 10px; background: #fff; font-size: 13px; }
.trace-step .t-box + .t-box { margin-top: 6px; }
.trace-step .t-sub { font-size: 11.5px; color: var(--text-2); margin-top: 3px; }
.trace-branch { margin-top: 6px; padding: 8px 10px; border-radius: var(--radius-md); background: var(--surface-3); border: 1px dashed var(--border-strong); font-size: 12.5px; }
.trace-sep { margin: 4px 0 14px; padding: 6px 10px; border-radius: var(--radius-md); background: var(--surface-2); font-size: 12px; font-weight: 600; color: var(--text-2); }

/* kanban */
.kanban { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.kanban-col { background: var(--surface-3); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 10px; min-width: 0; }
.kanban-col h3 { font-size: 13px; display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.kanban-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-md); padding: 10px 12px; font-size: 13px; }
.kanban-card + .kanban-card { margin-top: 8px; }

/* student */
.s-section + .s-section { margin-top: 20px; }
.s-section > h2 { margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.s-card { padding: 14px 16px; }
.next-action { margin-top: 8px; padding: 8px 10px; border-radius: var(--radius-md); background: var(--blue-bg); border: 1px solid #BFDBFE; font-size: 13px; }
.next-action b { color: var(--blue); }
.q-card { padding: 16px; }
.q-card .q-text { font-weight: 600; font-size: 15px; line-height: 1.5; }
.q-card .q-meta { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.scale { display: flex; gap: 6px; flex-wrap: wrap; }
.scale label { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius-md); cursor: pointer; background: #fff; }
.choice-list { display: flex; flex-direction: column; gap: 6px; }
.choice-list label { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-md); cursor: pointer; background: #fff; }
.saved-note { font-size: 12px; color: #15803D; }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .topbar-inner { flex-wrap: wrap; padding: 10px 16px; gap: 8px; min-height: 56px; }
  .topbar .menu-toggle { display: inline-flex; margin-left: auto; }
  .nav { display: none; width: 100%; flex-direction: column; align-items: stretch; padding: 4px 0 8px; order: 10; }
  .topbar.open .nav { display: flex; }
  .nav a { padding: 10px 12px; }
  .topbar-right { display: none; width: 100%; order: 11; justify-content: space-between; padding-bottom: 8px; flex-wrap: wrap; }
  .topbar.open .topbar-right { display: flex; }
  .user-chip { text-align: left; }
}
@media (max-width: 1100px) {
  .ev-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .todo-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .filter-bar, details .filter-bar { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .filter-bar > .field:first-child { grid-column: span 3; }
  details .filter-bar > .field:first-child { grid-column: auto; }
}
@media (max-width: 900px) {
  .split, .split-wide { grid-template-columns: minmax(0, 1fr); }
  .sticky { position: static; }
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kanban { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 768px) {
  .main { padding: 24px 16px 88px; }
  .grid-2, .grid-3, .grid-4, .form-grid, .form-grid-3 { grid-template-columns: minmax(0, 1fr); }
  .form-grid .span-2 { grid-column: auto; }
  .ev-grid { grid-template-columns: minmax(0, 1fr); }
  .todo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-bar, details .filter-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-bar > .field:first-child { grid-column: span 2; }
  details .filter-bar > .field:first-child { grid-column: auto; }
  .chain { flex-direction: column; }
  .chain-link { flex: 0 0 auto; flex-direction: row; padding: 6px 0; }
  .chain-link .line { width: 2px; height: 22px; flex: 0 0 2px; }
  .chain-link .line::after { right: -4px; top: auto; bottom: -2px; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 7px solid var(--border-strong); border-bottom: 0; }
  .chain-link.broken .line { background: repeating-linear-gradient(180deg, #F87171 0 6px, transparent 6px 10px); }
  .chain-link.broken .line::after { border-top-color: #F87171; border-left-color: transparent; }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .kv dd { margin-bottom: 6px; }
  .recruit .load { grid-template-columns: minmax(0, 1fr); }
  h1 { font-size: 21px; }
  .card-pad { padding: 18px; }
  .card-head { padding: 16px 18px 2px; }
  .card-body { padding: 12px 18px 18px; }
  .card > .card-body:first-child { padding-top: 18px; }
  .savebar .actions { margin-left: 0; width: 100%; }
  .savebar .actions .btn { flex: 1; }
  .table th, .table td { padding: 8px; }
}
@media print {
  .topbar, .savebar, .toasts { display: none; }
}
.suggest-box select { width: auto; max-width: 280px; }
.suggest-box .row-between > .row { justify-content: flex-end; }
.split-wide > .sticky { max-height: calc(100vh - 88px); overflow-y: auto; }
.chip-btn { white-space: normal; text-align: left; max-width: 100%; flex-wrap: wrap; font-family: var(--font-sans); }
@media (max-width: 768px) {
  .chain { padding: 10px; }
  .chain-node { flex-direction: row; align-items: baseline; gap: 8px; padding: 6px 10px; min-width: 0; }
  .chain-node .val { font-size: 16px; }
  .chain-link { padding: 2px 0; gap: 8px; justify-content: flex-start; padding-left: 16px; }
  .chain-link .line { height: 14px; }
}
