/* ───── 디자인 토큰 (라이트 / 다크는 OS 설정을 따라가요) ─────
   글자 대비는 본문 4.5 대 1 이상, 입력 테두리는 3 대비 1 이상으로 맞췄어요. (docs/design 시안 기준) */
:root {
  --bg: #f5f6fa;
  --card: #ffffff;
  --card-2: #f8f9fc;
  --text: #1c2030;
  --muted: #5f6678;
  --line: #e3e6ef;
  --field-line: #8a90a5;
  --accent: #5b5ff0;
  --accent-soft: #eceefe;
  --accent-ink: #4a3fd6;
  --accent-text: #ffffff;
  --ok: #15803d;
  --ok-soft: #dcfce7;
  --info: #2563eb;
  --info-soft: #dbeafe;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --danger: #dc2626;
  --danger-soft: #3b1518;
  --sat: #2563eb;
  --sun: #dc2626;
  --code-bg: #12141c;
  --code-text: #e6e8f2;
  --code-head: #1b1e2a;
  --inline-code-bg: #eef0f7;
  --inline-code-text: #4a3fd6;
  --shadow: 0 1px 2px rgba(20, 24, 50, 0.05), 0 8px 24px rgba(20, 24, 50, 0.06);
  --radius: 16px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1017;
    --card: #161923;
    --card-2: #1b1f2b;
    --text: #e8eaf3;
    --muted: #9097ad;
    --line: #262b3a;
    --field-line: #6b7285;
    --accent: #7b7ff7;
    --accent-soft: #23264a;
    --accent-ink: #b5b8ff;
    --accent-text: #0e1017;
    --ok: #4ade80;
    --ok-soft: #12301f;
    --info: #60a5fa;
    --info-soft: #172a4a;
    --warn: #fbbf24;
    --warn-soft: #3a2d0c;
    --danger: #f87171;
    --sat: #7aa7ff;
    --sun: #ff8a8a;
    --code-bg: #0a0c12;
    --code-head: #151822;
    --inline-code-bg: #232739;
    --inline-code-text: #b5b8ff;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 "Pretendard", "Malgun Gothic", system-ui, -apple-system, sans-serif;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.3; }
p { margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
code { font-family: "JetBrains Mono", Consolas, "D2Coding", monospace; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.grow { flex: 1; }

/* ───── 상단 바 ───── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  height: 64px; padding: 0 24px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; min-width: 0; }
.brand img { width: 36px; height: 36px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 16px; letter-spacing: -0.01em; }
.brand-text small { color: var(--muted); font-size: 12px; }
.topright { display: flex; align-items: center; gap: 10px; }
.conn-chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 999px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.conn-chip.ok { background: var(--ok-soft); color: var(--ok); }
.conn-chip.off { background: var(--line); color: var(--text); }
.admin-open { height: 40px; padding: 0 16px; border-radius: 999px; }
.admin-open.on { border-color: var(--accent); color: var(--accent-ink); background: var(--accent-soft); }

.user-menu { position: relative; }
.user-chip {
  display: flex; align-items: center; gap: 10px; height: 40px;
  padding: 0 12px 0 5px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--card); box-shadow: var(--shadow); font-weight: 700; font-size: 14px;
}
.user-chip:hover, .user-chip[aria-expanded="true"] { border-color: var(--accent); }
.pop {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; width: 288px; padding: 8px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow);
}
.pop-head { display: flex; flex-direction: column; padding: 10px 12px; line-height: 1.3; }
.pop-head small { color: var(--muted); font-size: 13px; }
.pop-sep { height: 1px; margin: 4px 0; background: var(--line); }
.pop-label { padding: 6px 12px 2px; color: var(--muted); font-size: 12px; font-weight: 700; }
.pop button {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 0 12px;
  border: 0; border-radius: 10px; background: none; text-align: left; font-size: 14px; font-weight: 500;
}
.pop button:hover, .pop button:focus-visible { background: var(--accent-soft); }
.pop-note { color: var(--muted); font-size: 12px; font-weight: 400; }

/* 프로필 사진(없으면 이름 첫 글자) */
.avatar {
  display: inline-grid; place-items: center; flex: none; overflow: hidden;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent); color: var(--accent-text); font-size: 13px; font-weight: 700;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 40px; height: 40px; font-size: 16px; }

/* ───── 로그인 전, 안내 화면 ───── */
.hero { max-width: 520px; margin: 12vh auto 0; padding: 0 24px; text-align: center; }
.hero-logo { width: 96px; height: 96px; margin-bottom: 20px; }
.hero h1 { font-size: 28px; letter-spacing: -0.02em; margin-bottom: 12px; }
.hero p { color: var(--muted); margin-bottom: 28px; }
.hero .hint { font-size: 13px; margin: 14px 0 0; }

.notice-wrap, .notice-page .notice-wrap { display: flex; justify-content: center; padding: 56px 24px; }
.notice-page { display: block; }
.notice-card {
  width: min(460px, 100%); padding: 28px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px;
}
.notice-card h1 { font-size: 22px; letter-spacing: -0.01em; }
.notice-card p { color: var(--muted); }
.notice-card .notice-sub { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card-2); color: var(--text); font-size: 14px; }
.notice-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.notice-actions .btn { width: 100%; }
.notice-icon { display: grid; place-items: center; flex: none; width: 56px; height: 56px; border-radius: 16px; background: var(--line); color: var(--text); }
.notice-icon.accent { background: var(--accent-soft); color: var(--accent-ink); }
.notice-icon.warn { background: var(--warn-soft); color: var(--warn); }

/* ───── 레이아웃: 본문이 DOM에서 먼저 오고, 데스크톱에서만 사이드를 왼쪽에 둔다 ───── */
.layout {
  display: grid; grid-template-columns: 304px minmax(0, 1fr); grid-template-areas: "side main";
  gap: 24px; align-items: start; max-width: 1232px; margin: 0 auto; padding: 24px;
}
.main { grid-area: main; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.side {
  grid-area: side; display: flex; flex-direction: column; gap: 16px;
  position: sticky; top: 88px; max-height: calc(100vh - 112px);
}
.layout.editing { grid-template-columns: minmax(0, 1fr); grid-template-areas: "main"; max-width: 920px; }
.layout.editing .side { display: none; }
.fold { display: none; }

.card {
  padding: 20px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-title h3, .card-title .h3 { font-size: 16px; letter-spacing: -0.01em; }
.count { color: var(--muted); font-size: 13px; font-weight: 400; }

/* ───── 버튼 ───── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 8px 16px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); font-weight: 700; font-size: 14px; text-decoration: none; white-space: nowrap; transition: 0.15s;
}
.btn:hover { border-color: var(--accent); color: var(--accent-ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { filter: brightness(1.08); color: var(--accent-text); }
.btn.ghost { background: none; border-color: transparent; color: var(--muted); }
.btn.small { min-height: 36px; padding: 5px 14px; font-size: 13px; }
.btn.big { min-height: 48px; padding: 12px 26px; font-size: 16px; border-radius: 12px; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger-line { border-color: var(--danger); color: var(--danger); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
.icon-btn {
  display: grid; place-items: center; width: 40px; height: 40px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--card);
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent-ink); }

/* ───── 칩 ───── */
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border-radius: 999px;
  background: var(--line); color: var(--text); font-size: 13px; font-weight: 700; white-space: nowrap;
}
.chip.ok, .chip.done { background: var(--ok-soft); color: var(--ok); }
.chip.warn, .chip.miss { background: var(--warn-soft); color: var(--warn); }
.chip.accent, .chip.doing, .chip.info { background: var(--accent-soft); color: var(--accent-ink); }
.chip.hold { background: var(--line); color: var(--text); }

/* ───── 달력 ───── */
.calendar { padding: 16px; flex: none; }
.calendar-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.calendar-title { font-size: 16px; letter-spacing: -0.01em; }
.weekdays, .days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
.weekdays div { text-align: center; font-size: 12px; font-weight: 700; padding: 4px 0; color: var(--muted); }
.weekdays .sun { color: var(--sun); }
.weekdays .sat { color: var(--sat); }
.day {
  position: relative; height: 40px; display: grid; place-items: center;
  border: 1px solid transparent; border-radius: 10px; background: none; font-size: 14px; font-weight: 500;
}
button.day:hover { background: var(--accent-soft); }
.day.other { color: var(--muted); opacity: 0.55; }
.day.sun { color: var(--sun); }
.day.sat { color: var(--sat); }
.day.today { border-color: var(--accent); font-weight: 700; }
.day.selected { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 700; }
/* 점은 색만으로 구분하지 않아요: 기록 있음 = 속 빈 원, 목표 모두 완료 = 채운 원 */
.day.has::after {
  content: ""; position: absolute; bottom: 4px; width: 8px; height: 8px; border-radius: 50%;
  border: 1.5px solid var(--muted); background: transparent;
}
.day.alldone::after { border-color: var(--ok); background: var(--ok); }
.day.selected.has::after { border-color: var(--accent-text); }
.day.selected.alldone::after { background: var(--accent-text); }
.calendar-foot { display: flex; align-items: center; gap: 12px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.legend { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--muted); background: transparent; }
.dot.done { background: var(--ok); border-color: var(--ok); }
.calendar-foot .btn { margin-left: auto; }

/* ───── 팀원 ───── */
.people-card { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; }
.search { width: 100%; height: 44px; margin-bottom: 8px; padding: 0 12px; border: 1px solid var(--field-line); border-radius: 10px; background: var(--card); }
.people { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; min-height: 0; overflow-y: auto; }
.person {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 52px; padding: 8px 10px;
  border: 0; border-left: 3px solid transparent; border-radius: 10px; background: none; text-align: left;
}
.person:hover { background: var(--card-2); }
.person.active { background: var(--accent-soft); border-left-color: var(--accent); }
.person-name { flex: 1; min-width: 0; line-height: 1.3; }
.person-name b { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-name small { color: var(--muted); font-size: 12px; }
.badge-me { padding: 1px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); font-size: 12px; font-weight: 700; }
.person.active .badge-me { background: var(--card); }
.pdots { flex: none; display: inline-flex; gap: 6px; }
.pdot { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--muted); background: transparent; }
.pdot.on { border-color: var(--ok); background: var(--ok); }

/* ───── 다른 팀원 보기 막대, 하루 머리글 ───── */
.viewer-bar {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 16px;
  padding: 12px 20px; border-radius: var(--radius); background: var(--accent-soft); color: var(--text);
}
.viewer-who { display: flex; align-items: center; gap: 14px; min-width: 0; }
.viewer-who p { font-size: 16px; }
.viewer-who small { color: var(--muted); font-size: 13px; }
.viewer-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.badge-ro { display: inline-flex; align-items: center; height: 24px; margin-left: 6px; padding: 0 10px; border-radius: 999px; background: var(--card); color: var(--accent-ink); font-size: 12px; font-weight: 700; }

.day-head { display: flex; align-items: center; justify-content: space-between; gap: 16px 32px; flex-wrap: wrap; padding: 20px 24px; }
.eyebrow { color: var(--muted); font-size: 13px; font-weight: 700; margin-bottom: 2px; }
#day-title { font-size: 28px; letter-spacing: -0.02em; }
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.progress { flex: 1 1 240px; max-width: 360px; }
.progress span { display: block; margin-bottom: 8px; font-size: 14px; font-weight: 700; }
.bar { height: 10px; border-radius: 999px; background: var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; border-radius: 999px; background: var(--ok); transition: width 0.35s; }

/* ───── 목표 ───── */
.goals { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.goal {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--card-2);
}
.goal-no {
  display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 8px;
  background: var(--accent-soft); color: var(--accent-ink); font-size: 13px; font-weight: 700;
}
.goal-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
button.goal-text { padding: 6px 8px; margin: -6px -8px; border: 0; border-radius: 8px; background: none; text-align: left; font-size: 15px; }
button.goal-text:hover { background: var(--accent-soft); }
.goal-edit { flex: 1; min-width: 0; height: 40px; padding: 0 12px; border: 1px solid var(--accent); border-radius: 10px; background: var(--card); font-size: 15px; }
.goal.done .goal-text { color: var(--muted); text-decoration: line-through; }
.goal.done .goal-no { background: var(--ok-soft); color: var(--ok); }
.seg { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.seg button { min-height: 36px; padding: 0 14px; border: 0; border-radius: 9px; background: none; color: var(--muted); font-size: 13px; font-weight: 500; white-space: nowrap; }
.seg button:hover { color: var(--text); }
.seg button.on, .seg button[aria-pressed="true"], .seg button[aria-selected="true"] { background: var(--accent-soft); color: var(--accent-ink); font-weight: 700; }
.seg button[data-v="hold"][aria-pressed="true"] { background: var(--line); color: var(--text); }
.seg button[data-v="done"][aria-pressed="true"] { background: var(--ok-soft); color: var(--ok); }
.goal .del { flex: none; width: 36px; height: 36px; border: 0; border-radius: 9px; background: none; color: var(--muted); display: grid; place-items: center; }
.goal .del:hover { background: var(--card); color: var(--danger); }
.goal-form { display: flex; gap: 8px; margin-top: 14px; }
.goal-form .btn { flex: none; min-width: 72px; min-height: 44px; }
.goal-form input, .field input, .field textarea, .token-row input, .team-date, .invite-form input, .invite-form select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--field-line); border-radius: 10px; background: var(--card); transition: 0.15s;
}
.goal-form input { height: 44px; padding-top: 0; padding-bottom: 0; }
.goal-form input:focus, .field input:focus, .field textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }

