:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --line: #e3e8ef;
  --text: #1f2733;
  --muted: #6b7684;
  --primary: #2f6bff;
  --primary-dark: #1f52d6;
  --danger: #e03e3e;
  --shadow: 0 1px 3px rgba(16,24,40,.08), 0 1px 2px rgba(16,24,40,.06);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Malgun Gothic", "맑은 고딕", -apple-system, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
}
.hidden { display: none !important; }

/* ---------- 인증 ---------- */
.auth-view, .center-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.auth-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 32px;
  width: 100%;
  max-width: 380px;
  text-align: center;
}
.brand { font-size: 22px; margin: 0 0 4px; }
.brand span { color: var(--primary); }
.brand-sub { color: var(--muted); margin: 0 0 20px; font-size: 13px; }
.tabs { display: flex; gap: 6px; margin-bottom: 18px; }
.tab {
  flex: 1; padding: 10px; border: none; background: #eef1f5;
  border-radius: 8px; cursor: pointer; font-weight: 600; color: var(--muted);
}
.tab.active { background: var(--primary); color: #fff; }
.auth-form { display: flex; flex-direction: column; gap: 10px; text-align: left; }
.auth-form input {
  padding: 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px;
}
.hint { color: var(--muted); font-size: 12px; line-height: 1.5; margin: 4px 0 0; }
.hint-inline { color: var(--muted); font-size: 13px; font-weight: 400; }
.msg { min-height: 18px; font-size: 13px; margin: 12px 0 0; }
.msg.error { color: var(--danger); }
.msg.ok { color: #1a8f4c; }

/* ---------- 버튼 ---------- */
.btn-primary {
  background: var(--primary); color: #fff; border: none; padding: 11px 16px;
  border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 14px;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary.right { margin-left: auto; }
.btn-ghost {
  background: #fff; color: var(--text); border: 1px solid var(--line);
  padding: 9px 14px; border-radius: 8px; cursor: pointer; font-size: 13px;
}
.btn-ghost:hover { background: #f0f3f7; }
.btn-danger { color: var(--danger); border-color: #f3c2c2; }

/* ---------- 상단바 ---------- */
.topbar {
  display: flex; align-items: center; gap: 16px;
  background: var(--card); border-bottom: 1px solid var(--line);
  padding: 12px 22px; position: sticky; top: 0; z-index: 10;
}
.topbar-nav { display: flex; gap: 6px; }
.nav-btn {
  border: none; background: transparent; padding: 8px 12px; border-radius: 8px;
  cursor: pointer; font-weight: 600; color: var(--muted);
}
.nav-btn.active { background: #eaf0ff; color: var(--primary); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.me-name { font-size: 14px; font-weight: 600; }

/* ---------- 페이지 ---------- */
.page { max-width: 1100px; margin: 0 auto; padding: 22px; }
.week-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; }
.week-label { font-weight: 700; font-size: 16px; padding: 0 6px; }

.notice-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px;
}
.notice-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px;
}
.notice-card .cat {
  align-self: flex-start; font-size: 11px; font-weight: 700; padding: 3px 8px;
  border-radius: 999px; background: #eaf0ff; color: var(--primary);
}
.notice-card .cat.공지 { background:#fff1e6; color:#c2610a; }
.notice-card .cat.이슈 { background:#fdeaea; color:var(--danger); }
.notice-card .cat.완료 { background:#e8f6ee; color:#1a8f4c; }
.notice-card h4 { margin: 2px 0; font-size: 16px; }
.notice-card .body { color: #364152; font-size: 14px; white-space: pre-wrap; line-height: 1.5; }
.notice-card .meta { color: var(--muted); font-size: 12px; margin-top: auto; padding-top: 8px;
  border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.card-actions { display: flex; gap: 6px; }
.card-actions button { border: none; background: none; cursor: pointer; color: var(--muted); font-size: 12px; }
.card-actions button:hover { color: var(--text); text-decoration: underline; }
.empty-hint { text-align: center; color: var(--muted); margin-top: 40px; }

/* ---------- 사용자 테이블 ---------- */
.user-table { width: 100%; border-collapse: collapse; background: var(--card);
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.user-table th, .user-table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); font-size: 14px; }
.user-table th { background: #f7f9fc; color: var(--muted); font-size: 13px; }
.badge { font-size: 12px; padding: 2px 8px; border-radius: 999px; }
.badge.master { background:#eaf0ff; color:var(--primary); }
.badge.member { background:#eef1f5; color:var(--muted); }
.badge.active { background:#e8f6ee; color:#1a8f4c; }
.badge.pending { background:#fff1e6; color:#c2610a; }
.badge.disabled { background:#fdeaea; color:var(--danger); }
.user-table td select { padding: 5px; border: 1px solid var(--line); border-radius: 6px; }

/* ---------- 알림 벨 ---------- */
.bell-wrap { position: relative; }
.bell { position: relative; border: none; background: transparent; font-size: 20px; cursor: pointer; line-height: 1; }
.bell-badge {
  position: absolute; top: -6px; right: -8px; background: var(--danger); color: #fff;
  font-size: 11px; font-weight: 700; min-width: 17px; height: 17px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
}
.bell-dropdown {
  position: absolute; right: 0; top: 34px; width: 320px; max-height: 420px; overflow-y: auto;
  background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); z-index: 40;
}
.bell-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.link-btn { border: none; background: none; color: var(--primary); cursor: pointer; font-size: 13px; }
.bell-list { display: flex; flex-direction: column; }
.bell-item { padding: 11px 14px; border-bottom: 1px solid var(--line); font-size: 13px; line-height: 1.45; }
.bell-item:last-child { border-bottom: none; }
.bell-item.unread { background: #f2f7ff; }
.bell-item .t-time { color: var(--muted); font-size: 11px; margin-top: 3px; }
.bell-item .t-type { font-weight: 700; margin-right: 6px; }
.bell-item .t-type.overdue { color: var(--danger); }
.bell-item .t-type.d3 { color: #c2610a; }
.bell-item .t-type.d7 { color: var(--primary); }
.bell-item .t-type.assigned { color: #1a8f4c; }
.bell-empty { padding: 24px 14px; text-align: center; color: var(--muted); font-size: 13px; }

/* ---------- 업무·캘린더 ---------- */
.tasks-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.cal-label { font-weight: 700; font-size: 16px; min-width: 120px; text-align: center; }
.switch-mine { font-size: 13px; color: var(--muted); margin-left: 10px; display: flex; align-items: center; gap: 5px; cursor: pointer; }
.calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--line);
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin-bottom: 24px; }
.cal-dow { background: #f7f9fc; text-align: center; padding: 8px 0; font-size: 12px; font-weight: 700; color: var(--muted); }
.cal-cell { background: #fff; min-height: 84px; padding: 6px; font-size: 12px; }
.cal-cell.other { background: #fafbfc; color: #c0c8d2; }
.cal-cell.today { background: #f2f7ff; }
.cal-day { font-weight: 700; margin-bottom: 4px; }
.cal-task { border-radius: 5px; padding: 2px 5px; margin-bottom: 3px; font-size: 11px; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: #eaf0ff; color: var(--primary); }
.cal-task.done { background: #e8f6ee; color: #1a8f4c; text-decoration: line-through; }
.cal-task.overdue { background: #fdeaea; color: var(--danger); }

.tasklist-title { margin: 0 0 12px; }
.task-tabs { display: flex; gap: 6px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.task-tab { border: none; background: none; padding: 9px 14px; cursor: pointer; font-weight: 600;
  font-size: 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.task-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.task-tab .tab-cnt { display: inline-block; min-width: 18px; padding: 0 5px; font-size: 12px; font-weight: 700;
  background: #eef1f5; color: var(--muted); border-radius: 999px; margin-left: 2px; }
.task-tab.active .tab-cnt { background: #eaf0ff; color: var(--primary); }
.task-list { display: flex; flex-direction: column; gap: 8px; }
.task-row { display: flex; align-items: center; gap: 12px; background: #fff; border: 1px solid var(--line);
  border-radius: 10px; padding: 12px 14px; }
.task-row .st { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.st.todo { background: #eef1f5; color: var(--muted); }
.st.doing { background: #eaf0ff; color: var(--primary); }
.st.done { background: #e8f6ee; color: #1a8f4c; }
.task-row .t-main { flex: 1; min-width: 0; }
.task-row .t-title { font-weight: 600; }
.task-row .t-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.task-row .t-due { font-size: 12px; font-weight: 600; white-space: nowrap; }
.task-row .t-due.warn { color: #c2610a; }
.task-row .t-due.over { color: var(--danger); }
.task-row .row-actions button { border: none; background: none; cursor: pointer; color: var(--muted); font-size: 12px; }
.task-row .row-actions button:hover { color: var(--text); text-decoration: underline; }
.assignee-list { display: flex; flex-wrap: wrap; gap: 6px 12px; max-height: 110px; overflow-y: auto;
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.assignee-item { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; cursor: pointer; white-space: nowrap; }
.form-row { display: flex; gap: 10px; }
.form-row > div { flex: 1; display: flex; flex-direction: column; }

/* ---------- 설정 ---------- */
.settings-card { background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 18px 20px; margin-bottom: 14px; max-width: 620px; }
.settings-card h3 { margin: 0 0 10px; font-size: 15px; }
.settings-row { display: flex; gap: 8px; }
.settings-row input { flex: 1; padding: 10px; border: 1px solid var(--line); border-radius: 8px; }

/* ---------- 파일 자료실 ---------- */
.files-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; font-size: 13px; color: var(--muted); }
.files-toolbar .right { margin-left: auto; }
.files-toolbar select { margin-left: 6px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; }
.files-filterbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 14px;
  font-size: 13px; color: var(--muted); background: #f7f9fc; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.files-filterbar #file-search { flex: 1; min-width: 200px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.files-filterbar .fb-item { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.files-filterbar input[type=date], .files-filterbar select { padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; }
.file-count { margin-left: auto; font-weight: 600; color: var(--text); white-space: nowrap; }
.file-task-sel { padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; font-size: 12px; max-width: 180px; }
.muted-dash { color: #c0c8d2; }
.file-note { margin-top: 4px; font-size: 12px; color: #52627a; background: #f2f7ff; border-radius: 6px;
  padding: 4px 8px; white-space: pre-wrap; line-height: 1.4; }
.file-comment-row td { background: #f7f9fc; }
.comment-edit { display: flex; flex-direction: column; gap: 8px; padding: 6px 2px; }
.comment-edit textarea { width: 100%; min-height: 60px; padding: 8px 10px; border: 1px solid var(--line);
  border-radius: 8px; font-family: inherit; font-size: 13px; resize: vertical; box-sizing: border-box; }
.comment-edit > div { display: flex; gap: 6px; }
.t-files { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 3px 10px;
  font-size: 12px; cursor: pointer; color: var(--muted); white-space: nowrap; }
.t-files:hover { background: #eaf0ff; color: var(--primary); border-color: #cdd; }
.dropzone {
  border: 2px dashed #c3ccd8; border-radius: 12px; padding: 30px; text-align: center;
  color: var(--muted); cursor: pointer; background: #fff; transition: all .15s;
}
.dropzone p { margin: 4px 0; }
.dropzone.drag { border-color: var(--primary); background: #f2f7ff; }
.file-name-cell { display: flex; align-items: center; gap: 8px; }
.file-icon { font-size: 18px; }
.file-actions button, .file-actions a {
  border: none; background: none; cursor: pointer; color: var(--primary); font-size: 13px;
  margin-right: 8px; text-decoration: none;
}
.file-actions .del { color: var(--danger); }
.file-actions button:hover, .file-actions a:hover { text-decoration: underline; }

/* ---------- 미리보기 모달 ---------- */
.preview-card { max-width: 900px; width: 92vw; height: 88vh; display: flex; flex-direction: column; }
.preview-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.preview-head h3 { margin: 0; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-body { flex: 1; overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: #fafbfc; }
.preview-body iframe { width: 100%; height: 100%; border: none; }
.preview-body img { max-width: 100%; display: block; margin: 0 auto; }
.preview-body .html-doc { padding: 20px; background: #fff; }
.preview-body .html-doc table { border-collapse: collapse; margin-bottom: 16px; font-size: 13px; }
.preview-body .html-doc td, .preview-body .html-doc th { border: 1px solid #d5dbe4; padding: 4px 8px; }
.preview-body .sheet-name { margin: 8px 0 6px; color: var(--primary); }
.preview-none { padding: 40px; text-align: center; color: var(--muted); }

/* ---------- 모달 ---------- */
.modal { position: fixed; inset: 0; background: rgba(16,24,40,.45);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; }
.modal-card { background: #fff; border-radius: 14px; padding: 24px; width: 100%; max-width: 460px; }
.modal-card h3 { margin: 0 0 16px; }
#notice-form { display: flex; flex-direction: column; gap: 6px; }
#notice-form label { font-size: 13px; color: var(--muted); margin-top: 8px; }
#notice-form input, #notice-form textarea, #notice-form select {
  padding: 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; font-family: inherit; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

/* ---------- 주간 업무보고 ---------- */
.report-toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px;
}
.report-toolbar .right { margin-left: auto; }
.rep-field { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.rep-field select, .rep-field input {
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; font-family: inherit;
}
.rep-field input { width: 150px; }
.rep-actions { display: flex; align-items: center; gap: 8px; }
.rep-saved { font-size: 12px; color: var(--muted); min-width: 60px; text-align: right; }

.report-doc { overflow-x: auto; }
.rep-sheet {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); padding: 22px; max-width: 1100px; margin: 0 auto; min-width: 760px;
}
.rep-head { display: flex; align-items: stretch; gap: 12px; margin-bottom: 12px; }
.rep-title {
  flex: 1; text-align: center; font-size: 26px; font-weight: 800; letter-spacing: 2px;
  display: flex; align-items: center; justify-content: center;
}
.rep-teambox { width: 180px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; text-align: center; }
.rep-teamlabel { background: #eef1f5; font-weight: 700; font-size: 13px; padding: 6px; border-bottom: 1px solid var(--line); }
.rep-teamname { padding: 12px 6px; font-weight: 700; font-size: 15px; }
.rep-date { text-align: center; font-weight: 700; font-size: 14px; margin-bottom: 14px; color: var(--text); }

.rep-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.rep-table th, .rep-table td { border: 1px solid #c9d2de; vertical-align: top; }
.rep-table thead th { background: #eef1f5; padding: 9px; font-size: 14px; text-align: center; }
.rep-table .c-cat {
  width: 84px; background: #f4f6f8; font-weight: 700; text-align: center; vertical-align: middle;
  padding: 8px 4px; word-break: keep-all;
}
.rep-table .c-cell { padding: 8px; }
.rep-auto { margin: 0 0 6px; padding-left: 2px; list-style: none; font-size: 13px; line-height: 1.6; }
.rep-auto li { padding: 1px 0; }
.rep-st {
  display: inline-block; min-width: 34px; text-align: center; font-size: 11px; font-weight: 700;
  border-radius: 5px; padding: 1px 5px; color: #fff; vertical-align: middle;
}
.rep-st.todo { background: #94a3b8; }
.rep-st.doing { background: var(--primary); }
.rep-st.done { background: #1a8f4c; }
.rep-who { color: var(--muted); font-size: 12px; }
.rep-due { color: var(--danger); font-size: 12px; }
.rep-memo {
  width: 100%; border: 1px dashed #c9d2de; border-radius: 6px; padding: 6px 8px;
  font-size: 13px; font-family: inherit; resize: vertical; min-height: 40px; line-height: 1.5;
  background: #fcfdff; color: var(--text);
}
.rep-memo:focus { outline: none; border-color: var(--primary); border-style: solid; background: #fff; }
.rep-memo::placeholder { color: #a9b3c0; }

/* ---------- 인쇄(주간 업무보고) ---------- */
@media print {
  body { background: #fff; }
  .topbar, .no-print, .report-toolbar { display: none !important; }
  .page { display: none !important; }
  #page-report { display: block !important; }
  .rep-sheet { border: none; box-shadow: none; border-radius: 0; padding: 0; max-width: none; min-width: 0; }
  .report-doc { overflow: visible; }
  .rep-memo { border: none; background: none; resize: none; padding: 2px 0; }
  .rep-table th, .rep-table td { border: 1px solid #333 !important; }
  .rep-table thead th, .rep-table .c-cat, .rep-teamlabel { background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  @page { size: A4 landscape; margin: 12mm; }
}

/* ---------- 공휴일 관리 ---------- */
.holiday-list { margin-top: 12px; }
.hd-group { font-size: 12px; font-weight: 700; color: var(--muted); margin: 12px 0 6px; }
.holiday-item {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px;
  border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px; background: #fbfcfe;
}
.holiday-item.past { opacity: .5; }
.holiday-item .hd-date { font-weight: 600; font-variant-numeric: tabular-nums; min-width: 128px; }
.holiday-item .hd-name { flex: 1; color: var(--text); }
.holiday-item .hd-del {
  border: none; background: #f0f2f5; color: var(--muted); border-radius: 6px;
  width: 26px; height: 26px; cursor: pointer; font-size: 13px;
}
.holiday-item .hd-del:hover { background: var(--danger); color: #fff; }
#holiday-card .settings-row { flex-wrap: wrap; }
#holiday-card #holiday-name { flex: 1; min-width: 160px; }
