/* megatwin_project — 컨소시엄 과제 관리 사이트
   빌드 단계가 없으므로 순수 CSS 한 장으로 유지한다. */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --border: #e2e5ea;
  --border-strong: #cbd2dc;
  --text: #1c2129;
  --text-dim: #5b6472;
  --text-faint: #8b95a4;
  --accent: #2563eb;
  --accent-soft: #eaf0ff;

  --planned: #94a3b8;
  --active: #2563eb;
  --done: #16a34a;
  --delayed: #dc2626;
  --hold: #a16207;

  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Pretendard", -apple-system, BlinkMacSystemFont, "Segoe UI",
               "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ------------------------------------------------------------ 레이아웃 */

.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 210px;
  flex: 0 0 210px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 14px 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  padding: 4px 16px 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}
.brand a { color: var(--text); font-weight: 700; font-size: 14px; line-height: 1.35;
           display: block; }
.brand .period { color: var(--text-faint); font-size: 11px; font-weight: 400;
                 margin-top: 3px; font-family: var(--mono); }

.nav-group { padding: 10px 16px 4px; font-size: 11px; color: var(--text-faint);
             font-weight: 600; letter-spacing: .03em; }
.nav a {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 16px; color: var(--text-dim); font-size: 13px;
  border-left: 2px solid transparent;
}
.nav a:hover { background: var(--bg); color: var(--text); text-decoration: none; }
.nav a.active {
  color: var(--accent); background: var(--accent-soft);
  border-left-color: var(--accent); font-weight: 600;
}
.nav .badge { margin-left: auto; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 52px; flex: 0 0 52px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px; padding: 0 20px;
  position: sticky; top: 0; z-index: 20;
}
.topbar .spacer { flex: 1; }
.topbar .who { color: var(--text-dim); font-size: 13px; }
.topbar .who b { color: var(--text); }

.content { padding: 22px; max-width: 1400px; width: 100%; }

.page-head { margin-bottom: 18px; }
.page-head h1 { margin: 0 0 4px; font-size: 20px; font-weight: 700; }
.page-head p { margin: 0; color: var(--text-dim); font-size: 13px; }

/* -------------------------------------------------------------- 컴포넌트 */

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; margin-bottom: 16px;
}
.card > h2 { margin: 0 0 12px; font-size: 15px; font-weight: 700; }
.card > h2 .sub { font-weight: 400; color: var(--text-faint); font-size: 12px;
                  margin-left: 6px; }

.grid { display: grid; gap: 14px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) {
  .grid.c3, .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}

.stat { background: var(--surface); border: 1px solid var(--border);
        border-radius: var(--radius); padding: 14px 16px; }
.stat .label { font-size: 12px; color: var(--text-dim); }
.stat .value { font-size: 26px; font-weight: 700; line-height: 1.2; margin-top: 2px;
               font-variant-numeric: tabular-nums; }
.stat .value small { font-size: 13px; font-weight: 500; color: var(--text-faint); }
.stat .foot { font-size: 11px; color: var(--text-faint); margin-top: 4px; }

