/* 대표 보고 포털 — 피나클 네이비/골드, 모바일 우선 */
:root {
  --navy: #12294d;
  --navy-2: #1b3a6b;
  --navy-soft: #eef2f8;
  --gold: #c9a227;
  --ink: #17202e;
  --muted: #66738a;
  --line: #dde3ec;
  --bg: #f5f7fa;
  --card: #ffffff;
  --ok: #1f7a4d;
  --warn: #b8860b;
  --danger: #b3261e;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(18, 41, 77, .06), 0 8px 24px rgba(18, 41, 77, .07);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Pretendard", -apple-system, BlinkMacSystemFont, "Malgun Gothic", "맑은 고딕", "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--navy-2); }
.boot { padding: 40px; color: var(--muted); text-align: center; }
[hidden] { display: none !important; }

/* ── 로그인 ─────────────────────────────────────────── */
.login-wrap {
  min-height: 100svh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px 18px calc(24px + env(safe-area-inset-bottom));
  background: linear-gradient(160deg, #12294d 0%, #1b3a6b 55%, #24508f 100%);
}
.login-card {
  width: 100%; max-width: 380px;
  background: #fff; border-radius: 18px; padding: 28px 24px 24px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .28);
}
.login-card h1 { margin: 0 0 4px; font-size: 21px; letter-spacing: -.02em; }
.login-card .sub { margin: 0 0 20px; color: var(--muted); font-size: 13px; }
.who { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.who button {
  padding: 12px 8px; border: 1.5px solid var(--line); background: #fff;
  border-radius: 12px; font-weight: 600; color: var(--muted);
}
.who button.on { border-color: var(--navy-2); background: var(--navy-soft); color: var(--navy); }
.who small { display: block; font-weight: 400; font-size: 11px; opacity: .75; }
.pin-display { display: flex; gap: 10px; justify-content: center; margin: 6px 0 14px; }
.pin-dot { width: 14px; height: 14px; border-radius: 50%; background: #e3e8f0; transition: .15s; }
.pin-dot.on { background: var(--navy-2); transform: scale(1.08); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.keypad button {
  padding: 14px 0; font-size: 19px; font-weight: 600;
  border: 1px solid var(--line); background: #fff; border-radius: 12px;
}
.keypad button:active { background: var(--navy-soft); }
.keypad button.wide { grid-column: span 1; font-size: 14px; color: var(--muted); }
.login-err { color: var(--danger); font-size: 13px; min-height: 20px; margin-top: 12px; text-align: center; }

/* ── 공통 레이아웃 ──────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--navy); color: #fff;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  display: flex; align-items: center; gap: 10px;
}
.topbar .brand { font-weight: 700; letter-spacing: -.02em; font-size: 16px; }
.topbar .brand span { color: var(--gold); }
.topbar .spacer { flex: 1; }
.topbar button {
  background: rgba(255, 255, 255, .12); border: 0; color: #fff;
  padding: 7px 11px; border-radius: 9px; font-size: 13px;
}
.topbar button:active { background: rgba(255, 255, 255, .24); }
.back-btn { background: rgba(255,255,255,.12); border: 0; color: #fff; padding: 7px 10px; border-radius: 9px; }
main { padding: 16px 16px calc(40px + env(safe-area-inset-bottom)); max-width: 1180px; margin: 0 auto; }

.section-head { display: flex; align-items: center; gap: 10px; margin: 22px 0 10px; }
.section-head h2 { font-size: 15px; margin: 0; letter-spacing: -.01em; }
.section-head .spacer { flex: 1; }

.btn {
  border: 1px solid var(--line); background: #fff; border-radius: 10px;
  padding: 9px 13px; font-size: 14px; font-weight: 500;
}
.btn:active { background: #f0f3f8; }
.btn.primary { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn.gold { background: var(--gold); color: #22303f; border-color: var(--gold); font-weight: 600; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: #eccbc8; }
.btn.sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .5; }

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--navy-soft); color: var(--navy-2);
}
.chip.검토 { background: #eef2f8; color: #43536b; }
.chip.진행중 { background: #e4f1ea; color: var(--ok); }
.chip.보류 { background: #fdf3dd; color: var(--warn); }
.chip.완료 { background: #e6ecf6; color: var(--navy-2); }
.chip.중단 { background: #fbe9e7; color: var(--danger); }
.chip.new { background: var(--gold); color: #22303f; }

/* ── 사업 카드 ──────────────────────────────────────── */
.cards { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 700px) { .cards { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1020px) { .cards { grid-template-columns: 1fr 1fr 1fr; } }
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 15px 16px; border-left: 4px solid var(--navy-2); text-align: left; width: 100%;
  border-top: 0; border-right: 0; border-bottom: 0; display: block;
}
.card h3 { margin: 0 0 2px; font-size: 16px; letter-spacing: -.01em; }
.card .code { font-size: 11px; color: var(--muted); font-weight: 600; letter-spacing: .04em; }
.card .sum { color: var(--muted); font-size: 13px; margin: 8px 0 10px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .meta { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 12px; color: var(--muted); }
.bar { height: 6px; background: #eaeef4; border-radius: 99px; overflow: hidden; margin: 10px 0 8px; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--navy-2), #3a6fbf); }

/* ── 상세 ───────────────────────────────────────────── */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin: 14px 0 4px; overflow-x: auto; }
.tabs button {
  border: 0; background: none; padding: 10px 12px; font-weight: 600; color: var(--muted);
  border-bottom: 2.5px solid transparent; white-space: nowrap;
}
.tabs button.on { color: var(--navy); border-bottom-color: var(--gold); }

.panel { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-top: 14px; }
.panel h3 { margin: 0 0 10px; font-size: 14px; color: var(--navy); }
.kv { display: grid; grid-template-columns: 92px 1fr; gap: 6px 12px; font-size: 14px; }
.kv dt { color: var(--muted); font-size: 13px; }
.kv dd { margin: 0; }

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; font-weight: 600; }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--navy-2); box-shadow: 0 0 0 3px rgba(27, 58, 107, .1); }
.field textarea { min-height: 90px; resize: vertical; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ── 업로드 ─────────────────────────────────────────── */
.drop {
  border: 2px dashed #c6d0e0; border-radius: var(--radius); background: #fbfcfe;
  padding: 18px; text-align: center; color: var(--muted);
}
.drop.hot { border-color: var(--navy-2); background: var(--navy-soft); }
.drop strong { color: var(--navy); display: block; font-size: 15px; margin-bottom: 3px; }
.pick-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 10px; }
.queue { margin-top: 10px; font-size: 13px; text-align: left; }
.queue li { display: flex; gap: 8px; align-items: center; }
.progress { height: 4px; background: #e6ebf3; border-radius: 99px; overflow: hidden; margin-top: 8px; }
.progress > i { display: block; height: 100%; background: var(--gold); width: 0; transition: width .2s; }

/* ── 자료 목록 ──────────────────────────────────────── */
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin: 14px 0 8px; }
.filters button { border: 1px solid var(--line); background: #fff; padding: 5px 11px; border-radius: 999px; font-size: 13px; color: var(--muted); }
.filters button.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.doc {
  background: var(--card); border-radius: 12px; box-shadow: var(--shadow);
  padding: 13px 14px; margin-bottom: 10px;
}
.doc .head { display: flex; gap: 10px; align-items: flex-start; }
.doc .ico { width: 34px; height: 34px; border-radius: 9px; background: var(--navy-soft); color: var(--navy-2);
  display: grid; place-items: center; font-size: 11px; font-weight: 700; flex: none; }
.doc .nm { font-weight: 600; word-break: break-all; font-size: 14.5px; }
.doc .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.doc .sm { margin-top: 8px; font-size: 13px; background: #f7f9fc; border-radius: 9px; padding: 8px 10px; white-space: pre-wrap; }
.doc .sm.empty { color: #9aa6b8; font-style: italic; }
.doc .acts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }

/* ── 일정 / 간트 ────────────────────────────────────── */
.wbs { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.wbs th { text-align: left; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--line); padding: 8px 6px; font-weight: 600; white-space: nowrap; }
.wbs td { border-bottom: 1px solid #eef1f6; padding: 9px 6px; vertical-align: middle; }
.wbs tr.child td:first-child { padding-left: 22px; }
.wbs .nm { font-weight: 500; }
.wbs .mini-bar { width: 62px; height: 5px; background: #eaeef4; border-radius: 99px; overflow: hidden; display: inline-block; vertical-align: middle; margin-right: 6px; }
.wbs .mini-bar > i { display: block; height: 100%; background: var(--navy-2); }

.gantt-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.gantt { position: relative; font-size: 12px; min-width: 100%; }
.gantt-head { display: flex; position: sticky; top: 0; z-index: 3; background: #fff; border-bottom: 1px solid var(--line); }
.g-label { width: 172px; flex: none; padding: 6px 10px; position: sticky; left: 0; z-index: 2; background: #fff; border-right: 1px solid var(--line); }
.g-track { position: relative; flex: 1; }
.g-months { display: flex; height: 24px; }
.g-month { border-left: 1px solid var(--line); padding-left: 5px; color: var(--muted); font-weight: 600; overflow: hidden; white-space: nowrap; }
.g-days { display: flex; height: 20px; }
.g-day { border-left: 1px solid #f1f4f9; color: #98a3b5; text-align: center; font-size: 9.5px; overflow: hidden; }
.g-day.wk { background: #fafbfd; }
.g-row { display: flex; border-bottom: 1px solid #f2f5f9; min-height: 34px; align-items: center; }
.g-row .g-label { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-row.child .g-label { padding-left: 22px; color: #46526a; }
.g-bar-wrap { position: relative; height: 34px; flex: 1; }
.g-bar {
  position: absolute; top: 8px; height: 18px; border-radius: 6px;
  background: #cfdaeb; overflow: hidden; min-width: 6px;
}
.g-bar > i { display: block; height: 100%; background: var(--navy-2); }
.g-bar span { position: absolute; left: 7px; top: 0; line-height: 18px; font-size: 10.5px; color: #22303f; white-space: nowrap; }
.g-ms { position: absolute; top: 10px; width: 14px; height: 14px; background: var(--gold); transform: rotate(45deg); border-radius: 3px; }
.g-today { position: absolute; top: 0; bottom: 0; width: 2px; background: rgba(179, 38, 30, .55); z-index: 1; }
.g-empty { padding: 26px; text-align: center; color: var(--muted); }

/* ── 활동 로그 ──────────────────────────────────────── */
.feed { list-style: none; padding: 0; margin: 0; }
.feed li { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid #f0f3f7; font-size: 13.5px; }
.feed li:last-child { border-bottom: 0; }
.feed .who { font-weight: 600; white-space: nowrap; }
.feed .when { margin-left: auto; color: #9aa6b8; font-size: 12px; white-space: nowrap; }
.empty { color: var(--muted); text-align: center; padding: 26px 10px; font-size: 14px; }

/* ── 모달 ───────────────────────────────────────────── */
.modal-bg {
  position: fixed; inset: 0; background: rgba(12, 22, 38, .45); z-index: 50;
  display: flex; align-items: flex-end; justify-content: center; padding: 0;
}
@media (min-width: 640px) { .modal-bg { align-items: center; padding: 20px; } }
.modal {
  background: #fff; width: 100%; max-width: 520px; border-radius: 18px 18px 0 0;
  padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
  max-height: 92svh; overflow-y: auto;
}
@media (min-width: 640px) { .modal { border-radius: 16px; } }
.modal h3 { margin: 0 0 14px; font-size: 17px; }
.modal-acts { display: flex; gap: 8px; margin-top: 16px; }
.modal-acts .btn { flex: 1; padding: 12px; }

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  background: #22303f; color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 13.5px; z-index: 90; box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
}
.toast.err { background: var(--danger); }