/* ───── 빈 화면 ───── */
.empty { padding: 24px 16px; text-align: center; color: var(--muted); border: 1px dashed var(--field-line); border-radius: 12px; }
.empty b { display: block; color: var(--text); margin-bottom: 4px; font-size: 16px; }
.empty p { margin-bottom: 14px; font-size: 14px; }
.empty .btn { margin-top: 4px; }
.empty code { background: var(--inline-code-bg); color: var(--inline-code-text); padding: 1px 6px; border-radius: 6px; font-size: 13px; }

/* ───── /report 연결 카드 ───── */
.connect { display: flex; gap: 20px; align-items: flex-start; }
.connect-body { flex: 1; min-width: 0; }
.connect h2 { font-size: 20px; letter-spacing: -0.01em; margin-bottom: 4px; }
.connect p { color: var(--muted); margin-bottom: 12px; }
.connect ol { margin: 0 0 16px; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.connect .row { gap: 8px; }

/* ───── 끝 보고 ───── */
.meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.tag { padding: 3px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); font-size: 13px; font-weight: 700; }
.tag.study { background: var(--ok-soft); color: var(--ok); }
.topic { font-weight: 700; font-size: 16px; }
.blocked-note { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px; padding: 12px 14px; border-radius: 12px; background: var(--warn-soft); color: var(--warn); font-size: 14px; }
.blocked-note svg { flex: none; margin-top: 2px; }
.blocked-note a { color: inherit; font-weight: 700; }
.rsec { padding: 14px 0; border-top: 1px solid var(--line); }
.rsec:first-of-type { border-top: 0; padding-top: 0; }
.rsec h4 { margin-bottom: 8px; color: var(--muted); font-size: 13px; letter-spacing: 0.02em; }
.rsec.blocked h4 { color: var(--warn); }
details.rsec { border: 1px solid var(--line); border-radius: 12px; background: var(--card-2); padding: 0; margin-top: 8px; }
details.rsec > summary { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 14px; cursor: pointer; font-size: 14px; font-weight: 700; }
details.rsec[open] > summary { border-bottom: 1px solid var(--line); }
details.rsec > .rbody { padding: 12px 14px; }
.rsec .count { margin-left: 6px; padding: 1px 7px; border-radius: 999px; background: var(--line); color: var(--text); font-size: 12px; letter-spacing: 0; }
.repo + .repo { margin-top: 12px; }
.repo-name { font-weight: 700; font-size: 13px; margin-bottom: 4px; }
.commit { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; padding: 4px 0; font-size: 14px; }
.commit .hash, .fitem code { background: var(--inline-code-bg); color: var(--inline-code-text); padding: 1px 6px; border-radius: 6px; font-size: 12.5px; }
.commit .msg { flex: 1 1 200px; overflow-wrap: anywhere; }
.question { display: flex; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.question:last-child { border-bottom: 0; }
.q-time { flex: none; color: var(--muted); font-size: 12px; padding-top: 2px; font-variant-numeric: tabular-nums; }
.q-text { white-space: pre-wrap; overflow-wrap: anywhere; min-width: 0; }
.fchips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.fchip { padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--line); }
.fchip.plus, .fgroup.plus .fgroup-name { color: var(--ok); }
.fchip.minus, .fgroup.minus .fgroup-name { color: var(--danger); }
.fgroup + .fgroup { margin-top: 10px; }
.fgroup-name { font-size: 12px; font-weight: 700; margin-bottom: 2px; }
.fitem { padding: 2px 0; overflow-wrap: anywhere; }
.dirtag { margin-left: 6px; color: var(--muted); font-size: 12px; }
details.more > summary { cursor: pointer; margin-top: 6px; color: var(--muted); font-size: 13px; }
.saved-at { margin-top: 10px; color: var(--muted); font-size: 12px; }

