/* ============================================================
   Lumi — Personal AI Study Companion
   "지식의 빛" — 따뜻한 톤 + 노을 액센트
   ----
   구성:
   1. Reset / Tokens
   2. Layout (container / main / header / footer)
   3. Components (btn / card / chip / form / dropzone / status / flash)
   4. Page sections (hero / toolbar / doc-grid / upload / detail)
   5. Utilities
   6. Responsive — Mobile / Tablet / Desktop
   ============================================================ */

@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/variable/pretendardvariable-dynamic-subset.css');

/* ============================================================
   1. Reset / Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* HTML `hidden` 속성 — display 가 flex/grid/block 인 요소도 확실히 숨김 */
[hidden] { display: none !important; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
    font-family: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont,
                 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
    color: var(--ink-900);
    line-height: 1.6;
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img, svg { max-width: 100%; height: auto; display: block; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }
ul, ol { list-style: none; }

/* ============================================================
   Design Tokens
   ============================================================ */
:root {
    /* Brand */
    --amber-50:  #FFF8EC;
    --amber-100: #FFEFCF;
    --amber-200: #FBD89B;
    --amber-300: #F4B860;
    --amber-400: #ED9728;
    --amber-500: #C97A0E;
    --rose-100:  #FFE5DE;
    --rose-200:  #FFC4B5;
    --rose-400:  #FF7F65;
    --plum-700:  #4A2D5A;
    --plum-900:  #2C1A3C;
    --indigo-500: #5B6FE5;

    /* Ink / Surface */
    --ink-900: #1F1B16;
    --ink-700: #4B453E;
    --ink-500: #847C72;
    --ink-300: #B5ADA1;
    --line:    #EFE9DD;
    --bg:      #FDFAF3;
    --bg-card: #FFFFFF;
    --bg-alt:  #FAF4E5;

    --primary: var(--amber-400);
    --accent:  var(--rose-400);
    --success: #2BB67A;
    --danger:  #E94B4B;

    /* Fluid Type Scale */
    --fs-h1:   clamp(1.7rem, 4.5vw, 3rem);
    --fs-h2:   clamp(1.35rem, 3vw, 2rem);
    --fs-h3:   clamp(1.1rem, 2vw, 1.3rem);
    --fs-body: clamp(0.92rem, 1.3vw, 1rem);
    --fs-sm:   0.85rem;
    --fs-xs:   0.75rem;

    /* Spacing */
    --sp-1: 4px;   --sp-2: 8px;   --sp-3: 12px;
    --sp-4: 16px;  --sp-5: 24px;  --sp-6: 32px;
    --sp-8: 48px;  --sp-10: 64px;

    /* Layout */
    --container: 1180px;
    --container-narrow: 900px;
    --header-h: 64px;

    /* Radius */
    --r-sm: 6px;
    --r:    10px;
    --r-lg: 16px;
    --r-xl: 24px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(155, 110, 30, 0.08);
    --shadow:    0 4px 16px rgba(155, 110, 30, 0.10);
    --shadow-lg: 0 16px 40px rgba(155, 110, 30, 0.16);
    --glow:      0 0 32px rgba(244, 184, 96, 0.35);

    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --dur:  200ms;
}

/* ============================================================
   2. Layout
   ============================================================ */
.container {
    width: 100%;
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 var(--sp-5);
}
.container--narrow { max-width: var(--container-narrow); }

main {
    padding-top: calc(var(--header-h) + var(--sp-6));
    padding-bottom: var(--sp-10);
    min-height: calc(100vh - var(--header-h));
}

/* ===== Header ===== */
.header {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--header-h);
    background: rgba(253, 250, 243, 0.92);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
    z-index: 100;
}
.header__inner {
    height: 100%;
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 var(--sp-5);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-4);
}

/* Brand */
.brand {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    font-weight: 800;
    color: var(--ink-900);
    letter-spacing: -0.03em;
    font-size: 1.3rem;
    flex-shrink: 0;
}
.brand__icon {
    width: 32px; height: 32px;
    border-radius: 50%;
    background:
        radial-gradient(circle at 30% 30%, #FFF7DE 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, var(--amber-300) 0%, var(--amber-500) 100%);
    box-shadow: var(--glow);
    position: relative;
    flex-shrink: 0;
}
.brand__icon::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(244,184,96,0.4) 0%, transparent 70%);
    z-index: -1;
    animation: lumi-pulse 3s ease-in-out infinite;
}
@keyframes lumi-pulse {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50%      { opacity: 1;   transform: scale(1.15); }
}

/* Nav */
.header__nav {
    display: flex;
    align-items: center;
    gap: var(--sp-1);
    flex: 1;
    justify-content: center;
}
.nav-item {
    padding: 8px 14px;
    font-size: 0.93rem;
    font-weight: 500;
    color: var(--ink-700);
    border-radius: var(--r-sm);
    transition: all var(--dur) var(--ease);
    white-space: nowrap;
}
.nav-item:hover { background: var(--amber-50); color: var(--ink-900); }
.nav-item.is-active { background: var(--amber-100); color: var(--ink-900); font-weight: 600; }

.header__cta { display: flex; align-items: center; gap: var(--sp-2); flex-shrink: 0; }

/* Mobile toggle */
.mobile-toggle {
    display: none;
    width: 40px; height: 40px;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    background: transparent;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    cursor: pointer;
}
.mobile-toggle span {
    width: 18px; height: 2px;
    background: var(--ink-900);
    border-radius: 2px;
    transition: all var(--dur) var(--ease);
}
.mobile-toggle.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.mobile-toggle.is-open span:nth-child(2) { opacity: 0; }
.mobile-toggle.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile drawer */
.mobile-drawer {
    display: none;
    position: fixed;
    top: var(--header-h);
    left: 0; right: 0;
    background: var(--bg-card);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-lg);
    padding: var(--sp-4);
    z-index: 99;
    flex-direction: column;
    gap: var(--sp-2);
}
.mobile-drawer.is-open { display: flex; }
.mobile-drawer .nav-item {
    padding: 14px 16px;
    font-size: 1rem;
    border-radius: var(--r-sm);
}

/* Footer */
.footer {
    border-top: 1px solid var(--line);
    padding: var(--sp-5) 0;
    text-align: center;
    color: var(--ink-300);
    font-size: var(--fs-sm);
}

/* ============================================================
   3. Components
   ============================================================ */

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    padding: 12px 22px;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: var(--r-sm);
    cursor: pointer;
    transition: all var(--dur) var(--ease);
    border: 1px solid transparent;
    white-space: nowrap;
    background: transparent;
    color: inherit;
}
.btn--primary {
    background: var(--amber-400);
    color: #fff;
    box-shadow: 0 2px 8px rgba(237,151,40,0.3);
}
.btn--primary:hover {
    background: var(--amber-500);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(237,151,40,0.4);
}
.btn--outline {
    color: var(--ink-900);
    border-color: var(--line);
}
.btn--outline:hover {
    border-color: var(--amber-400);
    color: var(--amber-500);
}
.btn--ghost {
    color: var(--ink-700);
    padding: 8px 14px;
}
.btn--ghost:hover { background: var(--amber-50); color: var(--ink-900); }
.btn--danger {
    color: var(--danger);
    border-color: rgba(233,75,75,0.3);
}
.btn--danger:hover { background: var(--danger); color: #fff; }
.btn--lg { padding: 14px 28px; font-size: 1rem; }
.btn--sm { padding: 8px 14px; font-size: var(--fs-sm); }
.btn--block { width: 100%; }

/* ===== Flash 메시지 ===== */
.flash {
    padding: 12px 16px;
    border-radius: var(--r-sm);
    margin-bottom: var(--sp-5);
    font-size: var(--fs-sm);
}
.flash--success { background: rgba(43,182,122,0.1); color: #1a8856; }
.flash--error   { background: rgba(233,75,75,0.1); color: var(--danger); }
.flash--info    { background: var(--amber-50); color: var(--amber-500); }

/* ===== Chip ===== */
.chip {
    padding: 6px 12px;
    font-size: var(--fs-sm);
    color: var(--ink-700);
    background: var(--bg-alt);
    border-radius: 999px;
    transition: all var(--dur) var(--ease);
    cursor: pointer;
    border: 1px solid transparent;
    white-space: nowrap;
}
.chip:hover { background: var(--amber-100); }
.chip.is-active {
    background: var(--ink-900);
    color: #fff;
    font-weight: 500;
}
.chip-list { display: flex; gap: 6px; flex-wrap: wrap; }

/* ===== Form ===== */
.form-group { margin-bottom: var(--sp-5); }
.form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--ink-900);
    margin-bottom: var(--sp-2);
}
.form-group .label-hint {
    color: var(--ink-500);
    font-weight: 400;
    font-size: var(--fs-sm);
    margin-left: 6px;
}
.required { color: var(--danger); }

.form-control {
    width: 100%;
    padding: 12px 14px;
    font-size: 0.95rem;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: var(--bg);
    color: var(--ink-900);
    transition: all var(--dur) var(--ease);
}
.form-control:focus {
    outline: none;
    border-color: var(--amber-400);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(244,184,96,0.15);
}
textarea.form-control { min-height: 120px; resize: vertical; }

