/* 공통 컴포넌트: 버튼·입력칸·카드·배지·탭·표·모달·토스트·빈 상태 */

/* 로고 */
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text-primary); }
.logo-mark { width: 44px; height: 44px; border-radius: 10px; background: var(--brand); display: grid; place-items: center; flex: none; }
.logo-mark svg { width: 26px; height: 26px; stroke: var(--text-primary); }
.logo-text { line-height: 1.1; }
.logo-text .logo-main { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.logo-text .logo-sub { font-size: 13px; font-weight: 700; }
.logo.small .logo-mark { width: 40px; height: 40px; }
.logo.small .logo-main { font-size: 20px; }

/* 아이콘 */
.icon { display: inline-block; vertical-align: -0.25em; width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon.sm { width: 16px; height: 16px; }
.icon.lg { width: 24px; height: 24px; }
.icon.xl { width: 32px; height: 32px; }

/* 버튼 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--control-h); padding: 0 18px; border-radius: var(--radius-control);
  border: 1px solid transparent; font-weight: 600; font-size: var(--fs-body); line-height: 1.2; text-decoration: none;
  background: var(--surface); color: var(--text-primary); white-space: nowrap; transition: background .12s, border-color .12s;
}
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--text-primary); }
.btn.primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
.btn.secondary { border-color: var(--border-strong); }
.btn.secondary:hover { background: var(--neutral-soft); }
.btn.ghost { border-color: transparent; }
.btn.ghost:hover { background: var(--neutral-soft); }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: var(--fs-help); }
.btn.lg { min-height: 52px; font-size: 18px; }
.btn.block { width: 100%; }
.btn:disabled, .btn[aria-disabled="true"] { background: var(--disabled-bg); border-color: var(--disabled-bg); color: var(--disabled-text); }
.btn.link { border: none; background: none; padding: 0; min-height: 0; text-decoration: underline; text-underline-offset: 3px; font-weight: 500; }
.icon-btn {
  display: inline-grid; place-items: center; width: var(--control-h); height: var(--control-h); border-radius: var(--radius-control);
  border: 1px solid transparent; background: transparent; color: var(--text-secondary);
}
.icon-btn:hover { background: var(--neutral-soft); color: var(--text-primary); }
.icon-btn.bordered { border-color: var(--border-strong); background: var(--surface); }
.icon-btn:disabled { color: var(--disabled-text); background: transparent; }

/* 입력칸 */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .field-label { font-size: var(--fs-help); font-weight: 600; color: var(--text-primary); }
.field.disabled > label { color: var(--text-tertiary); }
.input, .select, .textarea {
  width: 100%; min-height: var(--input-h); padding: 10px 14px; border: 1px solid var(--border-strong); border-radius: var(--radius-control);
  background: var(--surface); color: var(--text-primary); font-size: var(--fs-body);
}
.input::placeholder, .textarea::placeholder { color: var(--text-tertiary); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); outline: none; }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible { box-shadow: 0 0 0 1px var(--brand), var(--focus-ring); }
.input:disabled, .select:disabled, .textarea:disabled { background: var(--neutral-soft); color: var(--text-tertiary); border-color: var(--border); }
.input.invalid, .select.invalid, .textarea.invalid { border-color: var(--danger); }
.textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23667085' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
.select.sm, .input.sm { min-height: 40px; padding: 6px 12px; font-size: var(--fs-help); }
.select.sm { padding-right: 32px; }
.field-help { font-size: var(--fs-help); color: var(--text-secondary); }
.field-error { font-size: var(--fs-help); color: var(--danger); display: flex; align-items: center; gap: 6px; }
.field-error:empty { display: none; }
.input-group { display: flex; align-items: stretch; border: 1px solid var(--border-strong); border-radius: var(--radius-control); background: var(--surface); }
.input-group:focus-within { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.input-group .input { border: none; box-shadow: none !important; background: transparent; flex: 1; min-width: 0; }
.input-group .btn { border: none; border-left: 1px solid var(--border); border-radius: 0 var(--radius-control) var(--radius-control) 0; background: transparent; color: var(--text-secondary); font-weight: 500; }
.checkbox { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; min-height: 32px; }
.checkbox input { width: 22px; height: 22px; accent-color: var(--text-primary); margin: 0; cursor: pointer; }
.radio-list { display: flex; flex-direction: column; gap: 8px; }
.radio-list label { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 14px; border: 1px solid var(--border); border-radius: var(--radius-control); cursor: pointer; }
.radio-list label:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.radio-list input { width: 20px; height: 20px; accent-color: var(--text-primary); margin: 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); }
.form-grid .span-2 { grid-column: span 2; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } .form-grid .span-2 { grid-column: auto; } }