/* ───── 마크다운 본문 ───── */
.md-body { overflow-wrap: anywhere; }
.md-body > :first-child { margin-top: 0; }
.md-body > :last-child { margin-bottom: 0; }
.md-body p { margin: 0 0 10px; }
.md-body h3, .md-body h4, .md-body h5, .md-body h6 { margin: 18px 0 8px; letter-spacing: -0.01em; }
.md-body h3 { font-size: 18px; } .md-body h4 { font-size: 16px; } .md-body h5 { font-size: 15px; } .md-body h6 { font-size: 14px; color: var(--muted); }
.md-body ul, .md-body ol { margin: 0 0 10px; padding-left: 22px; }
.md-body li { margin: 3px 0; }
.md-body li > ul, .md-body li > ol { margin: 4px 0 0; }
.md-body li.md-task { list-style: none; margin-left: -20px; }
.md-body li.md-task input { margin-right: 8px; accent-color: var(--accent); vertical-align: -1px; }
.md-body a { color: var(--accent-ink); text-underline-offset: 3px; }
.md-body hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.md-body blockquote { margin: 0 0 10px; padding: 8px 14px; border-left: 4px solid var(--accent); border-radius: 0 10px 10px 0; background: var(--accent-soft); }
.md-body blockquote > :last-child { margin-bottom: 0; }
.md-body :not(pre) > code {
  padding: 2px 6px; border-radius: 6px; background: var(--inline-code-bg); color: var(--inline-code-text); font-size: 0.88em;
}
.md-body del { color: var(--muted); }
.md-code { margin: 0 0 12px; border-radius: 12px; overflow: hidden; background: var(--code-bg); border: 1px solid var(--line); }
.md-code-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 12px; background: var(--code-head); }
.md-lang { color: #8f96ad; font: 600 12px "JetBrains Mono", Consolas, monospace; text-transform: lowercase; }
.md-copy { min-height: 32px; padding: 2px 10px; border: 1px solid #2f3447; border-radius: 6px; background: none; color: #b7bdd2; font-size: 12px; }
.md-copy:hover { border-color: #7b7ff7; color: #fff; }
.md-code pre { margin: 0; padding: 14px 16px; overflow-x: auto; }
.md-code code { color: var(--code-text); font-size: 13px; line-height: 1.65; background: none; padding: 0; }
.md-table { margin: 0 0 12px; overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.md-table table { width: 100%; border-collapse: collapse; font-size: 14px; }
.md-table th, .md-table td { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.md-table th { background: var(--card-2); font-weight: 700; }
.md-table tr:last-child td { border-bottom: 0; }

/* ───── 끝 보고 작성 폼 ───── */
.end-form { display: flex; flex-direction: column; gap: 14px; }
.draft-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 12px 14px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-ink); font-size: 14px; }
.draft-bar p { flex: 1 1 260px; }
.draft-actions { display: flex; gap: 8px; }
.alert { display: flex; gap: 10px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--danger); background: var(--card); color: var(--danger); font-size: 14px; font-weight: 700; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.tab { min-height: 44px; padding: 8px 16px; border: 0; border-bottom: 3px solid transparent; background: none; color: var(--muted); font-weight: 700; margin-bottom: -1px; }
.tab.active { color: var(--accent-ink); border-bottom-color: var(--accent); }
.row { display: flex; gap: 14px; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field.grow { flex: 1; min-width: 200px; }
.field label, .field .label { font-size: 13px; font-weight: 700; }
.field textarea { resize: vertical; font-family: "JetBrains Mono", Consolas, "D2Coding", monospace; font-size: 13.5px; line-height: 1.6; }
.field.invalid input, .field.invalid textarea { border: 2px solid var(--danger); }
.field-error { display: block; color: var(--danger); font-size: 14px; font-weight: 700; }
.muted { color: var(--muted); font-weight: 400; font-size: 12px; margin-left: 4px; }
.req { color: var(--warn); font-size: 12px; margin-left: 4px; }
.preview-pane { min-height: 200px; padding: 4px 2px; }
.form-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.form-actions.sticky { position: sticky; bottom: 0; z-index: 5; margin: 0 -20px -20px; padding: 12px 20px; border-top: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); background: var(--card); }
.draft-status { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.draft-status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.draft-status:empty::before { display: none; }
.spacer { flex: 1; }
.help { border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; background: var(--card-2); font-size: 13px; }
.help summary { cursor: pointer; font-weight: 700; min-height: 28px; }
.help-grid { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin-top: 10px; align-items: baseline; }
.help-grid code { padding: 2px 8px; border-radius: 6px; background: var(--inline-code-bg); color: var(--inline-code-text); white-space: pre; }
.help-grid span { color: var(--muted); }

/* ───── 대화 상자, 알림 ───── */
.dialog { width: min(480px, calc(100vw - 32px)); padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--text); box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35); }
.dialog::backdrop { background: rgba(10, 12, 20, 0.55); backdrop-filter: blur(2px); }
.dialog h3 { font-size: 18px; margin-bottom: 8px; }
.dialog p { color: var(--muted); margin-bottom: 14px; }
.dialog code { background: var(--inline-code-bg); color: var(--inline-code-text); padding: 1px 6px; border-radius: 6px; font-size: 13px; }
.token-row { display: flex; gap: 8px; margin-bottom: 14px; }
.token-row input { font: 13px "JetBrains Mono", Consolas, monospace; }
.dialog .warn { padding: 10px 12px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); font-size: 13px; }
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 50;
  display: flex; align-items: center; gap: 10px; max-width: calc(100vw - 32px); padding: 8px 8px 8px 20px; border-radius: 12px;
  background: var(--text); color: var(--bg); font-weight: 600; font-size: 14px; box-shadow: var(--shadow);
}
.toast.error { background: var(--danger); color: #fff; }
.toast-act { min-height: 36px; padding: 0 12px; border: 1px solid currentColor; border-radius: 8px; background: none; font-weight: 700; font-size: 13px; }
.toast-x { width: 36px; height: 36px; border: 0; border-radius: 8px; background: none; opacity: 0.85; }
.toast-x:hover { opacity: 1; }

/* ───── 데이터 내보내기·불러오기 ───── */
.import-sum { display: grid; gap: 6px; margin-bottom: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--card-2); font-size: 14px; }
.import-sum div { display: flex; justify-content: space-between; gap: 12px; }
.import-sum b { font-variant-numeric: tabular-nums; }
.import-mode { display: grid; gap: 8px; margin-bottom: 14px; font-size: 14px; }
.import-mode label { display: flex; align-items: center; gap: 8px; cursor: pointer; min-height: 32px; }
.import-mode .muted { color: var(--muted); font-size: 12px; }