/* ===== Dropzone ===== */
.dropzone {
    border: 2px dashed var(--line);
    border-radius: var(--r);
    padding: var(--sp-8);
    text-align: center;
    color: var(--ink-500);
    cursor: pointer;
    transition: all var(--dur) var(--ease);
    background: var(--bg-alt);
    display: block;
}
.dropzone:hover, .dropzone.is-drag-over {
    border-color: var(--amber-400);
    background: var(--amber-50);
    color: var(--amber-500);
}
.dropzone__icon { font-size: 3rem; margin-bottom: var(--sp-3); }
.dropzone__hint { font-size: var(--fs-sm); margin-top: var(--sp-2); }
.dropzone input[type=file] { display: none; }
.dropzone__file-name {
    margin-top: var(--sp-3);
    padding: 8px 14px;
    background: #fff;
    border-radius: var(--r-sm);
    color: var(--ink-900);
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===== Card ===== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: var(--sp-6);
}
.card--alt { background: var(--bg-alt); }
.card--warning {
    background: var(--amber-50);
    border-color: var(--amber-200);
}
.card--error {
    background: rgba(233,75,75,0.05);
    border-color: rgba(233,75,75,0.3);
}

/* ===== Status Badge ===== */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-bottom: var(--sp-3);
}
.status-badge--processing { background: var(--amber-100); color: var(--amber-500); }
.status-badge--done       { background: rgba(43,182,122,0.12); color: var(--success); }
.status-badge--fail       { background: rgba(233,75,75,0.12); color: var(--danger); }
.status-badge--ready      { background: var(--bg-alt); color: var(--ink-500); }

.dot {
    display: inline-block;
    width: 6px; height: 6px;
    border-radius: 50%;
    background: currentColor;
}
.status-badge--processing .dot { animation: blink 1.2s ease-in-out infinite; }
@keyframes blink {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.3; }
}

/* ===== Action Bar (버튼 묶음) ===== */
.action-bar {
    display: flex;
    gap: var(--sp-2);
    flex-wrap: wrap;
}
.action-bar--equal > * { flex: 1; }
.action-bar--right { justify-content: flex-end; }

/* ============================================================
   4. Page Sections
   ============================================================ */

/* ===== Hero ===== */
.hero {
    text-align: center;
    padding: var(--sp-10) var(--sp-4) var(--sp-8);
    position: relative;
    overflow: hidden;
}
.hero::before {
    content: '';
    position: absolute;
    width: 400px; height: 400px;
    top: -200px; left: 50%;
    transform: translateX(-50%);
    background: radial-gradient(circle, rgba(244,184,96,0.25) 0%, transparent 70%);
    pointer-events: none;
}
.hero__eyebrow {
    display: inline-block;
    padding: 6px 14px;
    background: var(--amber-100);
    color: var(--amber-500);
    border-radius: 999px;
    font-size: var(--fs-xs);
    font-weight: 600;
    letter-spacing: 0.05em;
    margin-bottom: var(--sp-5);
}
.hero h1 {
    font-size: var(--fs-h1);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.2;
    margin-bottom: var(--sp-4);
}
.hero h1 em {
    font-style: normal;
    background: linear-gradient(135deg, var(--amber-400), var(--rose-400));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.hero p {
    font-size: var(--fs-body);
    color: var(--ink-500);
    max-width: 540px;
    margin: 0 auto var(--sp-6);
}

/* ===== Page Title (서브 페이지 헤더) ===== */
.page-title {
    text-align: center;
    margin-bottom: var(--sp-6);
}
.page-title h1 {
    font-size: var(--fs-h2);
    font-weight: 800;
    letter-spacing: -0.02em;
    margin: var(--sp-3) 0;
}
.page-title p {
    color: var(--ink-500);
    font-size: var(--fs-body);
}

/* ===== Toolbar ===== */
.toolbar {
    display: flex;
    gap: var(--sp-3);
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: var(--sp-6);
    padding: var(--sp-4);
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--r);
}
.toolbar__search {
    flex: 1;
    min-width: 200px;
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    padding: 8px 14px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    margin: 0;
}
.toolbar__search input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    font-size: 0.95rem;
    color: var(--ink-900);
    min-width: 0;
}
.toolbar__search input::placeholder { color: var(--ink-300); }

/* ===== Document Grid ===== */
.doc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--sp-5);
}
.doc-card {
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: var(--sp-5);
    transition: all var(--dur) var(--ease);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 220px;
}
.doc-card:hover {
    border-color: var(--amber-300);
    box-shadow: var(--shadow);
    transform: translateY(-3px);
}
.doc-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 3px;
    background: linear-gradient(90deg, var(--amber-300), var(--rose-200));
    opacity: 0;
    transition: opacity var(--dur) var(--ease);
}
.doc-card:hover::before { opacity: 1; }

.doc-card__category {
    font-size: var(--fs-xs);
    font-weight: 700;
    color: var(--amber-500);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: var(--sp-2);
}
.doc-card__course {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: var(--fs-xs);
    font-weight: 600;
    color: var(--ink-700);
    padding: 4px 10px;
    background: var(--bg-alt);
    border-radius: 999px;
    margin-bottom: var(--sp-2);
}
.doc-card__title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--ink-900);
    line-height: 1.35;
    margin-bottom: var(--sp-3);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.doc-card__summary {
    font-size: 0.9rem;
    color: var(--ink-500);
    line-height: 1.6;
    margin-bottom: var(--sp-4);
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.doc-card__meta {
    display: flex;
    gap: var(--sp-3);
    font-size: var(--fs-xs);
    color: var(--ink-500);
    padding-top: var(--sp-3);
    border-top: 1px solid var(--line);
    flex-wrap: wrap;
}
.doc-card__meta span { display: inline-flex; align-items: center; gap: 4px; }

/* ===== Empty State ===== */
.empty {
    text-align: center;
    padding: var(--sp-10) var(--sp-5);
    color: var(--ink-500);
}
.empty__icon {
    font-size: 4rem;
    margin-bottom: var(--sp-4);
    opacity: 0.5;
}
.empty h3 {
    font-size: 1.2rem;
    color: var(--ink-700);
    margin-bottom: var(--sp-3);
}

/* ===== Upload Card ===== */
.upload-card {
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: var(--sp-8);
    max-width: 720px;
    margin: 0 auto;
    box-shadow: var(--shadow-sm);
}

/* ============================================================
   5. 기출문제 (Exam) — 카드 / 퀴즈 / 결과
   ============================================================ */

/* === 기출 카드 (목록) === */
.doc-card--exam {
    border-left: 4px solid var(--rose-400);
}
.doc-card--exam:hover { border-left-color: var(--amber-400); }

.status-badge--exam {
    background: linear-gradient(135deg, var(--amber-100), var(--rose-100));
    color: var(--ink-900);
}

.status-badge--done {
    background: #DCFCE7;
    color: #166534;
}

/* === Phase 5d — 정답률 뱃지 + 시도 이력 === */
.accuracy-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: var(--fs-xs);
    font-weight: 700;
    letter-spacing: 0.01em;
    white-space: nowrap;
}
.accuracy-badge--great { background: #DCFCE7; color: #166534; }     /* 90+ */
.accuracy-badge--good  { background: #DBEAFE; color: #1E3A8A; }     /* 75~89 */
.accuracy-badge--fair  { background: var(--amber-100); color: #94530A; } /* 60~74 */
.accuracy-badge--low   { background: #FEE2E2; color: #991B1B; }     /* ~59 */
.accuracy-badge--none  { background: var(--bg-alt); color: var(--ink-500); }

/* 시도 이력 카드 */
.attempts-section h3 { margin-bottom: var(--sp-3); }
.attempt-list {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
}
.attempt-row {
    display: grid;
    grid-template-columns: 70px auto 60px 60px 80px auto 1fr auto;
    /*                      회차 유형뱃지 점수 정답률 등급 오답버튼 시간 결과화살표 */
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-4);
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-left: 4px solid var(--ink-300);
    border-radius: var(--r-sm);
    color: var(--ink-700);
    font-size: var(--fs-sm);
    transition: all 0.15s ease;
}

/* 자식 행들 (오답 재도전) — 부모 회차 아래 들여쓰기 */
.attempt-children {
    margin-left: var(--sp-5);
    padding-left: var(--sp-3);
    border-left: 2px dashed var(--amber-200);
    margin-top: -2px;          /* 부모와 시각적으로 붙음 */
    margin-bottom: var(--sp-2);
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
    padding-top: var(--sp-2);
}
.attempt-row--child {
    background: var(--bg-alt);
    border-color: var(--line);
    font-size: 0.85rem;
    padding: var(--sp-2) var(--sp-3);
}
.attempt-row__child-num {
    font-weight: 600;
    color: var(--ink-500);
    font-size: var(--fs-xs);
}

/* 풀이 유형 뱃지 — 전체 / 오답 */
.attempt-type {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: var(--fs-xs);
    font-weight: 700;
    white-space: nowrap;
    letter-spacing: 0.01em;
}
.attempt-type--full {
    background: var(--amber-100);
    color: #94530A;
}
.attempt-type--retry {
    background: #E0E7FF;       /* indigo-100 */
    color: #3730A3;            /* indigo-800 */
}
.attempt-row:hover {
    border-color: var(--amber-400);
}
.attempt-row.accuracy-good  { border-left-color: #22C55E; }
.attempt-row.accuracy-fair  { border-left-color: var(--amber-400); }
.attempt-row.accuracy-low   { border-left-color: var(--rose-400); }
.attempt-row__num {
    font-weight: 700;
    color: var(--ink-900);
}
.attempt-row__score {
    color: var(--ink-700);
    white-space: nowrap;
}
.attempt-row__percent {
    font-weight: 700;
    color: var(--amber-500);
    text-align: right;
    white-space: nowrap;
}
.attempt-row__grade {
    color: var(--ink-700);
    font-weight: 600;
    text-align: center;
    padding: 2px 8px;
    background: var(--bg-alt);
    border-radius: 999px;
    font-size: var(--fs-xs);
}
.attempt-row__wrong-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--rose-100);
    color: #991B1B;
    border-radius: 999px;
    font-size: var(--fs-xs);
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    border: 1px solid transparent;
    transition: all 0.15s ease;
}
.attempt-row__wrong-btn:hover {
    background: var(--rose-400);
    color: #fff;
    transform: scale(1.04);
}
.attempt-row__perfect {
    padding: 4px 10px;
    background: #DCFCE7;
    color: #166534;
    border-radius: 999px;
    font-size: var(--fs-xs);
    font-weight: 700;
    white-space: nowrap;
}
.attempt-row__time {
    color: var(--ink-500);
    font-size: var(--fs-xs);
    text-align: right;
    white-space: nowrap;
}
.attempt-row__result-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-alt);
    color: var(--ink-700);
    text-decoration: none;
    font-weight: 700;
    font-size: 1rem;
    transition: all 0.15s ease;
}
.attempt-row__result-btn:hover {
    background: var(--amber-400);
    color: #fff;
    transform: translateX(2px);
}