/* 카드 */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: var(--card-padding); }
.card.tight { padding: var(--space-4); }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-4); }
.card-head .sub { font-size: var(--fs-help); color: var(--text-secondary); margin-top: 2px; }
.card-head.flush { padding: var(--card-padding) var(--card-padding) 0; }
.card-foot { padding: var(--space-3) var(--card-padding); border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; font-size: var(--fs-help); color: var(--text-secondary); }
.divider { border: 0; border-top: 1px solid var(--border); margin: var(--space-4) 0; }

/* 요약(통계) 카드 */
.stat { display: flex; flex-direction: column; gap: 6px; min-height: 150px; }
.stat-head { display: flex; align-items: center; justify-content: space-between; font-size: var(--fs-help); color: var(--text-secondary); font-weight: 500; }
.stat-head .icon { color: var(--text-secondary); }
.stat-head .icon.warn { color: var(--warning-icon); }
.stat-value { display: flex; align-items: baseline; gap: 6px; font-size: var(--fs-stat); font-weight: 800; line-height: 1.1; letter-spacing: -0.02em; }
.stat-value .unit { font-size: var(--fs-body); font-weight: 600; color: var(--text-primary); }
.stat-value .denom { font-size: 18px; font-weight: 600; color: var(--text-secondary); }
.stat-foot { margin-top: auto; font-size: var(--fs-help); color: var(--text-secondary); display: flex; align-items: center; gap: 4px; }
.stat-foot a, .stat-foot button { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; background: none; border: 0; padding: 0; font: inherit; }
.stat-foot a:hover, .stat-foot button:hover { color: var(--text-primary); text-decoration: underline; }

/* 배지 */
.badge { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 2px 10px; border-radius: var(--radius-control); font-size: var(--fs-help); font-weight: 600; white-space: nowrap; background: var(--neutral-soft); color: var(--neutral); }
.badge .icon { width: 16px; height: 16px; }
.badge .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.badge.success { background: var(--success-soft); color: var(--success); }
.badge.warning { background: var(--warning-soft); color: var(--warning); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.neutral { background: var(--neutral-soft); color: var(--neutral); }
.badge.brand { background: var(--brand-soft); color: var(--text-primary); }
.badge.outline { background: transparent; border: 1px solid var(--border); color: var(--text-secondary); font-weight: 500; }
.badge.pill { border-radius: var(--radius-pill); }
.status { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; white-space: nowrap; }
.status .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.status.success { color: var(--success); } .status.success .dot { background: var(--success); }
.status.warning { color: var(--warning-icon); } .status.warning .dot { background: var(--warning-icon); }
.status.danger { color: var(--danger); } .status.danger .dot { background: var(--danger); }
.status.neutral { color: var(--text-secondary); } .status.neutral .dot { background: var(--text-tertiary); }
.file-ind { display: inline-flex; align-items: center; gap: 8px; }
.file-ind .icon { width: 22px; height: 22px; }
.file-ind.has { color: var(--success); }
.file-ind.none { color: var(--danger); }
.file-ind .text { color: var(--text-primary); }
.file-ind .sub { display: block; font-size: var(--fs-caption); color: var(--danger); }

/* 탭·필터 */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab { position: relative; min-height: 48px; padding: 0 16px; border: 0; background: none; color: var(--text-secondary); font-weight: 500; white-space: nowrap; }
.tab:hover { color: var(--text-primary); }
.tab[aria-selected="true"] { color: var(--text-primary); font-weight: 700; }
.tab[aria-selected="true"]::after { content: ''; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 3px; background: var(--brand); border-radius: 2px 2px 0 0; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border: 1px solid var(--border-strong); border-radius: var(--radius-control); background: var(--surface); color: var(--text-primary); font-weight: 500; white-space: nowrap; }
.chip .count { font-weight: 700; color: var(--text-secondary); }
.chip[aria-pressed="true"] { background: var(--brand-soft); border-color: var(--brand); font-weight: 600; }
.chip[aria-pressed="true"] .count { color: var(--text-primary); }
.segment { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-control); overflow: hidden; }
.segment button { min-height: 40px; padding: 0 16px; border: 0; background: var(--surface); color: var(--text-secondary); font-weight: 500; border-left: 1px solid var(--border); }
.segment button:first-child { border-left: 0; }
.segment button[aria-pressed="true"] { background: var(--brand-soft); color: var(--text-primary); font-weight: 700; }