/* ───── 관리자 화면 ───── */
.admin { max-width: 1232px; margin: 0 auto; padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.admin-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.admin-head h1 { font-size: 26px; letter-spacing: -0.02em; }
.admin-tabs button { min-height: 40px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; padding: 12px 16px; }
.date-nav { display: flex; align-items: center; gap: 8px; }
.team-date { width: 168px; height: 44px; font-weight: 700; text-align: center; }
#team-date { width: 168px; height: 44px; padding: 0 12px; border: 1px solid var(--field-line); border-radius: 10px; background: var(--card); font-weight: 700; text-align: center; }
.check { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: 14px; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.stat { padding: 16px 20px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.stat small { display: block; color: var(--muted); font-size: 13px; }
.stat b { font-size: 24px; letter-spacing: -0.01em; }
.stat.warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.stat.warn small { color: var(--warn); font-weight: 700; }
.stat.warn b { font-size: 18px; }
.stat.ok b { color: var(--ok); }
.tbl-wrap { padding: 0; overflow-x: auto; }
.tbl-wrap.flat { border: 0; box-shadow: none; }
.tbl-wrap.scroll { max-height: 520px; overflow-y: auto; }
.tbl { width: 100%; min-width: 760px; border-collapse: collapse; font-size: 14px; }
.tbl th { padding: 12px 8px; text-align: left; color: var(--muted); font-size: 13px; font-weight: 700; }
.tbl td, .tbl tbody th { padding: 8px; border-top: 1px solid var(--line); vertical-align: middle; }
.tbl tbody th { color: var(--text); font-size: 14px; }
.tbl th:first-child, .tbl td:first-child { padding-left: 16px; }
.tbl th:last-child, .tbl td:last-child { padding-right: 16px; }
.tbl .empty-cell { padding: 24px; text-align: center; color: var(--muted); }
.row-click { cursor: pointer; }
.row-click:hover td, .row-click:hover th { background: var(--card-2); }
.who { display: flex; align-items: center; gap: 12px; min-height: 48px; }
.who-name { display: flex; flex-direction: column; line-height: 1.3; }
.who-name small { color: var(--muted); font-size: 12px; }
.who-btn { display: flex; align-items: center; gap: 12px; min-height: 48px; width: 100%; padding: 0; border: 0; background: none; text-align: left; }
.dots { display: inline-flex; gap: 5px; }
.dots i { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--field-line); }
.dots i.on { border-color: var(--ok); background: var(--ok); }
.mini { display: inline-flex; align-items: center; gap: 8px; }
.mini-bar { display: inline-block; width: 64px; height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.mini-bar i { display: block; height: 100%; background: var(--ok); }
.faint { color: var(--muted); }
.topic-cell { display: flex; align-items: center; gap: 8px; max-width: 240px; }
.topic-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.invite-form { display: flex; flex-wrap: wrap; gap: 8px; }
.invite-form input { flex: 1 1 320px; min-width: 0; height: 48px; padding-top: 0; padding-bottom: 0; }
.invite-form select { flex: none; width: auto; height: 48px; padding-top: 0; padding-bottom: 0; }
.invite-form .btn { min-height: 48px; min-width: 112px; }
.hint { color: var(--muted); font-size: 14px; margin-top: 10px; }
.acts { display: flex; gap: 6px; justify-content: flex-end; }
.acts .btn { min-height: 44px; font-size: 13px; }
.notice.card h3 { font-size: 18px; margin-bottom: 6px; }
.notice.card p { color: var(--muted); margin-bottom: 8px; }
.notice.card code { background: var(--inline-code-bg); color: var(--inline-code-text); padding: 1px 6px; border-radius: 6px; font-size: 13px; }
.loading { padding: 32px; text-align: center; color: var(--muted); }

/* ───── 중간·좁은 화면 ───── */
@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); grid-template-areas: "main" "side"; padding: 16px; }
  .side { position: static; max-height: none; }
  .topbar { padding: 0 16px; }
  .connect { flex-direction: column; }
  .stats { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 600px) {
  .brand-text small, #me-name, .conn-chip, .admin-open span { display: none; }
  .user-chip { padding: 4px; width: 44px; height: 44px; justify-content: center; }
  .user-chip svg { display: none; }
  .admin-open { width: 44px; height: 44px; padding: 0; }
  .pop { position: fixed; left: 12px; right: 12px; top: 68px; width: auto; }
  #day-title { font-size: 20px; }
  .day-head { position: sticky; top: 64px; z-index: 10; padding: 12px 16px; gap: 8px; }
  .day-head .chips { margin-top: 8px; }
  .progress { flex-basis: 100%; max-width: none; }
  .progress span { margin-bottom: 6px; }
  /* 달력과 팀원은 접어 두고, 누르면 펼친다. */
  .fold {
    display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 48px; padding: 0 16px;
    border: 1px solid var(--line); border-radius: 14px; background: var(--card); font-size: 15px; font-weight: 700;
  }
  .fold small { color: var(--muted); font-weight: 400; font-size: 14px; }
  .fold[aria-expanded="true"] svg { transform: rotate(180deg); }
  .foldable:not(.open) { display: none; }
  .btn, .btn.small { min-height: 44px; }
  .icon-btn { width: 44px; height: 44px; }
  .day { height: 44px; }
  .goal { flex-wrap: wrap; padding: 10px 10px 10px 12px; }
  .goal .seg { order: 3; width: 100%; }
  .goal .seg button { flex: 1; min-height: 44px; }
  .goal .del { width: 44px; height: 44px; }
  .goal-form input, .goal-form .btn { min-height: 48px; height: 48px; }
  .form-actions.sticky { margin: 0 -16px -16px; padding: 10px 16px; }
  .form-actions.sticky .btn { min-height: 48px; }
  .help-grid { grid-template-columns: 1fr; }
  .viewer-bar { padding: 12px 16px; }
  .notice-wrap { padding: 32px 16px; }
  .toast { bottom: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
