/* ===== Teamber 스타일 =====
   글자 대비: 본문 #1f2430, 보조 #596173 (흰 배경 기준 약 6:1, 웹 접근성 기준 4.5:1 이상)
   가장 작은 글씨 13px. 아이콘은 icons.js의 선 아이콘(.ic) 하나로 통일. */
:root {
  --primary: #3b5bdb;
  --primary-dark: #2f49b0;
  --primary-soft: #eaeeff;
  --accent: #6741d9;
  --accent-soft: #f1edff;
  --bg: #f4f5f9;
  --card: #ffffff;
  --text: #1f2430;
  --muted: #596173;
  --line: #e3e6ee;
  --green: #237032;
  --green-soft: #e6f4ea;
  --orange: #9a4a00;
  --orange-soft: #fff1dc;
  --red: #c92a2a;
  --red-soft: #fff0f0;
  --radius: 16px;
  --primary-bg: #3b5bdb;
  --accent-bg: #6741d9;
  --surface: #f7f8fb;
  --primary-tint: #f7f9ff;
  --line-strong: #c5cbe0;
  --accent-line: #b8c4f0;
  --chip: #eef0f4;
  --chip-text: #4a5263;
  --track: #e9ecf3;
  --accent-text: #4f4570;
  --warn-bg: #fff8eb; --warn-line: #f5d9a8; --warn-text: #6b4100;
  --ok-bg: #f3f8f4; --ok-line: #cfe5d5;
  --danger-bg: #fff3f0; --danger-line: #f1b8ad;
  --toast-bg: #1f2430; --toast-text: #fff;
  --auth-bg: linear-gradient(135deg, #e9edff 0%, #f4f5f9 60%);

  --sidebar-w: 248px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow-wrap: anywhere;   /* 긴 파일명·링크도 줄바꿈 → 가로 스크롤 방지 */
  word-break: keep-all;      /* 한글은 단어 단위로 줄바꿈 */
}
.hidden { display: none !important; }
button { font: inherit; cursor: pointer; color: inherit; }
a { color: var(--primary); }
:focus-visible { outline: 3px solid #91a7ff; outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- 아이콘 ---------- */
.ic { width: 18px; height: 18px; flex-shrink: 0; vertical-align: -3px; }
[data-icon] { display: inline-flex; align-items: center; }
.ic-lg { width: 22px; height: 22px; }
.ic-sm { width: 16px; height: 16px; }
.ic-box {
  width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary-soft); color: var(--primary);
}
.ic-box.violet { background: var(--accent-soft); color: var(--accent); }
.ic-box.green { background: var(--green-soft); color: var(--green); }
.ic-box.orange { background: var(--orange-soft); color: var(--orange); }
.icon-btn {
  border: 0; background: transparent; color: var(--muted); width: 40px; height: 40px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.icon-btn:hover { background: var(--bg); color: var(--primary); }

/* ---------- 버튼 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; border-radius: 11px; padding: 10px 16px; min-height: 42px;
  font-weight: 700; font-size: 14px; text-decoration: none; white-space: nowrap;
}
.btn-primary, .btn.primary { background: var(--primary-bg); color: #fff; border: 0; }
.btn-primary:hover, .btn.primary:hover { background: var(--primary-dark); }
.btn-ghost, .btn.ghost { background: var(--card); color: var(--text); border: 1px solid var(--line); }
.btn-ghost:hover, .btn.ghost:hover { border-color: var(--line-strong); }
.btn.soft { background: var(--primary-soft); color: var(--primary); }
.btn.danger-ghost { background: var(--card); color: var(--red); border: 1px solid var(--danger-line); }
.btn.sm { min-height: 36px; padding: 7px 12px; font-size: 13px; border-radius: 9px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.link {
  display: inline-flex; align-items: center; gap: 4px; color: var(--primary); font-size: 14px;
  background: none; border: 0; font-weight: 700; padding: 6px 2px; text-decoration: none; white-space: nowrap;
}
.link:hover { text-decoration: underline; }
.link.danger { color: var(--red); }

/* ---------- 인증 화면 ---------- */
.auth-body {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: var(--auth-bg);
}
.auth-card { width: 100%; max-width: 400px; background: var(--card); border-radius: 22px; padding: 32px 28px; box-shadow: 0 20px 50px rgba(59,91,219,.12); }
.auth-brand { display: flex; gap: 12px; align-items: center; margin-bottom: 24px; }
.brand-logo {
  width: 44px; height: 44px; border-radius: 12px; color: #fff; font-weight: 800; font-size: 22px;
  background: linear-gradient(135deg, var(--primary), var(--accent)); display: flex; align-items: center; justify-content: center;
}
.brand-name { font-weight: 800; font-size: 20px; }
.brand-sub { color: var(--muted); font-size: 14px; }
.auth-tabs { display: flex; gap: 6px; background: var(--bg); padding: 4px; border-radius: 12px; margin-bottom: 18px; }
.auth-tab { flex: 1; border: 0; background: transparent; padding: 10px; border-radius: 9px; color: var(--muted); font-weight: 700; }
.auth-tab.active { background: var(--card); color: var(--primary); box-shadow: 0 2px 6px rgba(0,0,0,.06); }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--text); font-weight: 600; }
.auth-form input { padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: 10px; font-size: 16px; color: var(--text); }
.auth-form input:focus { outline: none; border-color: var(--primary); }
.auth-form .btn-primary { padding: 13px; border-radius: 11px; font-weight: 700; font-size: 15px; margin-top: 4px; }
.auth-msg { color: var(--red); font-size: 14px; min-height: 20px; margin: 10px 0 0; }
.auth-foot { color: var(--muted); font-size: 13px; margin: 14px 0 0; }