@media (max-width: 768px) {
    .attempt-row {
        grid-template-columns: 50px 1fr auto auto;
        grid-template-rows: auto auto auto;
        gap: var(--sp-2) var(--sp-3);
    }
    .attempt-row__num    { grid-column: 1; grid-row: 1; }
    .attempt-type        { grid-column: 2; grid-row: 1; justify-self: start; }
    .attempt-row__score  { grid-column: 3; grid-row: 1; }
    .attempt-row__percent{ grid-column: 4; grid-row: 1; }
    .attempt-row__grade  { grid-column: 1 / 3; grid-row: 2; justify-self: start; }
    .attempt-row__wrong-btn,
    .attempt-row__perfect { grid-column: 3 / 5; grid-row: 2; justify-self: end; }
    .attempt-row__time   { grid-column: 1 / 4; grid-row: 3; text-align: left;
                            color: var(--ink-300); }
    .attempt-row__result-btn { grid-column: 4; grid-row: 3; justify-self: end; }
}

/* === 정답 신뢰도 뱃지 === */
.confidence-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: var(--fs-xs);
    font-weight: 600;
}
.confidence-badge--high { background: #DCFCE7; color: #166534; }
.confidence-badge--low  { background: var(--amber-100); color: #94530A; }

/* === 이미지 모드 풀이 (test) — 문제 본문 자체가 OCR 크롭 이미지 === */
.quiz-image-body {
    margin: 0 0 var(--sp-4);
    padding: var(--sp-2);
    background: #FFFFFF;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    overflow: hidden;
    text-align: center;
}
.quiz-image-body img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 0 auto;
    border-radius: 4px;
}
.quiz-image-body--fallback {
    border-color: var(--amber-200);
    background: var(--amber-50);
}
.quiz-image-body__note {
    margin: var(--sp-2) 0 0;
    color: var(--ink-500);
    font-size: var(--fs-xs);
}

/* === 페이지 원본 이미지 토글 (도식/표 검증용) === */
.page-image-toggle {
    margin-left: auto;
    padding: 4px 10px;
    border: 1px solid var(--amber-200);
    background: var(--amber-50);
    color: var(--amber-500);
    border-radius: 999px;
    font-size: var(--fs-xs);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}
.page-image-toggle:hover {
    background: var(--amber-100);
    border-color: var(--amber-400);
}
.page-image-toggle[aria-expanded="true"] {
    background: var(--amber-400);
    color: #fff;
    border-color: var(--amber-400);
}
.page-image-box {
    margin: var(--sp-3) 0;
    padding: var(--sp-2);
    background: var(--bg-alt);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    overflow: hidden;
}
.page-image-box img {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    background: #fff;     /* PDF 가 투명 배경일 때 흰색 */
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

/* === 미리보기 카드 === */
.quiz-preview {
    display: flex;
    flex-direction: column;
    gap: var(--sp-4);
}
.quiz-card {
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: var(--sp-5);
    box-shadow: var(--shadow-sm);
}
.quiz-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-2);
    margin-bottom: var(--sp-3);
}
.quiz-card__ord {
    font-weight: 700;
    color: var(--amber-500);
    font-size: var(--fs-sm);
}
.quiz-card__question {
    font-size: 1.05rem;
    color: var(--ink-900);
    margin: 0 0 var(--sp-4);
    line-height: 1.6;
    white-space: pre-wrap;
}
.quiz-card__choices {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
}
.quiz-card__choices li {
    padding: var(--sp-3) var(--sp-4);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    color: var(--ink-700);
    line-height: 1.6;
}
.quiz-card__choices li.is-correct {
    background: #DCFCE7;
    border-color: #86EFAC;
    color: #14532D;
    font-weight: 600;
}
.quiz-card__choices li.is-correct::before { content: "✓ "; color: #166534; }

.quiz-card__explanation {
    margin-top: var(--sp-3);
    padding: var(--sp-3);
    background: var(--bg-alt);
    border-radius: var(--r-sm);
    font-size: var(--fs-sm);
    color: var(--ink-700);
}
.quiz-card__explanation summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--amber-500);
}
.quiz-card__explanation > div {
    margin-top: var(--sp-2);
    line-height: 1.7;
}

/* === 풀이 페이지 === */
.quiz-hero {
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: var(--sp-5);
    margin-bottom: var(--sp-5);
    box-shadow: var(--shadow-sm);
}
.quiz-hero h1 {
    margin: var(--sp-2) 0;
    color: var(--ink-900);
}
.quiz-hero p {
    color: var(--ink-500);
    margin-bottom: var(--sp-4);
}
.quiz-progress {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
}
.quiz-progress__bar {
    flex: 1;
    height: 10px;
    background: var(--bg-alt);
    border-radius: 999px;
    overflow: hidden;
}
.quiz-progress__fill {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--amber-400), var(--rose-400));
    border-radius: 999px;
    transition: width 300ms ease;
}
.quiz-progress__text {
    color: var(--ink-700);
    font-size: var(--fs-sm);
    font-weight: 600;
    white-space: nowrap;
}

.quiz-choices {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
}
.quiz-choice {
    display: flex;
    align-items: flex-start;
    gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-4);
    border: 1.5px solid var(--line);
    border-radius: var(--r-sm);
    cursor: pointer;
    transition: all 0.15s ease;
    background: var(--bg-card);
}
.quiz-choice:hover {
    border-color: var(--amber-400);
    background: var(--amber-50);
}
.quiz-choice input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    display: none;
}
.quiz-choice__letter {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-alt);
    color: var(--ink-700);
    font-weight: 700;
    font-size: var(--fs-sm);
    transition: all 0.15s ease;
}
.quiz-choice__text {
    flex: 1;
    color: var(--ink-700);
    line-height: 1.6;
    padding-top: 4px;
}
.quiz-choice:has(input:checked) {
    border-color: var(--amber-400);
    background: var(--amber-50);
}
.quiz-choice:has(input:checked) .quiz-choice__letter {
    background: var(--amber-400);
    color: #fff;
}
.quiz-card.is-answered {
    border-color: var(--amber-200);
}

/* === 결과 화면 === */
.result-hero {
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: var(--sp-8) var(--sp-5);
    margin-bottom: var(--sp-4);
    box-shadow: var(--shadow);
    text-align: center;
    background-image:
        radial-gradient(circle at 50% 0%, var(--amber-100), transparent 60%);
}
.result-hero--good { background-image: radial-gradient(circle at 50% 0%, #BBF7D0, transparent 60%); }
.result-hero--fair { background-image: radial-gradient(circle at 50% 0%, var(--amber-200), transparent 60%); }
.result-hero--low  { background-image: radial-gradient(circle at 50% 0%, var(--rose-100), transparent 60%); }
.result-hero__grade {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--ink-700);
    margin-bottom: var(--sp-3);
    letter-spacing: 0.05em;
}
.result-hero__score {
    font-size: 3.5rem;
    font-weight: 800;
    color: var(--ink-900);
    line-height: 1;
}
.result-hero__score-num   { color: var(--amber-500); }
.result-hero__score-sep   { color: var(--ink-300); margin: 0 8px; }
.result-hero__score-total { color: var(--ink-500); font-size: 2.5rem; }
.result-hero__percent {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--amber-500);
    margin-top: var(--sp-2);
}
.result-hero__title {
    margin-top: var(--sp-4);
    color: var(--ink-900);
    font-weight: 600;
}
.result-hero__time {
    color: var(--ink-500);
    font-size: var(--fs-sm);
    margin-top: 4px;
}