/* 상태 배지 */
.badge {
  display: inline-block; padding: 1px 7px; border-radius: 999px;
  font-size: 11px; font-weight: 600; line-height: 1.7; white-space: nowrap;
}
.badge.planned { background: #eef1f5; color: #5b6472; }
.badge.active  { background: #e0ecff; color: #1d4ed8; }
.badge.done    { background: #dcfce7; color: #15803d; }
.badge.delayed { background: #fee2e2; color: #b91c1c; }
.badge.hold    { background: #fef3c7; color: #92400e; }
.badge.gray    { background: #eef1f5; color: #5b6472; }
.badge.info    { background: var(--accent-soft); color: var(--accent); }

.org-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 1px 8px 1px 6px; border-radius: 999px;
  background: #f1f3f6; font-size: 11px; font-weight: 600; color: var(--text-dim);
  white-space: nowrap;
}
.org-chip i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }

/* 진행 막대 */
.bar { height: 6px; background: #eceff3; border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent);
              border-radius: 999px; }
.bar.done > span { background: var(--done); }
.bar.delayed > span { background: var(--delayed); }

/* 표 */
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th, table.tbl td {
  padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border);
  vertical-align: top;
}
table.tbl th {
  font-size: 11px; color: var(--text-dim); font-weight: 600;
  background: #fafbfc; white-space: nowrap; position: sticky; top: 0;
}
table.tbl tr:hover td { background: #fafbfc; }
table.tbl td.num { font-variant-numeric: tabular-nums; white-space: nowrap;
                   color: var(--text-dim); }
.table-wrap { overflow-x: auto; }

/* 버튼 */
.btn {
  display: inline-block; padding: 6px 13px; border-radius: 7px;
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text); font-size: 13px; font-weight: 600; cursor: pointer;
}
.btn:hover { background: var(--bg); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #1d4ed8; }
.btn.sm { padding: 3px 9px; font-size: 12px; }

/* 폼 */
.form label { display: block; font-size: 12px; font-weight: 600;
              color: var(--text-dim); margin: 12px 0 4px; }
.form input[type=text], .form input[type=password], .form input[type=email],
.form input[type=date], .form input[type=number], .form select, .form textarea {
  width: 100%; padding: 7px 10px; font-size: 13px; font-family: inherit;
  border: 1px solid var(--border-strong); border-radius: 7px; background: #fff;
}
.form textarea { min-height: 90px; resize: vertical; }
.form .help { font-size: 11px; color: var(--text-faint); margin-top: 3px; }
.form .errors { color: var(--delayed); font-size: 12px; margin-top: 3px; }

.messages { margin-bottom: 14px; }
.msg { padding: 9px 13px; border-radius: 8px; font-size: 13px; margin-bottom: 8px; }
.msg.success { background: #dcfce7; color: #15803d; }
.msg.error   { background: #fee2e2; color: #b91c1c; }
.msg.warning { background: #fef3c7; color: #92400e; }
.msg.info    { background: var(--accent-soft); color: var(--accent); }

.empty { padding: 28px; text-align: center; color: var(--text-faint); font-size: 13px; }

.note {
  font-size: 12px; color: var(--text-dim); background: #fffbeb;
  border: 1px solid #fde68a; border-radius: 8px; padding: 9px 12px;
  margin-bottom: 14px;
}

/* ---------------------------------------------------------------- 간트 */

.gantt { width: 100%; border-collapse: collapse; font-size: 12px; }
.gantt th, .gantt td { border: 1px solid var(--border); padding: 0; }
.gantt th { background: #fafbfc; font-size: 11px; color: var(--text-dim);
            font-weight: 600; text-align: center; padding: 5px 0; }
.gantt th.name, .gantt td.name { text-align: left; padding: 6px 9px; width: 40%;
                                 min-width: 260px; }
.gantt td.no { text-align: center; color: var(--text-faint); width: 34px;
               font-variant-numeric: tabular-nums; }
.gantt td.m { height: 26px; width: 38px; }
.gantt td.m.on { background: var(--accent); }
.gantt td.m.on.done { background: var(--done); }
.gantt td.m.on.delayed { background: var(--delayed); }
.gantt td.m.na { background: repeating-linear-gradient(45deg, #f1f3f6, #f1f3f6 3px,
                 #e4e8ee 3px, #e4e8ee 6px); }
.gantt td.m.now { box-shadow: inset 0 0 0 2px #f59e0b; }
.gantt tr:hover td.name { background: #fafbfc; }

/* --------------------------------------------------------- 목표 트리 */

.goal-final {
  background: linear-gradient(135deg, #1e3a8a, #2563eb); color: #fff;
  border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px;
}
.goal-final .label { font-size: 11px; opacity: .8; font-weight: 600;
                     letter-spacing: .04em; }
.goal-final p { margin: 6px 0 0; font-size: 15px; line-height: 1.6; font-weight: 500; }

.subgoal { border-left: 3px solid var(--accent); }
.subgoal .no { font-size: 11px; font-weight: 700; color: var(--accent); }
.subgoal h3 { margin: 2px 0 8px; font-size: 14px; font-weight: 700; }
.subgoal ul { margin: 0; padding-left: 17px; color: var(--text-dim); font-size: 12px; }
.subgoal li { margin-bottom: 3px; }

details.tree { margin-bottom: 6px; }
details.tree > summary {
  cursor: pointer; padding: 7px 10px; border-radius: 7px; background: #fafbfc;
  font-size: 13px; font-weight: 600; list-style: none;
}
details.tree > summary::-webkit-details-marker { display: none; }
details.tree > summary::before { content: "▸ "; color: var(--text-faint); }
details.tree[open] > summary::before { content: "▾ "; }
details.tree > summary:hover { background: #f1f3f6; }
details.tree .body { padding: 9px 10px 4px 22px; }

.kv { display: grid; grid-template-columns: 92px 1fr; gap: 5px 12px; font-size: 13px; }
.kv dt { color: var(--text-dim); font-size: 12px; }
.kv dd { margin: 0; }

ul.plain { margin: 0; padding-left: 17px; }
ul.plain li { margin-bottom: 3px; }

.prose { font-size: 14px; line-height: 1.7; }
.prose img { max-width: 100%; height: auto; }
.prose table { border-collapse: collapse; }
.prose table td, .prose table th { border: 1px solid var(--border); padding: 5px 8px; }
.prose pre { background: #f6f7f9; padding: 10px; border-radius: 7px; overflow-x: auto; }