/* ---------- 레이아웃 ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; background: var(--card); border-right: 1px solid var(--line);
  padding: 22px 16px; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.ws { display: flex; gap: 10px; align-items: center; padding: 4px 6px 20px; }
.ws-text { flex: 1; min-width: 0; }
.ws-logo {
  width: 40px; height: 40px; border-radius: 11px; color: #fff; font-weight: 800; font-size: 18px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), var(--accent)); display: flex; align-items: center; justify-content: center;
}
.ws-name { font-weight: 800; font-size: 17px; }
.ws-label { font-size: 13px; letter-spacing: 1px; color: var(--muted); font-weight: 600; }
.sidebar-close { display: none; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; border: 0; background: transparent; min-height: 44px;
  padding: 10px 12px; border-radius: 11px; color: var(--muted); font-weight: 700; font-size: 15px; text-align: left;
}
.nav-item:hover { background: var(--bg); color: var(--text); }
.nav-item.active { background: var(--primary-soft); color: var(--primary); }
.side-promo { margin-top: auto; background: var(--accent-soft); border-radius: 14px; padding: 14px; margin-bottom: 14px; }
.promo-title { font-weight: 700; font-size: 14px; display: flex; gap: 6px; align-items: flex-start; color: var(--text); }
.promo-title .ic { color: var(--accent); margin-top: 2px; }
.promo-sub { color: var(--accent-text); font-size: 13px; margin-top: 4px; }
.side-user { display: flex; gap: 10px; align-items: center; padding-top: 12px; border-top: 1px solid var(--line); }
.su-text { flex: 1; min-width: 0; }
.su-name { font-weight: 700; font-size: 14px; }
.su-email { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex-shrink: 0;
}
.avatar.c1 { background: #e7f5ff; color: #1864ab; }
.avatar.c2 { background: #ebfbee; color: #2b8a3e; }
.avatar.c3 { background: #fff4e6; color: #a64b00; }
.backdrop { position: fixed; inset: 0; background: rgba(20,25,45,.4); z-index: 39; }

.content { flex: 1; min-width: 0; padding: 26px 32px 60px; }
.content-inner { max-width: 1240px; margin: 0 auto; }
.topbar { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.menu-btn { display: none; background: var(--card); border: 1px solid var(--line); }
.search {
  flex: 1; max-width: 440px; min-width: 0; display: flex; align-items: center; gap: 8px; color: var(--muted);
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 0 14px; min-height: 44px;
}
.search:focus-within { border-color: var(--primary); }
.search input { border: 0; outline: none; flex: 1; min-width: 0; font-size: 15px; background: transparent; color: var(--text); padding: 10px 0; }
.search input::placeholder { color: var(--muted); }

/* ---------- 카드·제목 ---------- */
.card { background: var(--card); border-radius: var(--radius); padding: 20px; border: 1px solid var(--line); min-width: 0; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.section-head h2 { font-size: 17px; margin: 0; display: flex; align-items: center; gap: 8px; }
.section-head h3 { font-size: 15px; margin: 0; }
.section-sub { color: var(--muted); font-size: 14px; margin: -6px 0 14px; }
.greet { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.greet h1 { font-size: 26px; margin: 0 0 4px; line-height: 1.3; }
.greet p { color: var(--muted); margin: 0; font-size: 15px; }
.muted { color: var(--muted); font-size: 14px; }
.small { font-size: 13px; }
.mt { margin-top: 18px; }
.mt-s { margin-top: 10px; }
.foot-note { color: var(--muted); font-size: 13px; margin-top: 18px; display: flex; gap: 6px; align-items: center; }

/* 요약 카드 */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.stat { background: var(--card); border-radius: var(--radius); padding: 18px 20px; border: 1px solid var(--line); display: flex; gap: 14px; align-items: center; min-width: 0; }
.stat-label { color: var(--muted); font-size: 14px; font-weight: 600; }
.stat-num { font-size: 28px; font-weight: 800; line-height: 1.2; }
.stat-sub { color: var(--muted); font-size: 13px; }

/* 대시보드 배치 */
.dash-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }

.proj-card {
  border: 1px solid var(--line); border-radius: 14px; padding: 16px; background: var(--card); text-align: left; width: 100%;
  transition: box-shadow .15s, transform .15s; display: block; min-width: 0;
}
.proj-card:hover { box-shadow: 0 6px 18px rgba(59,91,219,.12); transform: translateY(-1px); }
.pc-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; }
.badge { background: var(--primary-soft); color: var(--primary); font-size: 13px; font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.violet { background: var(--accent-soft); color: var(--accent); }
.badge.orange { background: var(--orange-soft); color: var(--orange); }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.gray { background: var(--chip); color: var(--chip-text); }
.dday { font-size: 13px; font-weight: 800; color: var(--orange); white-space: nowrap; }
.dday.late { color: var(--red); }
.pc-title { font-weight: 700; font-size: 16px; margin-bottom: 4px; }
.pc-desc { color: var(--muted); font-size: 14px; margin-bottom: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.progress-row { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.progress-row .pct { font-weight: 800; color: var(--primary); }
.bar { height: 8px; background: var(--track); border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--primary-bg); border-radius: 999px; }
.members { display: flex; align-items: center; margin-top: 12px; }
.members .avatar { width: 28px; height: 28px; font-size: 13px; margin-right: -6px; border: 2px solid var(--card); }
.members .more { font-size: 13px; color: var(--muted); margin-left: 12px; }

/* 빈 상태 */
.empty-state {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px;
  padding: 26px 16px; border: 1px dashed var(--accent-line); border-radius: 14px; background: var(--primary-tint);
}
.empty-state .ic-box { width: 44px; height: 44px; border-radius: 12px; margin-bottom: 4px; }
.empty-state .ic-box .ic { width: 22px; height: 22px; }
.empty-state h3 { margin: 0; font-size: 16px; }
.empty-state p { margin: 0; color: var(--muted); font-size: 14px; max-width: 420px; }
.empty-state .actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 10px; }
.empty-state.compact { padding: 18px 14px; }
.steps { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; text-align: left; width: 100%; max-width: 360px; }
.steps li { display: flex; gap: 10px; align-items: center; font-size: 14px; color: var(--text); }
.steps .num {
  width: 24px; height: 24px; border-radius: 50%; background: var(--primary-soft); color: var(--primary);
  font-weight: 800; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.loading { color: var(--muted); font-size: 15px; text-align: center; padding: 40px 0; }

/* AI 패널 */
.ai-box { background: var(--accent-soft); border-radius: 12px; padding: 14px; }
.ai-box h4 { margin: 8px 0 6px; font-size: 15px; }
.ai-box ul { margin: 0 0 10px; padding-left: 18px; color: var(--accent-text); font-size: 14px; }
.ai-box .src { color: var(--accent-text); font-size: 13px; margin-bottom: 12px; display: flex; gap: 6px; align-items: center; }
.flow { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.flow li { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.flow li b { display: block; }
.flow li span.muted { font-size: 13px; }

/* 할 일 */
.task-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.task-row:last-child { border-bottom: 0; }
.task-check {
  width: 26px; height: 26px; border: 2px solid var(--line-strong); border-radius: 50%; flex-shrink: 0; background: var(--card);
  display: inline-flex; align-items: center; justify-content: center; color: #fff; padding: 0;
}
.task-check:hover { border-color: var(--green); }
.task-check.done { background: var(--green); border-color: var(--green); }
.task-check .ic { width: 15px; height: 15px; }
.task-main { flex: 1 1 180px; min-width: 0; }
.task-title { font-size: 15px; font-weight: 600; }
.task-title.done { text-decoration: line-through; color: var(--muted); }
.task-sub { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.task-sub .ic { width: 14px; height: 14px; }
.task-meta { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }
.task-due { font-size: 13px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.task-due.today, .task-due.late { color: var(--red); }
.chip { font-size: 13px; font-weight: 700; padding: 3px 11px; border-radius: 999px; white-space: nowrap; }
.chip.todo { background: var(--orange-soft); color: var(--orange); }
.chip.doing { background: var(--primary-soft); color: var(--primary); }
.chip.done { background: var(--green-soft); color: var(--green); }

/* 자료 */
.file-drop {
  display: flex; flex-direction: column; align-items: center; gap: 4px; width: 100%;
  border: 2px dashed var(--accent-line); border-radius: 12px; padding: 18px; text-align: center; background: var(--primary-tint);
  color: var(--primary); font-weight: 700; margin-bottom: 14px; font-size: 15px;
}
.file-drop:hover, .file-drop.drag { background: var(--primary-soft); border-color: var(--primary); }
.file-drop .hint { color: var(--muted); font-weight: 500; font-size: 13px; }
.file-drop .title { display: inline-flex; gap: 6px; align-items: center; }
.file-drop.busy { opacity: .7; pointer-events: none; }
.select-row { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.select-row label { font-size: 14px; color: var(--muted); font-weight: 600; }
.select-row select { flex: 1; min-width: 0; }
.file-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.file-row:last-child { border-bottom: 0; }
.file-ic {
  width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; color: #fff; letter-spacing: .3px;
}
.file-ic.pdf { background: #c92a2a; } .file-ic.docx { background: #1864ab; }
.file-ic.txt { background: #495057; } .file-ic.img { background: #2b8a3e; }
.file-main { flex: 1 1 160px; min-width: 0; }
.file-name { font-weight: 600; font-size: 15px; }
.file-meta { color: var(--muted); font-size: 13px; display: flex; gap: 4px 8px; flex-wrap: wrap; align-items: center; }
.file-actions { display: flex; gap: 2px; margin-left: auto; flex-wrap: wrap; }
.status { display: inline-flex; gap: 4px; align-items: center; font-weight: 700; }
.status.done { color: var(--green); } .status.failed { color: var(--red); } .status.pending { color: var(--orange); }

/* 상세 */
.back-link { margin-bottom: 6px; }
.detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.detail-head h1 { font-size: 24px; margin: 0 0 6px; line-height: 1.3; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); font-size: 14px; align-items: center; }
.detail-meta span { display: inline-flex; gap: 5px; align-items: center; }
.detail-goal { margin: 10px 0 0; display: flex; gap: 6px; align-items: flex-start; font-size: 15px; }
.detail-goal .ic { color: var(--primary); margin-top: 3px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.tabs {
  display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px;
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  border: 0; background: none; padding: 12px 14px; color: var(--muted); font-weight: 700; font-size: 15px;
  border-bottom: 3px solid transparent; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center;
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab .count { background: var(--accent-bg); color: #fff; border-radius: 999px; font-size: 13px; padding: 0 8px; line-height: 21px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }

/* AI 분석·검토 */
.review-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; list-style: none; padding: 0; }
.review-steps li {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: flex; gap: 10px; align-items: center; min-width: 0;
}
.review-steps li.on { border-color: var(--accent-line); background: var(--primary-tint); }
.review-steps b { display: block; font-size: 14px; }
.review-steps span.muted { font-size: 13px; }
.analysis-file { border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 12px; }
.analysis-file:last-child { margin-bottom: 0; }
.analysis-file .af-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.analysis-file .af-head .file-main { flex: 1 1 140px; }
.a-label { font-size: 13px; font-weight: 800; color: var(--muted); margin: 12px 0 4px; display: flex; gap: 6px; align-items: center; }
.a-label .ic { width: 15px; height: 15px; }
.a-summary { font-size: 14px; margin: 0; background: var(--surface); border-radius: 10px; padding: 10px 12px; }
.a-list { margin: 0; padding-left: 18px; font-size: 14px; }
.a-list li { margin: 3px 0; }
.check-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: 10px; margin-bottom: 8px; font-size: 14px; }
.check-item .ic { color: var(--orange); margin-top: 2px; }
.check-item .from { color: var(--warn-text); font-size: 13px; margin-top: 12px; padding-top: 10px; border-top: 1px dashed rgba(122,74,0,.25); }
.draft-toolbar { display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 12px; }
.draft-item { border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 10px; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; }
.draft-item.off { background: var(--surface); }
.draft-item.off .draft-body { opacity: .6; }
.draft-item input[type=checkbox] { width: 20px; height: 20px; margin-top: 10px; accent-color: var(--primary); }
.draft-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
.draft-fields label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); font-weight: 700; min-width: 0; }
.draft-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; align-items: center; }
.evidence { margin-top: 10px; font-size: 13px; color: var(--text); background: var(--surface); border-left: 3px solid var(--accent-line); padding: 8px 10px; border-radius: 0 8px 8px 0; }
.evidence b { color: var(--muted); }
.draft-foot { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 4px; }
.draft-foot .btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* 입력칸 공통 */
input[type=text], input[type=date], input[type=search], select, textarea { font: inherit; }
.field, .modal input, .modal textarea, .modal select, .draft-item input[type=text], .draft-item input[type=date], .draft-item select, .select-row select {
  padding: 9px 11px; border: 1px solid var(--line-strong); border-radius: 9px; font-size: 15px; color: var(--text);
  background-color: var(--card); width: 100%; min-width: 0;
}
.modal input:focus, .modal textarea:focus, .modal select:focus, .draft-item input:focus, .draft-item select:focus { outline: none; border-color: var(--primary); }

/* 모달 */
.modal-overlay { position: fixed; inset: 0; background: rgba(20,25,45,.45); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.modal { background: var(--card); border-radius: 18px; padding: 24px; width: 100%; max-width: 520px; max-height: 90vh; overflow: auto; }
.modal h3 { margin: 0 0 16px; font-size: 19px; }
.modal label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--text); font-weight: 600; margin-bottom: 12px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; flex-wrap: wrap; }
.modal-msg { color: var(--red); font-size: 14px; min-height: 18px; margin: 0; }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.copy-field { display: flex; gap: 8px; }
.copy-field input { flex: 1; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--toast-bg); color: var(--toast-text);
  padding: 12px 20px; border-radius: 12px; font-size: 15px; z-index: 100; opacity: 0; transition: opacity .25s;
  pointer-events: none; max-width: calc(100% - 32px); text-align: center;
}
.toast.show { opacity: 1; }

/* ---------- 반응형 ----------
   1100px 이하: 대시보드 본문을 한 열로
   1024px 이하: 사이드바를 접고 메뉴 버튼으로 연다
   720px 이하: 요약 카드도 한 열, 여백·글씨 조정 */
@media (max-width: 1100px) {
  .dash-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1024px) {
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 40; height: 100%;
    transform: translateX(-100%); transition: transform .25s; box-shadow: 0 0 40px rgba(0,0,0,.18);
    visibility: hidden;
  }
  .sidebar.open { transform: translateX(0); visibility: visible; }
  .sidebar-close, .menu-btn { display: inline-flex; }
  .content { padding: 18px 24px 50px; }
  .review-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 800px) {
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .draft-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .stats { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .stat { padding: 14px 16px; }
  .stat-num { font-size: 24px; }
  .content { padding: 14px 14px 40px; }
  .card { padding: 16px; }
  .greet h1 { font-size: 22px; }
  .greet .btn { width: 100%; }
  .detail-head h1 { font-size: 21px; }
  .search { max-width: none; }
}
@media (max-width: 480px) {
  .two-col, .draft-fields, .review-steps { grid-template-columns: minmax(0, 1fr); }
  .task-meta { margin-left: 38px; justify-content: flex-start; }
  .file-actions { margin-left: 52px; }
  .modal { padding: 20px 16px; }
  .draft-foot .btn-row, .draft-foot .btn-row .btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* 할 일 거르기 */
.filter-bar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.filter {
  border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 999px;
  padding: 6px 12px; font-size: 14px; font-weight: 600; min-height: 36px; display: inline-flex; gap: 6px; align-items: center;
}
.filter .n { color: var(--muted); font-weight: 700; }
.filter.active { background: var(--primary-bg); border-color: var(--primary); color: #fff; }
.filter.active .n { color: #fff; }

/* 완료한 할 일 접기 */
.done-fold { margin-top: 10px; border-top: 1px solid var(--line); }
.done-fold summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 12px 0; font-weight: 700; font-size: 15px; color: var(--green); min-height: 44px;
}
.done-fold summary::-webkit-details-marker { display: none; }
.done-fold summary::before { content: ""; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); margin: 0 4px; transition: transform .15s; }
.done-fold[open] summary::before { transform: rotate(45deg); }


/* 확인 필요 항목: 결정 버튼, 해결됨 */
.check-title { font-weight: 700; display: block; }
.check-item .a-list { margin: 6px 0 0; }
.check-note { margin: 8px 0 0; font-size: 14px; color: var(--warn-text); display: flex; gap: 6px; align-items: flex-start; }
.check-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.check-done { margin-top: 8px; font-size: 14px; color: var(--green); font-weight: 700; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.check-item.resolved { background: var(--ok-bg); border-color: var(--ok-line); }
.check-item.resolved > .ic { color: var(--green); }
.check-item.strong { background: var(--danger-bg); border-color: var(--danger-line); }
.check-item.strong > .ic { color: var(--red); }
.draft-item.on { border-color: var(--primary); background: var(--primary-tint); }
.draft-item.blocked { background: var(--surface); }
.draft-item.blocked .draft-body > *:not(.check-note) { opacity: .65; }
.draft-item.blocked .check-note { color: var(--red); }

/* 할 일 묶음: 진행 중 / 할 일 / 완료 */
.task-group + .task-group { margin-top: 10px; }
.group-title { font-size: 14px; color: var(--muted); margin: 12px 0 2px; display: flex; gap: 6px; align-items: center; }
.group-title .n { background: var(--chip); color: var(--chip-text); border-radius: 999px; padding: 0 8px; font-size: 13px; }
.task-group.doing .group-title { color: var(--primary); }
.done-fold { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 0 14px; margin-top: 16px; }
.done-list .task-row { opacity: .8; }
.done-list .task-row .badge, .done-list .task-row .task-due { filter: grayscale(.6); }

/* 확인 카드: 버튼 영역과 근거 사이 여백 */
.check-actions { margin-bottom: 4px; row-gap: 8px; }
.check-done { margin-bottom: 4px; }

/* 자료 분석 결과: 파일별 카드 구분, 자세히 보기 */
.analysis-file { background: var(--card); border-left: 4px solid var(--accent-line); }
.af-num { width: 24px; height: 24px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-weight: 800; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.analysis-file .af-head { margin-bottom: 8px; }
.af-more { margin-top: 8px; }
.af-more summary, .evidence-fold summary {
  cursor: pointer; color: var(--primary); font-weight: 700; font-size: 14px; padding: 6px 0; min-height: 36px;
  display: inline-flex; align-items: center;
}
.evidence-fold { margin-top: 6px; }
.evidence-fold .evidence { margin-top: 4px; }
.draft-group + .draft-group { margin-top: 18px; }
.draft-group .group-title { margin: 0 0 8px; }
.late-list { margin: 10px 0; padding-left: 18px; }
.late-list li { margin: 4px 0; }
.check-line { flex-direction: row !important; align-items: flex-start; gap: 8px !important; color: var(--text) !important; }
.check-line input { width: 20px !important; height: 20px; margin-top: 1px; flex-shrink: 0; accent-color: var(--primary); }

/* 팀 일정: 달력 */
.cal-layout { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.cal-head { justify-content: flex-start; flex-wrap: nowrap; }
.cal-head h2 { flex: 1; justify-content: center; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-week div { text-align: center; font-size: 13px; font-weight: 700; color: var(--muted); padding: 4px 0; }
.cal-week div:first-child { color: var(--red); }
.cal-cell {
  border: 1px solid transparent; background: var(--surface); border-radius: 10px; min-height: 52px; padding: 4px;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 2px; font-size: 14px;
}
.cal-cell.empty { background: transparent; }
.cal-cell:hover { border-color: var(--line-strong); }
.cal-cell .d { font-weight: 600; }
.cal-cell .cnt { background: var(--primary-bg); color: #fff; border-radius: 999px; font-size: 13px; font-weight: 700; min-width: 22px; line-height: 20px; padding: 0 6px; }
.cal-cell.late .cnt { background: var(--red); }
.cal-cell.today { border-color: var(--primary); }
.cal-cell.today .d { color: var(--primary); font-weight: 800; }
.cal-cell.sel { background: var(--primary-soft); border-color: var(--primary); }
.list-title { font-size: 18px; margin-bottom: 0; }
.late-card { border-color: var(--danger-line); }
@media (max-width: 1100px) { .cal-layout { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 480px) { .cal-cell { min-height: 44px; border-radius: 8px; } .cal-grid { gap: 2px; } }

/* ---------- 다크 모드 (설정에서 선택, 기본은 화이트) ---------- */
:root[data-theme="dark"] {
  color-scheme: dark;
  --primary: #9db0ff; --primary-dark: #2f49b0; --primary-soft: #263056; --primary-bg: #3b5bdb;
  --accent: #c0aaff; --accent-soft: #2c2547; --accent-bg: #6741d9;
  --bg: #12151c; --card: #1b1f29; --surface: #222734; --primary-tint: #1e2438;
  --text: #e8eaf0; --muted: #a8afbf; --line: #2e3444; --line-strong: #4a5266; --accent-line: #3f4b7c;
  --green: #7ee08f; --green-soft: #1d3324; --orange: #ffbd6e; --orange-soft: #3a2c17;
  --red: #ff9a9a; --red-soft: #3b2224;
  --chip: #2a3040; --chip-text: #cfd5e1; --track: #2e3444; --accent-text: #d6c8ff;
  --warn-bg: #2d2615; --warn-line: #5c4a20; --warn-text: #ffd8a8;
  --ok-bg: #1b2a20; --ok-line: #2f5a3a; --danger-bg: #33201f; --danger-line: #6b3530;
  --toast-bg: #e8eaf0; --toast-text: #12151c;
  --auth-bg: linear-gradient(135deg, #1a2140 0%, #12151c 60%);
}
:root[data-theme="dark"] .avatar.c1 { background: #1d2f45; color: #a5d8ff; }
:root[data-theme="dark"] .avatar.c2 { background: #1d3324; color: #b2f2bb; }
:root[data-theme="dark"] .avatar.c3 { background: #3a2c17; color: #ffd8a8; }
:root[data-theme="dark"] .search input::placeholder { color: var(--muted); }
:root[data-theme="dark"] .card, :root[data-theme="dark"] .stat, :root[data-theme="dark"] .review-steps li { border-color: var(--line); }

/* 로고 (누르면 내 프로젝트 첫 화면) */
.ws-home { display: flex; gap: 10px; align-items: center; border: 0; background: transparent; padding: 4px; margin: -4px; border-radius: 12px; flex: 1; min-width: 0; text-align: left; }
.ws-home:hover { background: var(--surface); }
.ws-home .ws-text { display: flex; flex-direction: column; }
.ws-logo-img, .brand-logo-img { width: 40px; height: 40px; flex-shrink: 0; object-fit: contain; background: transparent; }
.brand-logo-img { width: 44px; height: 44px; }

/* 프로필 버튼 */
.side-user { border: 0; border-top: 1px solid var(--line); background: transparent; width: 100%; text-align: left; border-radius: 0; padding: 12px 6px 4px; }
.side-user:hover { background: var(--surface); border-radius: 12px; }
.su-text { display: flex; flex-direction: column; }
.su-more { color: var(--muted); }

/* 설정 창 */
.settings-section { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 14px; }
.settings-section h4 { margin: 0 0 8px; font-size: 14px; color: var(--muted); }
.kv { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 15px; }
.theme-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.theme-pick button { display: flex; gap: 8px; align-items: center; justify-content: center; min-height: 48px; border-radius: 12px; border: 2px solid var(--line); background: var(--card); color: var(--text); font-weight: 700; }
.theme-pick button[aria-pressed="true"] { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.name-row { display: flex; gap: 8px; }
.name-row input { flex: 1; }

/* 삭제 확인 */
.danger-box { background: var(--danger-bg); border: 1px solid var(--danger-line); border-radius: 12px; padding: 12px 14px; margin: 10px 0; }
.danger-box ul { margin: 6px 0 0; padding-left: 18px; }
.danger-box li { margin: 3px 0; }
.btn.danger { background: #c92a2a; color: #fff; border: 0; }
.btn.danger:hover { background: #a61e1e; }

/* 검색 일치 근거 */
.match { margin-top: 6px; display: flex; flex-direction: column; gap: 4px; }
.match-line { font-size: 13px; color: var(--muted); display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.match-line .badge { font-size: 13px; }
.match-line mark { background: #ffe066; color: #1f2430; border-radius: 3px; padding: 0 2px; }
.proj-card .match { text-align: left; }

/* 자료 용도(분석 방식) */
.purpose-row { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.purpose-switch { display: flex; gap: 6px; flex-wrap: wrap; }
.purpose-btn { display: inline-flex; gap: 6px; align-items: center; min-height: 36px; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--card); color: var(--text); font-weight: 700; font-size: 14px; }
.purpose-btn[aria-pressed="true"] { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.purpose-btn:disabled { opacity: .6; }
.analysis-file.dlv { border-left-color: var(--accent); }
.analysis-file.unsure { border-left-color: var(--orange); }
.warn-text { color: var(--warn-text); }
.fb-summary { margin-top: 10px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.fb-summary p { flex-basis: 100%; color: var(--text); }
.crit-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.crit-list li { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: 14px; }
.ai-scope { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 4px; }
.ai-scope li { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
#head-progress { font-weight: 700; color: var(--primary); }

/* 개요: 최근 활동은 왼쪽 진행 상황 카드 높이에 맞춰 늘어나고, 넘치면 카드 안에서만 스크롤 */
.grid-2:has(.activity-card) { align-items: stretch; }
.activity-card { display: flex; flex-direction: column; }
.activity-list { list-style: none; margin: 0; padding: 0; }
.activity-item { padding: 10px 0; border-bottom: 1px solid var(--line); }
.activity-item:last-child { border-bottom: 0; }
.activity-scroll { max-height: 55vh; overflow-y: auto; padding-right: 4px; }
.modal-tabs { margin: -4px 0 16px; }
@media (max-width: 800px) { .grid-2:has(.activity-card) { align-items: start; } }

/* 선택 칸: 기본 화살표 대신 테두리에서 떨어진 화살표 (오른쪽 여백 확보) */
select {
  -webkit-appearance: none; appearance: none;
  padding-right: 40px !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23596173' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 16px;
  text-overflow: ellipsis;
}
:root[data-theme="dark"] select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23a8afbf' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}