.result-list {
    display: flex;
    flex-direction: column;
    gap: var(--sp-4);
}
.quiz-card--result.is-correct { border-left: 4px solid #22C55E; }
.quiz-card--result.is-wrong   { border-left: 4px solid #EF4444; }

.result-mark {
    padding: 4px 12px;
    border-radius: 999px;
    font-size: var(--fs-sm);
    font-weight: 700;
}
.result-mark--ok { background: #DCFCE7; color: #166534; }
.result-mark--ng { background: #FEE2E2; color: #991B1B; }

.quiz-choices--result .quiz-choice {
    cursor: default;
    position: relative;
}
.quiz-choices--result .quiz-choice:hover {
    border-color: var(--line);
    background: var(--bg-card);
}
.quiz-choice.is-correct-answer {
    border-color: #86EFAC !important;
    background: #DCFCE7 !important;
}
.quiz-choice.is-correct-answer .quiz-choice__letter {
    background: #22C55E;
    color: #fff;
}
.quiz-choice.is-user-wrong {
    border-color: #FCA5A5 !important;
    background: #FEE2E2 !important;
}
.quiz-choice.is-user-wrong .quiz-choice__letter {
    background: #EF4444;
    color: #fff;
}
.quiz-choice__mark {
    margin-left: auto;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(255,255,255,0.6);
    font-size: var(--fs-xs);
    font-weight: 700;
    color: var(--ink-900);
    align-self: center;
    white-space: nowrap;
}
.quiz-skipped {
    padding: var(--sp-3);
    text-align: center;
    color: var(--ink-500);
    font-style: italic;
    border: 1px dashed var(--line);
    border-radius: var(--r-sm);
}

.quiz-card__explanation-box {
    margin-top: var(--sp-4);
    padding: var(--sp-3) var(--sp-4);
    background: var(--bg-alt);
    border-left: 3px solid var(--amber-400);
    border-radius: var(--r-sm);
    color: var(--ink-700);
    line-height: 1.7;
}
.quiz-card__explanation-box strong {
    display: block;
    margin-bottom: var(--sp-2);
    color: var(--amber-500);
}

/* === 답안 미리보기 패널 (정답 포함, 기본 hidden) === */
.preview-panel {
    padding: 0;
    overflow: hidden;
}
.preview-panel__body {
    padding: var(--sp-4);
    max-height: 70vh;
    overflow-y: auto;
}
.preview-panel__hint {
    margin: 0 0 var(--sp-4);
    padding: var(--sp-3) var(--sp-4);
    background: var(--amber-100);
    border-left: 3px solid var(--amber-400);
    border-radius: var(--r-sm);
    color: var(--ink-700);
    font-size: var(--fs-sm);
    line-height: 1.6;
}

/* === 원본 텍스트 뷰어 (디버깅용) === */
.raw-text-viewer {
    padding: 0;
    overflow: hidden;
}
.raw-text-viewer__body {
    margin: 0;
    padding: var(--sp-4);
    background: var(--ink-900);
    color: #FDE7C2;
    font-family: 'D2Coding', 'Consolas', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    max-height: 500px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

/* 반응형 */
@media (max-width: 768px) {
    .quiz-card { padding: var(--sp-4); }
    .quiz-choice { padding: var(--sp-3); }
    .result-hero__score { font-size: 2.5rem; }
    .result-hero__score-total { font-size: 1.8rem; }
}

/* ============================================================
   6. 업로드 빈 카드 (기존)
   ============================================================ */

/* 코스가 0개일 때 안내 카드 */
.upload-empty {
    text-align: center;
    padding: var(--sp-6) var(--sp-3);
}
.upload-empty__icon {
    font-size: 3.5rem;
    margin-bottom: var(--sp-3);
    opacity: 0.9;
}
.upload-empty h2 {
    font-size: 1.4rem;
    color: var(--ink-900);
    margin-bottom: var(--sp-3);
}
.upload-empty p {
    color: var(--ink-500);
    line-height: 1.7;
    margin-bottom: var(--sp-4);
}

/* 가로 2열 폼 행 */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-4);
}

/* ===== Detail Page ===== */
.detail-section {
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: var(--sp-6);
    margin-bottom: var(--sp-5);
}
.detail-section h1 {
    font-size: clamp(1.4rem, 3vw, 1.75rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: var(--sp-3);
    line-height: 1.3;
}
.detail-section h3 {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: var(--sp-4);
    color: var(--ink-900);
}
.detail-section h3 .icon { font-size: 1.3rem; }

.detail-category {
    font-size: var(--fs-xs);
    font-weight: 700;
    color: var(--amber-500);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: var(--sp-2);
}

.detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-4);
    font-size: var(--fs-sm);
    color: var(--ink-500);
    margin-bottom: var(--sp-4);
}
.detail-body {
    color: var(--ink-700);
    line-height: 1.85;
    font-size: var(--fs-body);
    white-space: pre-wrap;
    word-break: break-word;
}

.key-list { display: flex; flex-direction: column; gap: var(--sp-3); }
.key-list li {
    padding: var(--sp-3) var(--sp-4);
    background: var(--bg-alt);
    border-radius: var(--r-sm);
    border-left: 3px solid var(--amber-400);
    color: var(--ink-700);
    font-size: 0.95rem;
}

.keyword-list { display: flex; gap: 8px; flex-wrap: wrap; }
.keyword {
    padding: 6px 12px;
    background: linear-gradient(135deg, var(--amber-100), var(--rose-100));
    color: var(--ink-900);
    border-radius: 999px;
    font-size: var(--fs-sm);
    font-weight: 500;
}

/* ===== 정리 노트 (마크다운 렌더링) ===== */
.doc-notes {
    color: var(--ink-700);
    font-size: 1rem;
    line-height: 1.75;
    word-break: break-word;
}
.doc-notes > *:first-child { margin-top: 0; }
.doc-notes > *:last-child  { margin-bottom: 0; }

/* 헤딩 */
.doc-notes h1,
.doc-notes h2,
.doc-notes h3,
.doc-notes h4 {
    color: var(--ink-900);
    font-weight: 700;
    line-height: 1.3;
    margin-top: var(--sp-6);
    margin-bottom: var(--sp-3);
}
.doc-notes h1 { font-size: 1.6rem; padding-bottom: var(--sp-2); border-bottom: 2px solid var(--amber-200); }
.doc-notes h2 {
    font-size: 1.3rem;
    padding-left: var(--sp-3);
    border-left: 4px solid var(--amber-400);
}
.doc-notes h3 {
    font-size: 1.1rem;
    color: var(--amber-500);
}
.doc-notes h4 { font-size: 1rem; color: var(--ink-700); }

/* 단락 */
.doc-notes p {
    margin: var(--sp-3) 0;
}

/* 리스트 */
.doc-notes ul,
.doc-notes ol {
    margin: var(--sp-3) 0;
    padding-left: var(--sp-5);
}
.doc-notes li {
    margin: 4px 0;
}
.doc-notes ul li::marker { color: var(--amber-400); }
.doc-notes ol li::marker { color: var(--amber-500); font-weight: 600; }
.doc-notes li > ul,
.doc-notes li > ol { margin: 4px 0; }

/* 강조 */
.doc-notes strong { color: var(--ink-900); font-weight: 700; }
.doc-notes em     { color: var(--ink-700); font-style: italic; }

/* 인용 (시험 직전 보면 좋은 주의사항) */
.doc-notes blockquote {
    margin: var(--sp-4) 0;
    padding: var(--sp-3) var(--sp-4);
    background: linear-gradient(135deg, var(--amber-100), var(--rose-100));
    border-left: 4px solid var(--rose-400);
    border-radius: var(--r-sm);
    color: var(--ink-900);
    font-style: normal;
}
.doc-notes blockquote p { margin: 0; }
.doc-notes blockquote p + p { margin-top: var(--sp-2); }

/* 코드 (공식/예시) */
.doc-notes code {
    padding: 2px 6px;
    background: var(--bg-alt);
    border: 1px solid var(--line);
    border-radius: 4px;
    font-family: 'D2Coding', 'Consolas', 'Menlo', monospace;
    font-size: 0.92em;
    color: var(--amber-500);
}
.doc-notes pre {
    margin: var(--sp-3) 0;
    padding: var(--sp-3) var(--sp-4);
    background: var(--ink-900);
    border-radius: var(--r-sm);
    overflow-x: auto;
}
.doc-notes pre code {
    padding: 0;
    background: transparent;
    border: 0;
    color: #FDE7C2;
    font-size: 0.9em;
    line-height: 1.6;
}

/* 표 */
.doc-notes table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--sp-3) 0;
    font-size: 0.95rem;
}
.doc-notes th,
.doc-notes td {
    padding: var(--sp-2) var(--sp-3);
    border: 1px solid var(--line);
    text-align: left;
}
.doc-notes th {
    background: var(--bg-alt);
    color: var(--ink-900);
    font-weight: 600;
}
.doc-notes tr:nth-child(even) td { background: var(--bg-alt); }

