/* LMS 마감 트래커 - 순수 CSS (프레임워크 없음). 모노톤: 밝은 회색 카드 + 검정 강조 */
:root {
    --bg: #f3f3f4;
    --card: #ffffff;
    --soft: #f6f6f7;          /* 카드 안의 연회색 칸 */
    --soft-2: #eeeeef;
    --line: #e7e7e9;
    --text: #111113;
    --muted: #8a8a90;
    --black: #0b0b0c;
    --white: #ffffff;
    --blue: #1d4ed8;   --blue-bg: #e6edff;
    --red: #b42318;    --red-bg: #fde8e6;
    --orange: #b45309; --orange-bg: #fdecd6;
    --green: #15803d;  --green-bg: #dcf6e4;
    --radius: 18px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic",
        "Noto Sans KR", "Segoe UI", sans-serif;
    font-size: 14px;
    line-height: 1.5;
    word-break: keep-all;
    overflow-wrap: break-word;
}

h1, h2, h3, p, ul, ol { margin: 0; padding: 0; }
h1 { font-size: 1.35rem; letter-spacing: -.02em; font-weight: 700; }
h2 { font-size: 1rem; letter-spacing: -.01em; font-weight: 700; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }
ul, ol { list-style: none; }
code { background: rgba(0,0,0,.06); padding: 1px 6px; border-radius: 6px; font-size: .85em; white-space: nowrap; }

