/* 행정 임팩트 앱 UI — 임팩트 디자인 시스템(웜 크림+코랄/네이비+둥근) 적용
   색·둥근값은 impact-theme.css의 --im-* 토큰을 참조 (문서 인쇄 스타일은 doc.css, 별도) */
:root {
  --navy: var(--im-navy);
  --navy-d: #12293f;
  --coral: var(--im-coral);
  --cream: var(--im-cream);
  --line: var(--im-line);
  --ink: var(--im-text);
  --muted: var(--im-text-sub);
  --bg: var(--im-bg);
  --surface: var(--im-surface);
  --radius: var(--im-radius-lg);
  --radius-sm: var(--im-radius-md);
  --pill: var(--im-radius-pill);
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--im-font);
  font-size: 15px; line-height: 1.5;
}
.hidden { display: none !important; }

/* 상단바 */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  height: 58px; padding: 0 22px;
  background: var(--navy); color: #fff;
  box-shadow: 0 2px 10px rgba(20,55,92,.18);
}
.brand { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.brand-logo { height: 30px; width: auto; background: #fff; border-radius: 6px; padding: 2px 5px; }
.brand-name { font-weight: 800; font-size: 19px; letter-spacing: .02em; }
.biz-badge { background: rgba(255,255,255,.14); padding: 5px 12px; border-radius: var(--pill); font-size: 13px; font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.user-chip { color: #fff; font-size: 13px; font-weight: 600; opacity: .92; }
.logout-btn { background: rgba(255,255,255,.14); color: #fff; border: none; border-radius: var(--pill); padding: 6px 13px; font-size: 12.5px; font-weight: 700; cursor: pointer; }
.logout-btn:hover { background: rgba(255,255,255,.24); }

/* 로그인 (직원 접속) */
.login-gate { position: fixed; inset: 0; z-index: 200; background: var(--bg); display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-box { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--im-radius-xl); box-shadow: var(--im-shadow); padding: 40px 34px; text-align: center; }
.login-logo { height: 64px; width: auto; margin-bottom: 12px; }
.login-title { font-size: 26px; font-weight: 900; color: var(--navy); margin: 4px 0 6px; }
.login-sub { font-size: 13px; color: var(--muted); margin: 0 0 24px; }
.login-field { text-align: left; margin-bottom: 14px; }
.login-field label { display: block; font-size: 12.5px; font-weight: 700; color: var(--muted); margin-bottom: 5px; }
.login-field input { width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: 15px; font-family: inherit; background: var(--im-bg); }
.login-field input:focus { outline: none; border-color: var(--coral); }
.login-btn { width: 100%; padding: 13px; font-size: 15px; margin-top: 8px; }
.login-box select { width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: 15px; font-family: inherit; background: var(--im-bg); }
.login-box select:focus { outline: none; border-color: var(--coral); }
.login-alt { text-align: center; margin-top: 16px; }
.login-alt a { font-size: 12.5px; color: var(--muted); text-decoration: none; }
.login-alt a:hover { color: var(--navy); }

main { max-width: 1080px; margin: 0 auto; padding: 24px 20px 80px; }

/* 첫 화면 */
.hero { text-align: center; padding: 40px 16px; }
.hero-logo { height: 88px; width: auto; margin-bottom: 12px; }
.hero-title { font-size: 40px; font-weight: 900; color: var(--navy); margin: 6px 0; letter-spacing: -.01em; }
.hero-sub { color: var(--muted); font-size: 15px; margin: 8px 0 30px; }
.hero-guide { font-weight: 700; color: var(--ink); margin-bottom: 16px; }
.biz-cards { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; }
.biz-card {
  display: flex; flex-direction: column; gap: 6px; align-items: flex-start;
  width: 260px; padding: 22px 24px; text-align: left;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius); cursor: pointer;
  transition: .15s; box-shadow: var(--im-shadow);
}
.biz-card:hover { border-color: var(--coral); transform: translateY(-2px); box-shadow: 0 8px 22px rgba(20,55,92,.12); }
.bc-name { font-size: 21px; font-weight: 800; color: var(--navy); }
.bc-sub { font-size: 13px; color: var(--muted); }

/* 공통 뷰 헤더 */
.view-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.view-head h2 { margin: 0; font-size: 22px; color: var(--navy); }
.btn { background: var(--coral); color: #fff; border: none; border-radius: var(--pill); padding: 10px 20px; font-size: 14px; font-weight: 700; cursor: pointer; }
.btn:hover { filter: brightness(1.05); }
.btn-ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); border-radius: var(--pill); padding: 8px 15px; font-size: 13px; cursor: pointer; }
.btn-ghost:hover { border-color: var(--navy); color: var(--navy); }
.btn-nav { background: var(--navy); }
.btn-line { background: var(--surface); color: var(--navy); border: 1.5px solid var(--navy); border-radius: var(--pill); padding: 9px 17px; font-weight: 700; cursor: pointer; }
.btn-line:hover { background: var(--navy); color: #fff; }

/* 새 프로젝트 */
.newproj { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.newproj input { flex: 1; min-width: 160px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; }
.newproj input:focus { outline: none; border-color: var(--coral); }

/* 프로젝트 목록 */
.proj-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.proj-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; cursor: pointer; transition: .15s; position: relative; box-shadow: var(--im-shadow); }
.proj-card:hover { border-color: var(--navy); box-shadow: 0 6px 18px rgba(20,55,92,.1); }
.proj-card h3 { margin: 0 0 8px; font-size: 16px; color: var(--ink); line-height: 1.4; }
.proj-card .pc-meta { font-size: 12.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 12px; }
.proj-card .pc-stages { margin-top: 10px; display: flex; gap: 5px; }
.pc-chip { font-size: 11px; padding: 2px 8px; border-radius: 10px; background: #eef1f4; color: var(--muted); }
.pc-chip.done { background: #e5f3ea; color: #1c7a43; }
.pc-del { position: absolute; top: 10px; right: 12px; border: none; background: transparent; color: #c3ccd4; cursor: pointer; font-size: 16px; }
.pc-del:hover { color: var(--coral); }
.empty { color: var(--muted); text-align: center; padding: 40px; }

/* 프로젝트 상세 */
.proj-title-row { margin-bottom: 14px; }
.proj-title-row h2 { margin: 0 0 4px; font-size: 21px; color: var(--navy); }
.proj-meta { color: var(--muted); font-size: 13px; display: flex; gap: 14px; flex-wrap: wrap; }
.stage-tabs { display: flex; gap: 6px; border-bottom: 2px solid var(--line); margin-bottom: 20px; flex-wrap: wrap; }
.stage-tabs button { background: transparent; border: none; padding: 11px 18px; font-size: 15px; font-weight: 700; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; }
.stage-tabs button.active { color: var(--navy); border-bottom-color: var(--coral); }

/* 편집 폼 */
.editor { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-bottom: 22px; box-shadow: var(--im-shadow); }
.editor h3 { margin: 0 0 16px; font-size: 17px; color: var(--navy); }
.editor h4 { margin: 22px 0 10px; font-size: 15px; color: var(--ink); border-left: 3px solid var(--coral); padding-left: 8px; }
.frow { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; flex: 1; min-width: 180px; }
.field label { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.field input, .field textarea, .field select { padding: 9px 11px; border: 1px solid var(--line); border-radius: 7px; font-size: 14px; font-family: inherit; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--coral); }
.field .hint { font-size: 11.5px; color: var(--muted); }

/* 산출내역 가져오기 */
.import-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 6px; }
.import-col .il { font-size: 13px; font-weight: 700; color: var(--ink); margin-bottom: 6px; }
.paste-box { width: 100%; height: 96px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 12.5px; font-family: 'Malgun Gothic', monospace; resize: vertical; }
.paste-box:focus { outline: none; border-color: var(--coral); }
.import-col .btn-ghost { margin-top: 8px; }
.dropzone { border: 2px dashed #c7d0d8; border-radius: 10px; padding: 16px; text-align: center; color: var(--muted); cursor: pointer; background: #fafbfc; transition: .15s; }
.dropzone.tall { height: 96px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.dropzone.drag { border-color: var(--coral); background: #fff5f2; color: var(--coral); }
.dropzone b { color: var(--navy); }
@media (max-width: 640px) { .import-grid { grid-template-columns: 1fr; } }

/* 견적서 진단 패널 */
.quote-diag { margin-top: 10px; }
.quote-diag .qd-msg { font-size: 13px; line-height: 1.5; padding: 10px 12px; background: #fff8f2; border: 1px solid #f4d9c8; border-radius: 8px; color: #5a4a3f; }
.quote-diag .qd-msg.muted { background: #f4f6f8; border-color: var(--line); color: var(--muted); }
.quote-diag .qd-raw { margin-top: 8px; font-size: 12px; }
.quote-diag .qd-raw summary { cursor: pointer; color: var(--navy); font-weight: 700; }
.quote-diag .qd-raw pre { margin: 8px 0 0; padding: 10px; background: #0e2740; color: #cfe0f0; border-radius: 8px; overflow-x: auto; font-size: 11.5px; line-height: 1.6; max-height: 320px; white-space: pre; }

/* 산출내역 표 */
.items-table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 13px; }
.items-table th, .items-table td { border: 1px solid var(--line); padding: 4px; }
.items-table th { background: #f0f3f6; font-size: 12px; color: var(--muted); font-weight: 700; }
.items-table input { width: 100%; border: none; padding: 5px; font-size: 13px; font-family: inherit; background: transparent; }
.items-table input:focus { outline: 1px solid var(--coral); border-radius: 3px; }
.items-table .ic-qty input, .items-table .ic-unit input { text-align: center; }
.items-table .ic-price input, .items-table .ic-amt input { text-align: right; }
.items-table .ic-note input { font-size: 10.4px; }
.items-table .ic-del { width: 34px; text-align: center; }
.items-table .ic-del button { border: none; background: transparent; color: #c3ccd4; cursor: pointer; font-size: 15px; }
.items-table .ic-del button:hover { color: var(--coral); }
.items-sum { margin-top: 10px; display: flex; gap: 24px; justify-content: flex-end; font-size: 14px; }
.items-sum b { color: var(--navy); }
.items-actions { margin-top: 10px; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.row-target { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.row-target input { width: 56px; padding: 5px 7px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; text-align: center; }
.row-target input:focus { outline: none; border-color: var(--coral); }

/* 완료계/대금청구 */
.carry-note { background: #eef3f8; border-left: 3px solid var(--navy); padding: 9px 12px; border-radius: 6px; font-size: 13px; color: var(--ink); margin-bottom: 16px; }
.photo-list { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.photo-thumb { position: relative; width: 104px; height: 78px; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: #f4f6f8; }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.photo-thumb.cert img { object-fit: contain; background: #fff; }
.photo-thumb button { position: absolute; top: 3px; right: 3px; width: 18px; height: 18px; border: none; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; cursor: pointer; font-size: 11px; line-height: 18px; padding: 0; }
.photo-empty { font-size: 12px; }
.cert-zones { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 8px; }
.cert-zone .cz-h { font-size: 13px; font-weight: 700; color: var(--ink); margin-bottom: 6px; }
.cert-zone .dropzone { padding: 14px; font-size: 13px; }
@media (max-width: 720px) { .cert-zones { grid-template-columns: 1fr; } }

/* 공정예정표 편집 */
.proc-heads { display: flex; align-items: flex-start; gap: 8px; margin: 10px 0 4px; flex-wrap: wrap; }
.proc-heads .phl { font-size: 12px; color: var(--muted); font-weight: 700; padding-top: 6px; white-space: nowrap; }
.ph-cols { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; flex: 1; min-width: 320px; }
.ph-col { display: flex; flex-direction: column; gap: 4px; }
.ph-col input { padding: 6px 7px; border: 1px solid var(--line); border-radius: 6px; font-size: 12px; }
.ph-col input:focus { outline: none; border-color: var(--coral); }
.event-fill { display: flex; align-items: center; gap: 10px; margin: 6px 0 10px; flex-wrap: wrap; font-size: 13px; }
.event-fill label { font-weight: 700; color: var(--ink); display: flex; align-items: center; gap: 6px; }
.event-fill input { padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; }
.event-fill input:focus { outline: none; border-color: var(--coral); }
.proc-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.proc-table th { background: #f0f3f6; font-size: 12px; color: var(--muted); font-weight: 700; border: 1px solid var(--line); padding: 5px; }
.proc-table td { border: 1px solid var(--line); padding: 3px; }
.proc-table input { width: 100%; border: none; padding: 6px; font-size: 13px; background: transparent; font-family: inherit; }
.proc-table input:focus { outline: 1px solid var(--coral); border-radius: 3px; }
.proc-table .pr-mk { text-align: center; }
.proc-table select { border: 1px solid var(--line); border-radius: 5px; padding: 5px; font-size: 12.5px; }

/* 액션바 */
.actionbar { display: flex; gap: 10px; margin: 8px 0 20px; flex-wrap: wrap; }

/* 미리보기 */
.preview-wrap { background: #4a5763; border-radius: 12px; padding: 22px; overflow-x: auto; }
.preview-wrap .doc-page { margin: 0 auto 20px; box-shadow: 0 4px 20px rgba(0,0,0,.35); }
.preview-empty { color: #cfd6dd; text-align: center; padding: 40px; }

.stage-todo { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); padding: 40px; text-align: center; color: var(--muted); }

/* 토스트 */
.toast { position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%); background: var(--navy-d); color: #fff; padding: 12px 22px; border-radius: 10px; font-size: 14px; font-weight: 600; box-shadow: 0 6px 24px rgba(0,0,0,.25); z-index: 100; }

/* 인쇄: #printArea만 출력 */
#printArea { display: none; }
@media print {
  body.printing > *:not(#printArea) { display: none !important; }
  body.printing #printArea { display: block !important; }
}