/* 구분선 */
.doc-notes hr {
    margin: var(--sp-5) 0;
    border: 0;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--amber-200), transparent);
}

/* 링크 */
.doc-notes a {
    color: var(--amber-500);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.doc-notes a:hover { color: var(--amber-400); }

/* ===== PDF Viewer (토글) ===== */
.pdf-viewer {
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    overflow: hidden;
    margin-bottom: var(--sp-5);
    box-shadow: var(--shadow);
    animation: pdf-viewer-fade-in 240ms var(--ease);
}
@keyframes pdf-viewer-fade-in {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.pdf-viewer__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-4);
    background: var(--bg-alt);
    border-bottom: 1px solid var(--line);
}
.pdf-viewer__title {
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--ink-900);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}
.pdf-viewer__close {
    width: 32px;
    height: 32px;
    border-radius: var(--r-sm);
    border: 1px solid var(--line);
    background: var(--bg-card);
    color: var(--ink-500);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--dur) var(--ease);
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.pdf-viewer__close:hover {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
    transform: rotate(90deg);
}
.pdf-viewer__frame {
    width: 100%;
    height: 720px;
    border: none;
    display: block;
    background: var(--ink-300);
}
@media (max-width: 768px) {
    .pdf-viewer__frame { height: 560px; }
}
@media (max-width: 480px) {
    .pdf-viewer__frame { height: 70vh; }
    .pdf-viewer__bar { padding: var(--sp-2) var(--sp-3); }
}

/* ============================================================
   4e2. User Menu (헤더 우측 프로필)
   ============================================================ */
.user-menu {
    position: relative;
    flex-shrink: 0;
}
.user-menu__toggle {
    width: 38px; height: 38px;
    border-radius: 50%;
    border: 2px solid var(--line);
    background: transparent;
    cursor: pointer;
    padding: 0;
    overflow: hidden;
    transition: border-color var(--dur) var(--ease);
}
.user-menu__toggle:hover { border-color: var(--amber-300); }
.user-menu.is-open .user-menu__toggle {
    border-color: var(--amber-400);
    box-shadow: 0 0 0 3px rgba(244,184,96,0.15);
}
.user-menu__avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
}
.user-menu__avatar--lg {
    width: 44px; height: 44px;
    border-radius: 50%;
    font-size: 1.1rem;
    flex-shrink: 0;
}
.user-menu__panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 260px;
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--r);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: all var(--dur) var(--ease);
    z-index: 110;
}
.user-menu.is-open .user-menu__panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.user-menu__head {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-3);
    min-width: 0;
}
.user-menu__head > div { min-width: 0; flex: 1; }
.user-menu__name {
    font-weight: 700;
    color: var(--ink-900);
    font-size: 0.95rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.user-menu__email {
    color: var(--ink-500);
    font-size: var(--fs-xs);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.user-menu__divider {
    height: 1px;
    background: var(--line);
    margin: 4px 0;
}
.user-menu__item {
    display: block;
    padding: 10px 12px;
    border-radius: var(--r-sm);
    color: var(--ink-700);
    font-size: 0.9rem;
    text-decoration: none;
    transition: background var(--dur) var(--ease);
}
.user-menu__item:hover {
    background: var(--amber-50);
    color: var(--ink-900);
}

/* ============================================================
   4e3. Role Badge & Admin UI
   ============================================================ */
.role-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    font-size: var(--fs-xs);
    font-weight: 700;
    border-radius: 999px;
    letter-spacing: 0.03em;
}
.role-badge--admin {
    background: linear-gradient(135deg, var(--indigo-500), var(--plum-700));
    color: #fff;
}
.role-badge--user {
    background: var(--bg-alt);
    color: var(--ink-500);
}
.role-badge--sm {
    font-size: 0.65rem;
    padding: 2px 6px;
    margin-left: 6px;
    vertical-align: middle;
}

.nav-item--admin {
    color: var(--indigo-500) !important;
    font-weight: 600;
}
.nav-item--admin:hover {
    background: rgba(91,111,229,0.08) !important;
    color: var(--plum-700) !important;
}
.nav-item--admin.is-active {
    background: rgba(91,111,229,0.15) !important;
}

/* ===== 사용자 관리 테이블 ===== */
.user-table-wrap {
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    overflow: hidden;
    overflow-x: auto;
}
.user-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}
.user-table thead {
    background: var(--bg-alt);
}
.user-table th, .user-table td {
    padding: var(--sp-3) var(--sp-4);
    text-align: left;
    border-bottom: 1px solid var(--line);
}
.user-table th {
    font-size: var(--fs-xs);
    font-weight: 700;
    color: var(--ink-500);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    white-space: nowrap;
}
.user-table tbody tr:last-child td { border-bottom: none; }
.user-table tbody tr:hover { background: var(--amber-50); }
.user-table .actions-col { text-align: right; }

.user-cell {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
}
.user-cell__avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
    font-size: 0.9rem;
}
.user-cell__info { min-width: 0; }
.user-cell__name {
    font-weight: 600;
    color: var(--ink-900);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.user-cell__me {
    background: var(--amber-100);
    color: var(--amber-500);
    font-size: var(--fs-xs);
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
}
.user-cell__email,
.user-cell__date {
    color: var(--ink-500);
    font-size: var(--fs-sm);
}
.user-cell__email-sm {
    color: var(--ink-500);
    font-size: var(--fs-xs);
    margin-top: 2px;
}

@media (min-width: 769px) {
    .user-cell__email-sm { display: none; }
}
@media (max-width: 768px) {
    .hide-sm { display: none; }
    .user-table th, .user-table td { padding: var(--sp-3); }
    .user-table .actions-col { white-space: nowrap; }
}

/* ============================================================
   4e2. Admin · Storage 사용량
   ============================================================ */

/* 보조 페이지 타이틀 (h2 작은 헤딩) */
.page-title--small {
    margin-top: var(--sp-6);
    margin-bottom: var(--sp-4);
}
.page-title--small h2 {
    font-size: 1.25rem;
    color: var(--ink-900);
    margin: 0 0 var(--sp-1);
}
.page-title--small p {
    color: var(--ink-500);
    font-size: var(--fs-sm);
    margin: 0;
}

/* 숫자 컬럼 — 우측 정렬 */
.user-table .num-col { text-align: right; white-space: nowrap; }

/* === 스토리지 모드 메타 카드 === */
.storage-meta {
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: var(--sp-4) var(--sp-5);
    margin-bottom: var(--sp-5);
    box-shadow: var(--shadow-sm);
}
.storage-meta__row {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-2) 0;
    border-bottom: 1px dashed var(--line);
}
.storage-meta__row:last-child { border-bottom: 0; }
.storage-meta__label {
    min-width: 110px;
    color: var(--ink-500);
    font-size: var(--fs-sm);
    font-weight: 500;
}
.storage-meta code {
    font-family: 'D2Coding', 'Consolas', 'Menlo', monospace;
    font-size: 0.92rem;
    padding: 2px 8px;
    background: var(--bg-alt);
    border: 1px solid var(--line);
    border-radius: 4px;
    color: var(--ink-900);
    word-break: break-all;
}
.storage-mode-pill {
    padding: 4px 12px;
    border-radius: 999px;
    font-size: var(--fs-sm);
    font-weight: 600;
}
.storage-mode-pill--s3 {
    background: linear-gradient(135deg, var(--amber-100), var(--rose-100));
    color: var(--ink-900);
}
.storage-mode-pill--disk {
    background: var(--bg-alt);
    color: var(--ink-700);
    border: 1px dashed var(--line);
}

/* === 전체 합계 카드 3개 (가로 그리드) === */
.storage-overview {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--sp-4);
    margin-bottom: var(--sp-5);
}
.storage-overview__card {
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: var(--sp-5);
    box-shadow: var(--shadow-sm);
}
.storage-overview__label {
    color: var(--ink-500);
    font-size: var(--fs-sm);
    margin-bottom: var(--sp-2);
}
.storage-overview__value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--ink-900);
    line-height: 1.1;
}
.storage-overview__sub {
    color: var(--ink-500);
    font-size: var(--fs-sm);
    margin-top: 4px;
}
.storage-overview__pct {
    color: var(--ink-700);
    font-size: var(--fs-sm);
    text-align: right;
    margin-top: 4px;
    font-weight: 600;
}