.muted { color: var(--muted); }
.small { font-size: .82rem; }
.nowrap { white-space: nowrap; }
.inline { display: inline-block; margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { width: 1em; height: 1em; vertical-align: -0.14em; flex: none; }
.with-icon { display: flex; align-items: center; gap: 8px; }

/* ── 상단바 ── */
.topbar { max-width: 1120px; margin: 0 auto; padding: 16px 20px 0; display: flex; align-items: center; gap: 12px; }
.logo { width: 38px; height: 38px; border-radius: 12px; background: var(--black); color: var(--white);
    display: grid; place-items: center; font-size: 1.1rem; flex: none; }
.logo:hover { text-decoration: none; }
.tabs { display: flex; gap: 2px; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 4px;
    overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { padding: 6px 16px; border-radius: 999px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.is-active { background: var(--white); color: var(--text); box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgba(0,0,0,.06); }
.topbar__right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn { width: 36px; height: 36px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--text);
    display: grid; place-items: center; font-size: 1rem; cursor: pointer; padding: 0; }
.icon-btn:hover { background: var(--soft); text-decoration: none; }
.icon-btn.is-active { background: var(--black); color: var(--white); border-color: var(--black); }
.icon-btn--sm { width: 30px; height: 30px; font-size: .9rem; }
.icon-btn--bare { border: 0; background: transparent; width: 28px; height: 28px; }
.icon-btn--danger:hover { color: var(--red); background: var(--red-bg); }
.user-pill { margin: 0; display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line);
    border-radius: 999px; padding: 3px 6px 3px 4px; }
.avatar { width: 28px; height: 28px; border-radius: 999px; background: var(--black); color: var(--white); display: grid; place-items: center;
    font-weight: 700; font-size: .8rem; }
.user-pill__name { font-weight: 600; font-size: .85rem; max-width: 9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── 페이지 ── */
.page { max-width: 1120px; margin: 0 auto; padding: 18px 20px 56px; display: grid; gap: 16px; }
.page--narrow { max-width: 680px; }
.page-title__actions { display: flex; align-items: center; gap: 8px; }
.page-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 38px; }
.flash { max-width: 1120px; margin: 12px auto 0; padding: 0 20px; }
.grid-2 { display: grid; grid-template-columns: 1.15fr 1fr; gap: 16px; align-items: start; }
.grid-2--rev { grid-template-columns: 340px 1fr; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; min-height: 30px; }
.card__tools { display: flex; gap: 6px; align-items: center; }
.card--danger { border-color: #f1c9c5; }
.card + .card { margin-top: 0; }
.page--narrow .card { margin: 0; }
.empty { color: var(--muted); padding: 18px 4px; text-align: center; }

/* ── 버튼 ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 14px; border-radius: 999px;
    border: 1px solid var(--line); background: var(--card); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--soft); text-decoration: none; }
.btn--sm { padding: 4px 12px; font-size: .82rem; }
.btn--primary { background: var(--black); border-color: var(--black); color: var(--white); box-shadow: 0 2px 6px rgba(0,0,0,.18); }
.btn--primary:hover { background: #26262a; }
.btn--danger { background: var(--red); border-color: var(--red); color: var(--white); }
.btn--danger:hover { background: #8f1b12; }
.btn--danger-outline { color: var(--red); border-color: #efc2bd; background: var(--card); }
.btn--danger-outline:hover { background: var(--red-bg); }
.btn--block { width: 100%; padding: 10px 14px; }
.btn.is-disabled, .btn:disabled { opacity: .45; pointer-events: none; }
.btn.is-loading { opacity: .8; pointer-events: none; }
.btn__spinner .icon { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 12px; }

/* ── 알약(상태) ── */
.pill { display: inline-flex; align-items: center; padding: 1px 9px; border-radius: 999px; font-size: .75rem; font-weight: 600; line-height: 1.6;
    background: var(--soft-2); color: #4b4b52; white-space: nowrap; }
.pill--upcoming { background: var(--blue-bg); color: var(--blue); }
.pill--overdue { background: var(--red-bg); color: var(--red); }
.pill--pending { background: var(--orange-bg); color: var(--orange); }
.pill--done { background: var(--green-bg); color: var(--green); }
.pill--event { background: var(--black); color: var(--white); }
.pill--plain, .pill--unknown { background: var(--card); color: #4b4b52; box-shadow: inset 0 0 0 1px var(--line); }
.pill--muted { background: var(--soft-2); color: var(--muted); }

/* ── 날짜 블록 / 목록 행 ── */
.dateblock { width: 44px; text-align: center; flex: none; line-height: 1.1; }
.dateblock strong { display: block; font-size: 1.3rem; font-weight: 600; letter-spacing: -.02em; }
.dateblock span { display: block; font-size: .7rem; color: var(--muted); text-transform: uppercase; margin-top: 2px; }
.dateblock--none strong { color: var(--muted); }
.rows { display: grid; gap: 8px; }
.row { display: flex; gap: 12px; align-items: center; padding: 10px 6px; border-radius: 14px; }
.row + .row { border-top: 1px solid var(--line); border-radius: 0; }
.rows--boxed { gap: 8px; }
.row--box { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; }
.row--box:hover { border-color: #c4c4ca; }
.row--box + .row--box { border-top: 1px solid var(--line); border-radius: 14px; }
.row.is-past { opacity: .55; }
.row__main { min-width: 0; flex: 1; }
.row__title { font-weight: 600; }
.row__title a:hover { text-decoration: underline; }
.row__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 4px; color: var(--muted); font-size: .8rem; }
.row__memo { color: var(--muted); font-size: .8rem; margin-top: 4px; }
.row__actions { display: flex; gap: 6px; align-items: center; }
.meta { display: inline-flex; align-items: center; gap: 4px; }

/* ── 개요: 요약, 임박 ── */
.stack { display: grid; gap: 16px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; display: flex; flex-direction: column; gap: 2px; }
.stat:hover { text-decoration: none; background: var(--soft); border-color: #c4c4ca; }
.stat span { color: var(--muted); font-weight: 600; font-size: .82rem; }
.stat strong { font-size: 1.9rem; font-weight: 600; letter-spacing: -.03em; line-height: 1.2; }
.stat--warn strong { color: var(--orange); }
.stat--danger strong { color: var(--red); }
.urgent { background: var(--black); color: var(--white); border-radius: var(--radius); padding: 14px 18px; }
.urgent__title { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.urgent ul { margin-top: 8px; display: grid; gap: 4px; }
.urgent li { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; color: #d4d4d8; font-size: .85rem; }
.urgent li b { color: var(--white); }
.urgent time { margin-left: auto; color: #a1a1aa; }
.urgent__more { color: #a1a1aa; }
.urgent__more a { color: var(--white); text-decoration: underline; }

/* ── 상단바 수집 상태 점 ── */
.icon-btn--primary { background: var(--black); border-color: var(--black); color: var(--white); box-shadow: 0 2px 6px rgba(0,0,0,.18); }
.icon-btn--primary:hover { background: #26262a; }
.user-pill { position: relative; }
.status__dot { width: 10px; height: 10px; border-radius: 999px; background: #9a9aa0; display: block; }
.status--none .status__dot { background: transparent; box-shadow: inset 0 0 0 1.5px #b4b4ba; }
.user-pill .status__btn { border: 0; background: transparent; width: 28px; height: 28px; }
.status--warn .status__btn { background: var(--orange-bg); }
.status--warn .status__dot { background: #f08a1c; }
.status--fail .status__btn { background: var(--red-bg); }
.status--fail .status__dot { background: #d92d20; }
.status__tip { display: none; position: absolute; z-index: 20; top: 100%; right: 0; margin-top: 8px; width: max-content; max-width: min(320px, calc(100vw - 28px));
    background: var(--black); color: var(--white); border-radius: 14px; padding: 10px 14px; font-size: .82rem; line-height: 1.5; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.status__tip::before { content: ""; position: absolute; left: 0; right: 0; top: -10px; height: 10px; }
.status__tip strong { margin-right: 6px; }
.status__tip p + p { margin-top: 4px; }
.status__time { color: #a1a1aa; }
.status__btn:focus-visible + .status__tip, .status.is-open .status__tip { display: block; }
@media (hover: hover) {
    .status:hover .status__tip { display: block; }
}

/* ── 달력 ── */
.card--cal { padding: 0; }
.cal { padding: 18px; }
.cal__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.cal__head h2 { font-size: 1.05rem; }
.cal__year { color: var(--muted); font-weight: 600; }
.cal__nav { display: flex; align-items: center; gap: 6px; }
.cal__dow, .cal__grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal__dow span { text-align: center; font-size: .72rem; font-weight: 600; color: var(--muted); background: var(--soft); border-radius: 999px; padding: 2px 0; }
.cal__grid { margin-top: 8px; }
.day { position: relative; height: 46px; border-radius: 12px; background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    font-size: .9rem; font-weight: 500; color: var(--text); }
.day:hover { text-decoration: none; background: var(--soft); }
.day.is-out { color: #c1c1c6; }
.day.is-today { box-shadow: inset 0 0 0 1.5px var(--black); font-weight: 700; }
.day.is-selected { background: var(--black); color: var(--white); font-weight: 700; box-shadow: none; }
/* 오늘이면서 선택한 날: 검정 칸 안쪽에 흰 테두리를 한 줄 더 둬서 '오늘'이 남는다 */
.day.is-today.is-selected { box-shadow: inset 0 0 0 2px var(--black), inset 0 0 0 3.5px var(--white); }
.day__num { line-height: 1; }
/* 점은 숫자 아래. 채운 점 = 미제출 과제/일정, 속이 빈 점 = 제출 */
.day__dots { display: flex; gap: 3px; height: 6px; align-items: center; }
.day__dot { width: 6px; height: 6px; border-radius: 999px; box-sizing: border-box; background: var(--black); }
.day__dot.is-off { background: transparent; box-shadow: inset 0 0 0 1.25px #8a8a90; }
.day.is-selected .day__dot { background: var(--white); }
.day.is-selected .day__dot.is-off { background: transparent; box-shadow: inset 0 0 0 1.25px var(--white); }
.day.is-out .day__dot { background: #c1c1c6; }
.day.is-out .day__dot.is-off { background: transparent; box-shadow: inset 0 0 0 1.25px #c1c1c6; }
/* 개요: 오른쪽 열의 마지막 카드가 남는 높이를 채워서 두 열의 아래 끝이 맞는다 */
.grid-2--fill { align-items: stretch; }
.grid-2--fill .stack { display: flex; flex-direction: column; }
.card--fill { flex: 1; }

/* ── 할 일 ── */
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.filters__count { margin-left: auto; color: var(--muted); font-weight: 600; font-size: .82rem; }
.select { position: relative; display: inline-block; }
.select select { appearance: none; -webkit-appearance: none; border: 1px solid var(--line); background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23111113' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center;
    border-radius: 999px; padding: 6px 30px 6px 14px; font: inherit; font-weight: 600; font-size: .85rem; color: var(--text); cursor: pointer; }
.select select:hover { background-color: var(--soft); }
.todo__item { display: flex; align-items: center; gap: 12px; padding: 12px 8px; }
.todo__item + .todo__item { border-top: 1px solid var(--line); }
.todo__main { min-width: 0; flex: 1; }
.todo__title { font-weight: 600; }
.todo__title a:hover { text-decoration: underline; }
.todo__item.is-done .todo__title { color: var(--muted); text-decoration: line-through; text-decoration-color: #c9c9ce; }
.todo__tags { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.check { width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid #c4c4ca; display: grid; place-items: center; flex: none; font-size: .72rem; background: var(--card); }
.check.is-checked { background: var(--black); border-color: var(--black); color: var(--white); }
.check-form { margin: 0; display: flex; }
.check--btn { cursor: pointer; padding: 0; color: inherit; }
.check--btn:hover { border-color: var(--black); }
.check.is-manual { background: var(--card); border-color: var(--black); color: var(--black); }
.pill--manual { position: relative; background: transparent; color: var(--text); box-shadow: inset 0 0 0 1px #b4b4ba; cursor: help; }
.pill--manual::after { content: attr(data-tip); display: none; position: absolute; z-index: 20; right: 0; top: calc(100% + 8px); width: max-content; max-width: 240px;
    background: var(--black); color: var(--white); border-radius: 12px; padding: 8px 12px; font-size: .78rem; font-weight: 500; line-height: 1.4; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.pill--manual:focus-visible::after { display: block; }
@media (hover: hover) { .pill--manual:hover::after { display: block; } }
/* 할 일 쪽 이동 */
.pager { display: flex; justify-content: center; align-items: center; gap: 4px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.pager__btn { min-width: 30px; height: 30px; padding: 0 10px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center;
    font-size: .8rem; font-weight: 600; color: var(--text); border: 1px solid transparent; }
a.pager__btn:hover { background: var(--soft); text-decoration: none; border-color: var(--line); }
.pager__btn.is-current { background: var(--black); color: var(--white); }
.pager__btn.is-disabled { color: #c1c1c6; }
.pager__gap { color: var(--muted); padding: 0 2px; }

/* ── 일정 모달 ── */
.modal { border: 0; padding: 0; border-radius: 22px; width: min(460px, calc(100vw - 28px)); max-height: calc(100vh - 28px); background: var(--card); color: var(--text);
    box-shadow: 0 24px 64px rgba(0,0,0,.28); }
.modal::backdrop { background: rgba(11,11,12,.45); }
.modal__form { padding: 20px; }
.form > .modal__head { display: flex; align-items: center; justify-content: space-between; }
.form.modal__form > .actions { display: flex; flex-wrap: wrap; margin-top: 4px; }
.form.modal__form > .actions [data-event-delete] { margin-left: auto; }
.form.modal__form > .actions [hidden] { display: none; }

/* ── 폼 / 알림 ── */
.form, .form > div { display: grid; gap: 12px; }
.form > .btn { justify-self: start; }
.form label { display: grid; gap: 5px; font-weight: 600; font-size: .85rem; }
.form input[type=text], .form input[type=password], .form input[type=datetime-local], .form select, .form textarea {
    width: 100%; border: 1px solid var(--line); background: var(--soft); border-radius: 12px; padding: 9px 12px; font: inherit; font-weight: 400; color: var(--text); }
.form input:focus, .form select:focus, .form textarea:focus, .select select:focus { outline: 2px solid var(--black); outline-offset: 1px; background: var(--card); }
.field-error { color: var(--red); font-weight: 500; }
.alert { padding: 10px 14px; border-radius: 14px; background: var(--soft); border: 1px solid var(--line); font-size: .88rem; transition: opacity .4s; }
.alert--danger { background: var(--red-bg); border-color: #f4c7c2; color: var(--red); }
.alert--success { background: var(--green-bg); border-color: #bfe8cb; color: var(--green); }
.alert--warn { background: var(--orange-bg); border-color: #f4d9b4; color: var(--orange); }
.alert a { text-decoration: underline; font-weight: 600; }
.alert.is-hidden { opacity: 0; }

/* ── 로그인/가입 ── */
.auth-page { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.auth-card { width: 100%; max-width: 380px; background: var(--card); border: 1px solid var(--line); border-radius: 24px; padding: 28px 26px; display: grid; gap: 14px; }
.auth-card__logo { width: 44px; height: 44px; border-radius: 14px; background: var(--black); color: var(--white); display: grid; place-items: center; font-size: 1.25rem; }
.auth-link { text-align: center; font-weight: 600; }
.auth-link a { text-decoration: underline; }

/* 동의 화면 체크박스: 할 일 목록의 .check(18px 체크 표시)와는 별개. 문구가 줄바꿈되고 버튼과 겹치지 않는다 */
.form .consent-check { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; margin-bottom: 4px; background: var(--soft); border: 1px solid var(--line); border-radius: 14px; font-size: .9rem; font-weight: 500; line-height: 1.55; color: var(--text); cursor: pointer; }
.consent-check input[type=checkbox] { flex: none; width: 24px; height: 24px; margin: 0; accent-color: var(--black); cursor: pointer; }
.consent-check input[type=checkbox]:focus-visible { outline: 2px solid var(--black); outline-offset: 2px; }
.consent-check__text { flex: 1 1 auto; min-width: 0; word-break: keep-all; overflow-wrap: break-word; }

/* 동의 / 동의 거절 확인 화면 다듬기: 링크는 밑줄로 구분, 버튼은 터치 44px 이상+긴 문구 줄바꿈, 삭제 목록은 불릿 */
.auth-card p a { text-decoration: underline; text-underline-offset: 2px; font-weight: 600; }
.auth-card .btn--block { min-height: 44px; white-space: normal; text-align: center; line-height: 1.35; }
.auth-card .form input[type=text] { min-height: 44px; }
.consent-list { list-style: disc; padding: 12px 14px 12px 34px; background: var(--soft); border: 1px solid var(--line); border-radius: 14px; font-size: .9rem; }
.consent-list li + li { margin-top: 6px; }
.consent-list li::marker { color: var(--red); }
.consent-note { font-size: .85rem; color: #4b4b52; }
.consent-phrase { padding: 1px 6px; border-radius: 6px; background: var(--red-bg); color: var(--red); }

/* 포커스/눌림 표시는 브라우저 기본(파란색) 대신 검정 */
a:focus-visible, button:focus-visible, summary:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--black); outline-offset: 2px; }
a, button { -webkit-tap-highlight-color: transparent; }

/* ── 반응형 ── */
@media (max-width: 860px) {
    .grid-2, .grid-2--rev { grid-template-columns: 1fr; }
    .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
    .topbar { flex-wrap: wrap; padding: 12px 14px 0; }
    .tabs { order: 3; width: 100%; }
    .tabs a { flex: 1; text-align: center; padding: 6px 10px; }
    .user-pill__name { display: none; }
    .topbar { position: relative; }
    .user-pill { position: static; }
    .status__tip { top: 58px; left: 14px; right: 14px; max-width: none; width: auto; margin-top: 0; }
    .page { padding: 14px 14px 48px; }
    .flash { padding: 0 14px; }
    .card { padding: 14px; }
    .cal { padding: 14px; }
    .day { height: 42px; }
        .todo__item { flex-wrap: wrap; }
    .todo__tags { width: 100%; justify-content: flex-start; padding-left: 30px; }
    .urgent time { margin-left: 0; }
}