/* 표 */
.table-wrap { overflow-x: auto; }
.table { font-size: var(--fs-body); }
.table th, .table td { padding: 14px 16px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { font-size: var(--fs-help); font-weight: 600; color: var(--text-secondary); background: #FAFBFC; white-space: nowrap; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: #FAFBFC; }
.table tr.selected td { background: var(--brand-soft); }
.table tr.selected td:first-child { box-shadow: inset 4px 0 0 var(--brand); }
.table td.num, .table th.num { text-align: left; font-variant-numeric: tabular-nums; }
.table .check-col { width: 48px; }
.table .score { font-weight: 600; }
.table .dash { color: var(--text-tertiary); }
.progress { height: 8px; border-radius: 4px; background: var(--border); overflow: hidden; width: 140px; display: inline-block; vertical-align: middle; }
.progress > span { display: block; height: 100%; background: var(--brand); border-radius: 4px; }
.cell-stack { display: flex; flex-direction: column; gap: 2px; }

/* 목록 */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: var(--space-4); padding: 14px 0; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }
.dday { min-width: 76px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-control); background: var(--neutral-soft); font-weight: 700; font-size: 18px; }
.dday.near { background: var(--brand-soft); }
.dday.today { background: var(--brand); }
.dday.past { color: var(--text-secondary); }
.dday.provisional { border: 1px dashed var(--border-strong); background: transparent; font-size: var(--fs-help); }
.timeline { position: relative; display: flex; flex-direction: column; gap: 4px; }
.timeline-item { display: grid; grid-template-columns: 24px 110px 1fr auto; align-items: start; gap: 8px; padding: 12px 0; }
.timeline-item .marker { width: 10px; height: 10px; border-radius: 50%; background: var(--brand); margin-top: 7px; }
.timeline-item .time { font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* 빈 상태·로딩·오류 */
.empty { text-align: center; padding: var(--space-8) var(--space-4); color: var(--text-secondary); }
.empty .icon { width: 40px; height: 40px; margin: 0 auto 12px; color: var(--text-tertiary); }
.empty h3 { color: var(--text-primary); margin-bottom: 6px; }
.notice { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--radius-card); font-size: var(--fs-help); border: 1px solid var(--border); background: var(--neutral-soft); color: var(--text-primary); }
.notice .icon { flex: none; margin-top: 1px; }
.notice.warning { background: var(--warning-soft); border-color: #F5D77A; }
.notice.danger { background: var(--danger-soft); border-color: #F8C8C3; color: var(--danger); }
.notice.success { background: var(--success-soft); border-color: #B7E4C7; color: var(--success); }
.notice.dashed { border-style: dashed; }
.notice h4 { font-size: var(--fs-body); margin-bottom: 4px; }
.skeleton { background: linear-gradient(90deg, var(--neutral-soft) 25%, #ECEEF2 50%, var(--neutral-soft) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: var(--radius-control); min-height: 20px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.spinner { width: 20px; height: 20px; border: 2px solid var(--border); border-top-color: var(--text-primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 모달 */
.modal-backdrop { position: fixed; inset: 0; background: rgba(16, 24, 40, 0.45); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50; }
.modal { background: var(--surface); border-radius: var(--radius-card); width: min(560px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; border: 1px solid var(--border); }
.modal.wide { width: min(880px, 100%); }
.modal.xl { width: min(1100px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 24px 12px; }
.modal-body { padding: 8px 24px 20px; overflow: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 24px 20px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.modal-foot .left { margin-right: auto; }
@media (max-width: 640px) { .modal-backdrop { padding: 0; align-items: flex-end; } .modal { max-height: 100vh; border-radius: 16px 16px 0 0; } }

/* 토스트 */
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 60; width: min(420px, calc(100% - 32px)); }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: var(--radius-control); background: var(--text-primary); color: #fff; font-size: var(--fs-help); box-shadow: 0 8px 24px rgba(16, 24, 40, 0.18); }
.toast.success .icon { color: #86EFAC; }
.toast.danger { background: var(--danger); }

/* 단계 표시 (학생) */
.stepper { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 16px 0; }
.step { display: flex; align-items: center; gap: 8px; color: var(--text-secondary); font-weight: 500; font-size: 15px; }
.step .no { width: 32px; height: 32px; border-radius: 50%; border: 1.5px solid var(--border-strong); display: grid; place-items: center; font-weight: 700; font-size: 15px; background: var(--surface); }
.step.active { color: var(--text-primary); font-weight: 700; }
.step.active .no { background: var(--brand); border-color: var(--brand); }
.step.done .no { background: var(--text-primary); border-color: var(--text-primary); color: #fff; }
.step.done .no .icon { width: 16px; height: 16px; stroke-width: 2.4; }
.step-line { width: 28px; height: 1.5px; background: var(--border-strong); }
@media (max-width: 380px) { .step-line { width: 14px; } .step { font-size: 14px; } }

/* 기타 */
.kbd { font-family: ui-monospace, monospace; font-size: 12px; padding: 1px 6px; border: 1px solid var(--border-strong); border-radius: 4px; background: var(--neutral-soft); }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 15px; letter-spacing: 0.05em; }
.pre { white-space: pre-wrap; font: inherit; background: var(--neutral-soft); border: 1px solid var(--border); border-radius: var(--radius-control); padding: 14px; max-height: 320px; overflow: auto; }
.demo-tag { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; color: var(--text-secondary); border: 1px dashed var(--border-strong); border-radius: 6px; padding: 1px 8px; }
.sr-only { position: absolute; left: -9999px; }
.thumb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.thumb { position: relative; border: 1px solid var(--border); border-radius: var(--radius-control); overflow: hidden; background: var(--neutral-soft); aspect-ratio: 3/4; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .thumb-pdf { height: 100%; display: grid; place-items: center; color: var(--text-secondary); font-size: 12px; font-weight: 600; }
.thumb .order { position: absolute; left: 6px; top: 6px; min-width: 22px; height: 22px; border-radius: 11px; background: var(--text-primary); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; padding: 0 6px; }
.thumb .state { position: absolute; right: 6px; top: 6px; }
.thumb .state .badge { min-height: 22px; padding: 0 6px; font-size: 11px; }
.thumb-actions { display: flex; justify-content: center; gap: 2px; padding: 4px; background: var(--surface); border-top: 1px solid var(--border); }
.thumb-actions .icon-btn { width: 36px; height: 36px; }
.thumb-wrap { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius-control); overflow: hidden; }
.thumb-wrap .thumb { border: 0; border-radius: 0; }
.thumb-wrap.failed { border-color: var(--danger); }
.upload-bar { height: 6px; background: var(--border); }
.upload-bar > span { display: block; height: 100%; background: var(--brand); transition: width .2s; }
.upload-bar.failed > span { background: var(--danger); }