/* === 게이지 (큰 막대) === */
.storage-gauge {
    margin-top: var(--sp-3);
    height: 10px;
    background: var(--bg-alt);
    border-radius: 999px;
    overflow: hidden;
}
.storage-gauge__fill {
    height: 100%;
    width: 0;
    border-radius: 999px;
    transition: width 600ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.storage-gauge--ok      .storage-gauge__fill { background: linear-gradient(90deg, #6EC8B5, var(--amber-400)); }
.storage-gauge--warning .storage-gauge__fill { background: linear-gradient(90deg, var(--amber-400), #E37D2F); }
.storage-gauge--danger  .storage-gauge__fill { background: linear-gradient(90deg, var(--rose-400), #C9342B); }

/* === 사용자별 막대 (테이블 안 작은 막대) === */
.storage-bar {
    display: inline-block;
    width: 140px;
    height: 8px;
    background: var(--bg-alt);
    border-radius: 999px;
    overflow: hidden;
    vertical-align: middle;
}
.storage-bar__fill {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--amber-400), var(--rose-400));
    border-radius: 999px;
    transition: width 500ms ease;
}
.storage-bar__label {
    display: inline-block;
    margin-left: var(--sp-2);
    color: var(--ink-700);
    font-size: var(--fs-sm);
    font-weight: 600;
    min-width: 44px;
}

.storage-footnote {
    margin-top: var(--sp-5);
    color: var(--ink-500);
    font-size: var(--fs-sm);
    line-height: 1.6;
}
.storage-footnote code {
    background: var(--bg-alt);
    padding: 1px 6px;
    border-radius: 4px;
    font-family: 'D2Coding', 'Consolas', monospace;
    font-size: 0.88em;
}

/* 반응형 */
@media (max-width: 980px) {
    .storage-overview { grid-template-columns: repeat(3, 1fr); }
    .storage-overview__value { font-size: 1.6rem; }
}
@media (max-width: 768px) {
    .storage-overview { grid-template-columns: 1fr; }
    .storage-meta__row { flex-wrap: wrap; }
    .storage-meta__label { min-width: 0; flex-basis: 100%; }
    .storage-bar { width: 80px; }
    .storage-bar__label { min-width: 36px; font-size: var(--fs-xs); }
}

/* ============================================================
   4f. Auth Pages (로그인 / 회원가입)
   ============================================================ */
body.auth-page {
    min-height: 100vh;
    background:
        radial-gradient(circle at 20% 20%, rgba(244,184,96,0.18), transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(255,127,101,0.15), transparent 50%),
        var(--bg);
}
.auth-main {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--sp-5);
}
.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
    padding: var(--sp-8) var(--sp-6);
}
.auth-brand {
    justify-content: center;
    margin-bottom: var(--sp-6);
}
.auth-title {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    text-align: center;
    margin-bottom: var(--sp-2);
}
.auth-subtitle {
    text-align: center;
    color: var(--ink-500);
    font-size: var(--fs-sm);
    margin-bottom: var(--sp-6);
}
.auth-form {
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
}
.auth-form .form-group { margin-bottom: 0; }

/* ===== 아이디 저장 체크박스 ===== */
.auth-remember {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    font-size: var(--fs-sm);
    color: var(--ink-500);
    padding: 4px 2px;
    margin-top: -4px;
    width: fit-content;
    transition: color 0.15s ease;
}
.auth-remember:hover { color: var(--ink-900); }
.auth-remember__check {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 1.5px solid var(--line);
    border-radius: 5px;
    background: var(--bg-card);
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
    transition: all 0.15s ease;
}
.auth-remember__check:hover {
    border-color: var(--amber-400);
}
.auth-remember__check:checked {
    background: var(--amber-400);
    border-color: var(--amber-400);
}
.auth-remember__check:checked::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 1px;
    width: 5px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.auth-remember__check:focus-visible {
    outline: 2px solid var(--amber-400);
    outline-offset: 2px;
}
.auth-remember__label {
    line-height: 1.2;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    margin: var(--sp-5) 0;
    color: var(--ink-300);
    font-size: var(--fs-xs);
}
.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--line);
}
.auth-muted {
    text-align: center;
    color: var(--ink-500);
    font-size: var(--fs-sm);
    margin-bottom: 0;
}
.auth-hint {
    display: block;
    margin-top: 6px;
    font-size: var(--fs-xs);
    color: var(--ink-500);
}
.auth-hint--ok { color: var(--success); }
.auth-hint--err { color: var(--danger); }

@media (max-width: 480px) {
    .auth-card { padding: var(--sp-6) var(--sp-4); border-radius: var(--r); }
    .auth-title { font-size: 1.3rem; }
}

/* ===== Processing 안내 카드 ===== */
.processing-card {
    text-align: center;
    background: var(--amber-50);
    border-color: var(--amber-200);
}
.processing-card .processing-icon {
    font-size: 2.5rem;
    margin-bottom: var(--sp-2);
}
.processing-card h3 {
    justify-content: center;
    color: var(--amber-500);
}
.processing-card p {
    color: var(--ink-500);
    margin-top: var(--sp-2);
    font-size: var(--fs-sm);
}

.error-hint {
    margin-top: var(--sp-4);
    font-size: 0.9rem;
    color: var(--ink-500);
    line-height: 1.7;
}

.extract-warning {
    margin-top: var(--sp-3);
    padding: var(--sp-3) var(--sp-4);
    background: var(--amber-50);
    border-left: 3px solid var(--amber-400);
    border-radius: var(--r-sm);
    color: var(--ink-700);
    font-size: var(--fs-sm);
    line-height: 1.7;
}
.extract-warning strong { color: var(--amber-500); font-weight: 700; }

/* ============================================================
   Spinner / Loading Overlay (전역 재사용)
   ============================================================ */

/* 회전 스피너 — 노을 톤 */
.spinner {
    display: inline-block;
    width: 48px;
    height: 48px;
    border: 4px solid var(--amber-100);
    border-top-color: var(--amber-400);
    border-right-color: var(--rose-400);
    border-radius: 50%;
    animation: spinner-spin 0.9s linear infinite;
    will-change: transform;
}
.spinner--lg { width: 72px; height: 72px; border-width: 5px; }
.spinner--sm { width: 24px; height: 24px; border-width: 3px; }

@keyframes spinner-spin {
    to { transform: rotate(360deg); }
}

/* 부드러운 펄스 (스피너 옆 텍스트 강조용) */
.loading-pulse {
    animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.55; }
}

/* 풀스크린 오버레이 (폼 제출 시) */
.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(253, 250, 243, 0.85);   /* 노을 톤 반투명 */
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    animation: overlay-fade-in 200ms ease-out;
}
/* HTML hidden 속성이 display:flex 를 이기도록 명시적 우선 — 이거 없으면 hidden 무시됨 */
.loading-overlay[hidden] { display: none; }
@keyframes overlay-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.loading-overlay__inner {
    text-align: center;
    padding: var(--sp-6);
    background: var(--bg-card);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow);
    min-width: 280px;
    max-width: 90%;
}
.loading-overlay__inner .spinner {
    margin-bottom: var(--sp-4);
}
.loading-overlay__title {
    color: var(--ink-900);
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: var(--sp-1);
}
.loading-overlay__sub {
    color: var(--ink-500);
    font-size: var(--fs-sm);
    margin: 0;
}

/* body 에 클래스 붙이면 전역 wait 커서 */
body.is-loading,
body.is-loading * {
    cursor: wait !important;
}

/* processing-card 의 ⏳ 이모지를 스피너로 대체할 때 사용 */
.processing-card .spinner {
    margin: 0 auto var(--sp-3);
    display: block;
}

/* ===== 🧪 문항 수 confirm 모달 (EXAM 새 추출 흐름 프로토타입) ===== */
.confirm-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--sp-4);
    background: rgba(31, 27, 22, 0.45);      /* ink-900 반투명 */
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    animation: overlay-fade-in 180ms ease-out;
}
/* hidden 속성이 display:flex 를 이기도록 명시 (loading-overlay 와 동일 패턴) */
.confirm-modal[hidden] { display: none; }

.confirm-modal__panel {
    background: var(--bg-card);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow);
    padding: var(--sp-6);
    width: 100%;
    max-width: 420px;
    text-align: center;
}
.confirm-modal__title {
    margin: 0 0 var(--sp-3);
    font-size: 1.15rem;
    color: var(--ink-900);
}
.confirm-modal__count {
    margin: 0 0 var(--sp-2);
    font-size: 1.25rem;
    color: var(--ink-900);
}
.confirm-modal__count strong {
    color: var(--amber-500);
    font-size: 1.6rem;
}
.confirm-modal__sub {
    margin: 0 0 var(--sp-3);
    font-size: var(--fs-sm);
    color: var(--ink-500);
}
.confirm-modal__warn {
    margin: 0 0 var(--sp-5);
    padding: var(--sp-2) var(--sp-3);
    font-size: var(--fs-sm);
    color: var(--amber-500);
    background: rgba(237, 151, 40, 0.08);
    border-radius: var(--r-md, 10px);
    line-height: 1.45;
}
.confirm-modal__warn[hidden] { display: none; }
.confirm-modal__actions {
    display: flex;
    gap: var(--sp-2);
    justify-content: center;
    flex-wrap: wrap;
}
@media (max-width: 480px) {
    .confirm-modal__actions { flex-direction: column; }
    .confirm-modal__actions .btn { width: 100%; }
}

/* ============================================================
   📝 메모 드로어 (자료 상세, PC 전용 — Phase 5h)
   모바일(≤980px)에선 전부 숨김 (추후 풀스크린 방식 검토 예정)
   ============================================================ */
.memo-tab,
.memo-drawer,
.memo-backdrop { display: none; }

@media (min-width: 981px) {
    /* 우측 가장자리 세로 탭 버튼 */
    .memo-tab {
        position: fixed;
        top: 50%;
        right: 0;
        transform: translateY(-50%);
        z-index: 9000;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
        padding: 14px 8px;
        background: var(--amber-400);
        color: #fff;
        border: none;
        border-radius: 12px 0 0 12px;
        cursor: pointer;
        box-shadow: var(--shadow);
        transition: background 150ms ease, padding 150ms ease;
    }
    .memo-tab:hover { background: var(--amber-500); }
    .memo-tab__icon  { font-size: 1.2rem; }
    .memo-tab__label { font-size: 0.72rem; font-weight: 700; writing-mode: vertical-rl; letter-spacing: 1px; }

    /* 우측 슬라이드 드로어 */
    .memo-drawer {
        position: fixed;
        top: 0;
        right: 0;
        width: 380px;
        max-width: 90vw;
        height: 100vh;
        z-index: 9100;
        display: flex;
        flex-direction: column;
        background: var(--bg-card);
        box-shadow: -8px 0 28px rgba(31, 27, 22, 0.18);
        transform: translateX(100%);
        transition: transform 260ms cubic-bezier(.4, 0, .2, 1);
    }
    .memo-drawer.is-open { transform: translateX(0); }

    .memo-drawer__head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: var(--sp-4) var(--sp-5);
        border-bottom: 1px solid var(--line);
    }
    .memo-drawer__title { margin: 0; font-size: 1.05rem; color: var(--ink-900); }
    .memo-drawer__close {
        background: none; border: none; cursor: pointer;
        font-size: 1.1rem; color: var(--ink-500);
        padding: 4px 8px; border-radius: var(--r-sm);
    }
    .memo-drawer__close:hover { background: rgba(0, 0, 0, 0.05); }

    .memo-drawer__textarea {
        flex: 1;
        margin: var(--sp-4) var(--sp-5);
        padding: var(--sp-3);
        border: 1px solid var(--line);
        border-radius: var(--r-md, 10px);
        font-family: inherit;
        font-size: 0.95rem;
        line-height: 1.6;
        color: var(--ink-900);
        background: #FDFCFA;
        resize: none;
    }
    .memo-drawer__textarea:focus { outline: none; border-color: var(--amber-400); }

    .memo-drawer__foot {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: var(--sp-3);
        padding: var(--sp-3) var(--sp-5) var(--sp-5);
    }
    .memo-drawer__status { font-size: var(--fs-sm); color: var(--ink-500); }

    .memo-backdrop {
        position: fixed;
        inset: 0;
        z-index: 9090;
        display: block;
        background: rgba(31, 27, 22, 0.25);
        animation: overlay-fade-in 200ms ease-out;
    }
    .memo-backdrop[hidden] { display: none; }
}

/* ============================================================
   4b. Course Selector (헤더 드롭다운)
   ============================================================ */
.course-selector {
    position: relative;
    flex-shrink: 0;
    margin-left: var(--sp-3);
}
.course-selector__toggle {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    padding: 8px 12px;
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--ink-900);
    transition: all var(--dur) var(--ease);
    max-width: 200px;
}
.course-selector__toggle:hover { border-color: var(--amber-300); }
.course-selector.is-open .course-selector__toggle {
    border-color: var(--amber-400);
    box-shadow: 0 0 0 3px rgba(244,184,96,0.15);
}
.course-selector__dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--amber-400);
    flex-shrink: 0;
}
.course-selector__dot--all {
    background: linear-gradient(135deg, var(--amber-300), var(--rose-200), var(--indigo-500));
}
.course-selector__name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.course-selector__name--muted { color: var(--ink-500); }
.course-selector__caret {
    font-size: 0.7rem;
    color: var(--ink-500);
    transition: transform var(--dur) var(--ease);
}
.course-selector.is-open .course-selector__caret { transform: rotate(180deg); }

.course-selector__menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 260px;
    max-width: 320px;
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--r);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: all var(--dur) var(--ease);
    z-index: 110;
    max-height: 70vh;
    overflow-y: auto;
}
.course-selector.is-open .course-selector__menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.course-selector__item-form { margin: 0; }
.course-selector__item {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    width: 100%;
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-radius: var(--r-sm);
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--ink-900);
    text-align: left;
    transition: background var(--dur) var(--ease);
}
.course-selector__item:hover { background: var(--amber-50); }
.course-selector__item.is-active {
    background: var(--amber-100);
    font-weight: 600;
}
.course-selector__item-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 두 카운트(자료/기출)를 나란히 배치 */
.course-selector__counts {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}
.course-selector__count {
    font-size: var(--fs-xs);
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    line-height: 1.4;
    white-space: nowrap;
    letter-spacing: 0.01em;
}
/* 학습 자료 — 앰버 톤 */
.course-selector__count--study {
    background: var(--amber-100);
    color: #94530A;          /* amber-700 느낌, 가독성 위해 진하게 */
}
/* 기출문제 — 로즈 톤 */
.course-selector__count--exam {
    background: var(--rose-100);
    color: #B91C1C;          /* rose-700 느낌 */
}
.course-selector__divider {
    height: 1px;
    background: var(--line);
    margin: 6px 0;
}
.course-selector__item--link {
    color: var(--ink-500);
    font-size: 0.85rem;
    text-decoration: none;
}

/* ============================================================
   4c. Course Cards (목록 페이지)
   ============================================================ */
.course-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--sp-5);
}
.course-card {
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: var(--sp-5);
    position: relative;
    transition: all var(--dur) var(--ease);
    display: flex;
    flex-direction: column;
}
.course-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}
.course-card__badge {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 3px 10px;
    font-size: var(--fs-xs);
    font-weight: 600;
    background: var(--amber-100);
    color: var(--amber-500);
    border-radius: 999px;
}
.course-card__name {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--ink-900);
    margin-bottom: var(--sp-2);
    padding-right: 80px;
}
.course-card__desc {
    font-size: 0.9rem;
    color: var(--ink-500);
    line-height: 1.6;
    margin-bottom: var(--sp-4);
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.course-card__meta {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    font-size: var(--fs-sm);
    color: var(--ink-500);
    padding-top: var(--sp-3);
    border-top: 1px solid var(--line);
    flex-wrap: wrap;
}
.course-card__dday {
    background: linear-gradient(135deg, var(--amber-300), var(--rose-400));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-weight: 700;
    font-size: 0.95rem;
}

/* ============================================================
   4d. Color Picker (코스 폼)
   ============================================================ */
.color-picker {
    display: flex;
    gap: var(--sp-2);
    flex-wrap: wrap;
    padding: 4px;
}
.color-picker__item {
    width: 36px; height: 36px;
    border-radius: 50%;
    cursor: pointer;
    position: relative;
    transition: transform var(--dur) var(--ease);
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.05);
}
.color-picker__item:hover { transform: scale(1.1); }
.color-picker__item input[type=radio] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}
.color-picker__item input[type=radio]:checked + * { /* unused */ }
.color-picker__item:has(input:checked) {
    transform: scale(1.15);
    box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--ink-900);
}

/* ============================================================
   4e. Flatpickr Calendar — 노을 톤 커스텀
   ============================================================ */
.flatpickr-calendar {
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--r);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    font-family: 'Pretendard Variable', Pretendard, sans-serif;
    width: 320px;
}
.flatpickr-calendar.arrowTop::before,
.flatpickr-calendar.arrowTop::after { display: none; }

/* 상단 월/년 영역 */
.flatpickr-months {
    padding: var(--sp-2) 0 var(--sp-3);
    border-bottom: 1px solid var(--line);
    margin-bottom: var(--sp-2);
}
.flatpickr-month {
    color: var(--ink-900);
    height: 36px;
}
.flatpickr-current-month {
    font-size: 1rem;
    font-weight: 700;
    padding: 4px 0;
    color: var(--ink-900);
}
.flatpickr-current-month .flatpickr-monthDropdown-months {
    font-weight: 700;
    color: var(--ink-900);
    background: transparent;
    border-radius: var(--r-sm);
    padding: 4px 8px;
    transition: background var(--dur) var(--ease);
}
.flatpickr-current-month .flatpickr-monthDropdown-months:hover {
    background: var(--amber-50);
}
.flatpickr-current-month input.cur-year {
    color: var(--ink-900);
    font-weight: 700;
}

/* 좌우 화살표 */
.flatpickr-prev-month,
.flatpickr-next-month {
    color: var(--ink-500);
    fill: var(--ink-500);
    padding: 8px;
    border-radius: var(--r-sm);
    transition: all var(--dur) var(--ease);
}
.flatpickr-prev-month:hover,
.flatpickr-next-month:hover {
    background: var(--amber-50);
    color: var(--amber-500);
    fill: var(--amber-500);
}
.flatpickr-prev-month svg,
.flatpickr-next-month svg { width: 14px; height: 14px; }

/* 요일 헤더 */
.flatpickr-weekdays {
    height: 36px;
    background: transparent;
}
.flatpickr-weekday {
    color: var(--ink-500);
    font-weight: 600;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    background: transparent;
}
.flatpickr-weekdaycontainer .flatpickr-weekday:first-child { color: var(--danger); }   /* 일요일 */
.flatpickr-weekdaycontainer .flatpickr-weekday:last-child  { color: var(--indigo-500); }/* 토요일 */

/* 날짜 셀 */
.flatpickr-days,
.dayContainer { width: 100%; min-width: 0; }
.flatpickr-day {
    color: var(--ink-700);
    border-radius: var(--r-sm);
    border: 1px solid transparent;
    height: 38px;
    line-height: 38px;
    font-size: 0.9rem;
    transition: all var(--dur) var(--ease);
    max-width: 14.2857%;
}
.flatpickr-day:hover,
.flatpickr-day:focus {
    background: var(--amber-50);
    border-color: var(--amber-100);
    color: var(--amber-500);
}
.flatpickr-day.today {
    background: transparent;
    border-color: var(--amber-400);
    color: var(--amber-500);
    font-weight: 700;
}
.flatpickr-day.today:hover {
    background: var(--amber-100);
    color: var(--amber-500);
}
.flatpickr-day.selected,
.flatpickr-day.selected:hover {
    background: linear-gradient(135deg, var(--amber-400), var(--rose-400));
    border-color: var(--amber-400);
    color: #fff;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(237,151,40,0.35);
}
.flatpickr-day.prevMonthDay,
.flatpickr-day.nextMonthDay {
    color: var(--ink-300);
}
.flatpickr-day.disabled,
.flatpickr-day.disabled:hover {
    color: var(--ink-300);
    background: transparent;
    cursor: not-allowed;
}
.flatpickr-day.flatpickr-disabled { color: var(--ink-300); }

/* 푸터 — 커스텀 오늘/지우기 버튼 */
.flatpickr-footer {
    display: flex;
    gap: var(--sp-2);
    padding: var(--sp-3) var(--sp-2) var(--sp-2);
    border-top: 1px solid var(--line);
    margin-top: var(--sp-2);
}
.fp-btn {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--line);
    background: var(--bg-card);
    color: var(--ink-700);
    border-radius: var(--r-sm);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--dur) var(--ease);
    font-family: inherit;
}
.fp-btn:hover {
    background: var(--amber-50);
    border-color: var(--amber-300);
    color: var(--amber-500);
}
.fp-btn--today {
    background: linear-gradient(135deg, var(--amber-400), var(--rose-400));
    color: #fff;
    border-color: transparent;
}
.fp-btn--today:hover {
    box-shadow: 0 4px 12px rgba(237,151,40,0.3);
    color: #fff;
    background: linear-gradient(135deg, var(--amber-500), var(--rose-400));
}

/* 모바일 — 캘린더 가운데 정렬 + 더 크게 */
@media (max-width: 480px) {
    .flatpickr-calendar { width: calc(100vw - 32px); max-width: 360px; }
    .flatpickr-day { height: 42px; line-height: 42px; font-size: 0.95rem; }
}

/* ============================================================
   5. Utilities
   ============================================================ */
.text-center { text-align: center; }
.text-danger { color: var(--danger); }
.flex { display: flex; }
.flex-1 { flex: 1; }
.flex-2 { flex: 2; }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.mt-2 { margin-top: var(--sp-2); }
.mt-4 { margin-top: var(--sp-4); }
.mt-6 { margin-top: var(--sp-6); }
.mb-4 { margin-bottom: var(--sp-4); }
.mb-6 { margin-bottom: var(--sp-6); }
.hidden { display: none !important; }

/* ============================================================
   6. Responsive — Mobile First Compatible
   ----
   Breakpoints:
   - Mobile  : ~ 480px
   - Tablet  : 481px ~ 768px
   - Desktop : 769px ~
   ============================================================ */

/* ===== Tablet (≤ 980px) — 헤더 햄버거 메뉴로 ===== */
@media (max-width: 980px) {
    .header__nav { display: none; }
    .mobile-toggle { display: flex; }
}

/* ===== Tablet 가로 (≤ 880px) — 코스 셀렉터 컴팩트 ===== */
@media (max-width: 880px) {
    .course-selector__toggle { max-width: 140px; padding: 7px 10px; }
}

/* ===== Tablet (≤ 768px) ===== */
@media (max-width: 768px) {
    :root {
        --header-h: 56px;
        --sp-10: 48px;
        --sp-8: 36px;
    }

    .container { padding: 0 var(--sp-4); }
    main { padding-top: calc(var(--header-h) + var(--sp-4)); }

    .header__inner { padding: 0 var(--sp-4); gap: var(--sp-3); }
    .brand { font-size: 1.15rem; }

    /* Hero 여백 줄임 */
    .hero { padding: var(--sp-8) var(--sp-3) var(--sp-6); }
    .hero p { font-size: 0.95rem; }

    /* 문서 카드 1.5 ~ 2열 */
    .doc-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: var(--sp-4);
    }
    .doc-card { padding: var(--sp-4); min-height: 200px; }

    /* 업로드 카드 패딩 줄임 */
    .upload-card { padding: var(--sp-5); }
    .form-row { grid-template-columns: 1fr; gap: 0; }

    /* 디테일 섹션 */
    .detail-section { padding: var(--sp-4); }
    .detail-meta { gap: var(--sp-3); font-size: var(--fs-xs); }

    /* Toolbar 세로 정렬 */
    .toolbar { padding: var(--sp-3); }
    .toolbar__search { width: 100%; }

    /* 버튼 그룹 균등 분할 옵션 */
    .action-bar--stack-sm { flex-direction: column; }
    .action-bar--stack-sm > .btn { width: 100%; }
}

/* ===== Mobile (≤ 480px) ===== */
@media (max-width: 480px) {
    :root { --sp-10: 36px; --sp-8: 28px; }

    /* Brand 글자 더 작게 */
    .brand { font-size: 1.05rem; }
    .brand__icon { width: 28px; height: 28px; }

    /* CTA 버튼 텍스트 줄임 */
    .header__cta .btn--sm { padding: 8px 12px; font-size: 0.8rem; }

    /* 코스 셀렉터 모바일 — 이름 숨기고 점만 (드롭다운은 그대로 작동) */
    .course-selector { margin-left: var(--sp-2); }
    .course-selector__toggle { max-width: none; padding: 8px 10px; }
    .course-selector__name { display: none; }
    .course-selector__menu {
        position: fixed;
        left: var(--sp-3);
        right: var(--sp-3);
        min-width: 0;
        max-width: none;
    }

    /* 코스 카드 1열 */
    .course-grid { grid-template-columns: 1fr; }
    .course-card__name { padding-right: 70px; font-size: 1.1rem; }

    /* 도큐먼트 카드 1열 */
    .doc-grid { grid-template-columns: 1fr; }

    /* 칩 / 검색 더 컴팩트 */
    .toolbar { gap: var(--sp-2); }
    .chip { padding: 5px 10px; font-size: var(--fs-xs); }

    /* Hero 텍스트 */
    .hero { padding: var(--sp-6) var(--sp-3) var(--sp-5); }
    .hero__eyebrow { margin-bottom: var(--sp-4); font-size: 0.7rem; }

    /* 디테일 액션 — 세로 정렬 */
    .detail-section { padding: var(--sp-4) var(--sp-3); }
    .detail-meta { gap: var(--sp-2); }

    /* 폼 입력 더 큰 터치 영역 */
    .form-control { padding: 14px 14px; font-size: 16px; /* iOS 줌 방지 */ }

    /* 드롭존 컴팩트 */
    .dropzone { padding: var(--sp-6) var(--sp-4); }
    .dropzone__icon { font-size: 2.4rem; }

    /* 업로드 카드 그림자/패딩 단순화 */
    .upload-card { padding: var(--sp-4); border-radius: var(--r); }
}

/* ===== iOS / Safari 입력창 줌 방지 ===== */
@media (max-width: 980px) {
    input, select, textarea { font-size: 16px; }
}

/* ===== Tablet 가로 (landscape) — 자료 카드 2-3열 안정 ===== */
@media (min-width: 481px) and (max-width: 980px) {
    .doc-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ===== Print ===== */
@media print {
    .header, .footer, .toolbar, .action-bar, .mobile-toggle, .mobile-drawer { display: none !important; }
    main { padding-top: 0; }
    .detail-section { border: 1px solid #ddd; box-shadow: none; page-break-inside: avoid; }
}
