:root {
	--bg: #f4f6fa;
	--card: #ffffff;
	--line: #e4e8ef;
	--line-2: #eef1f6;
	--text: #1b2230;
	--muted: #6b7484;
	--primary: #2f6fed;
	--primary-weak: #eaf1ff;
	--danger: #e5484d;
	--ok: #16a34a;
	--ok-weak: #e8f7ee;
	--warn-weak: #fff4e5;
	--g1: #2f6fed;
	--g2: #d97706;
	--g99: #6b7484;
	--radius: 12px;
	--shadow: 0 1px 2px rgba(16, 24, 40, .05);
}

* { box-sizing: border-box; }
body {
	margin: 0; background: var(--bg); color: var(--text);
	font: 14px/1.6 Pretendard, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
	-webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
h1 { font-size: 22px; margin: 0; font-weight: 700; letter-spacing: -.02em; }
h2 { font-size: 16px; margin: 0; font-weight: 700; }
small { font-weight: 400; }
.muted { color: var(--muted); }
.pre { white-space: pre-wrap; word-break: break-word; }
input, select, textarea, button { font: inherit; color: inherit; }

/* 상단 메뉴 */
.topbar { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar-inner { max-width: 1280px; margin: 0 auto; padding: 0 20px; height: 56px; display: flex; align-items: center; gap: 24px; }
.brand { font-weight: 800; font-size: 17px; color: var(--text); letter-spacing: -.02em; }
.menu { display: flex; gap: 4px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.menu a { padding: 7px 12px; border-radius: 8px; color: var(--muted); white-space: nowrap; font-weight: 500; }
.menu a:hover { background: var(--line-2); color: var(--text); }
.menu a.on { background: var(--primary-weak); color: var(--primary); font-weight: 700; }
.me { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.me form { margin: 0; }
.me-name small { color: var(--muted); }

.page { max-width: 1280px; margin: 0 auto; padding: 24px 20px 60px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.week-nav { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* 카드 */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head small { margin-left: 6px; }
.empty { color: var(--muted); text-align: center; padding: 28px 0; }
.notice { background: var(--warn-weak); border: 1px solid #fbd9a5; color: #8a5300; border-radius: 10px; padding: 10px 14px; margin-bottom: 16px; }
.fold > summary { cursor: pointer; font-weight: 700; list-style: none; }
.fold > summary::before { content: "▸ "; color: var(--muted); }
.fold[open] > summary { margin-bottom: 14px; }
.fold[open] > summary::before { content: "▾ "; }

/* 버튼 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 4px; height: 36px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-weight: 600; color: var(--text); white-space: nowrap; }
.btn:hover { background: var(--line-2); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { filter: brightness(.95); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: #fff; }
.btn.ghost.on { background: var(--primary-weak); color: var(--primary); border-color: transparent; }
.btn.danger, .btn.ghost.danger { color: var(--danger); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.block { width: 100%; height: 44px; }
.icon-btn { border: 0; background: transparent; width: 30px; height: 30px; border-radius: 8px; cursor: pointer; color: var(--muted); flex: none; }
.icon-btn:hover { background: var(--line-2); }
.icon-btn.danger:hover { color: var(--danger); background: #fdecec; }
.select { height: 36px; border: 1px solid var(--line); border-radius: 9px; padding: 0 10px; background: #fff; }

.tag { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 99px; vertical-align: middle; }
.tag.now { background: var(--primary-weak); color: var(--primary); }
.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 6px; color: #fff; }
.badge.g1 { background: var(--g1); } .badge.g2 { background: var(--g2); } .badge.g99 { background: var(--g99); }

/* 보고서 작성 */
.save-state { font-size: 13px; color: var(--muted); }
.save-state.saving { color: var(--primary); }
.save-state.error { color: var(--danger); }
.item { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; background: #fff; transition: border-color .15s; }
.item:focus-within { border-color: #b7cbf7; box-shadow: 0 0 0 3px var(--primary-weak); }
.item-new { position: relative; margin: 6px 0 18px; border: 2px solid var(--ok); background: var(--ok-weak); box-shadow: 0 0 0 4px rgba(22, 163, 74, .12); }
.item-new:focus-within { border-color: var(--ok); box-shadow: 0 0 0 4px rgba(22, 163, 74, .2); }
.item-new[hidden] { display: none; }
.new-label { position: absolute; top: -11px; left: 12px; padding: 0 8px; border-radius: 6px; background: var(--ok); color: #fff; font-size: 12px; font-weight: 700; line-height: 20px; }
.item-new .item-top { margin-top: 4px; }
.item-new .item-title { background: #fff; border-color: #cfe9d8; }
.item-new .editor, .item-new textarea.autosize { min-height: 168px; }   /* 새 업무는 내용 칸을 2배로 */
.item-top { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.gubun { height: 32px; border-radius: 8px; border: 0; color: #fff; font-weight: 700; padding: 0 8px; cursor: pointer; }
.gubun.g1 { background: var(--g1); } .gubun.g2 { background: var(--g2); } .gubun.g99 { background: var(--g99); }
.gubun option { color: var(--text); background: #fff; }
.item-title { flex: 1; min-width: 0; height: 34px; border: 1px solid transparent; border-radius: 8px; padding: 0 8px; font-weight: 700; font-size: 15px; background: transparent; }
.item-title:hover, .item-title:focus { border-color: var(--line); background: #fff; outline: none; }
.item-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.col-label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 4px; }
textarea.autosize, .item textarea { width: 100%; min-height: 84px; resize: vertical; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; line-height: 1.6; background: #fff; overflow: hidden; }
textarea:focus, input:focus, select:focus { outline: none; border-color: var(--primary); }

/* 업무 내용 에디터 (TinyMCE 인라인) - 누르면 위에 도구 모음이 뜸 */
.editor { min-height: 84px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff; cursor: text; }
.editor:focus, .editor.mce-edit-focus { outline: none; border-color: var(--primary); }
.item .editor.mce-content-body:not([dir=rtl])[data-mce-placeholder]:not(.mce-visualblocks)::before { color: #a3abb8; left: 10px; top: 8px; }
.tox.tox-tinymce-inline { z-index: 20; }

/* 에디터로 쓴 내용 (보기·수정 공통) */
.rich { word-break: break-word; }
.rich > :first-child { margin-top: 0; }
.rich > :last-child { margin-bottom: 0; }
.rich p { margin: 0 0 .35em; }
.rich ul, .rich ol { margin: .2em 0 .35em; padding-left: 1.4em; }
.rich blockquote { margin: .3em 0; padding-left: 10px; border-left: 3px solid var(--line); color: var(--muted); }
.rich h3, .rich h4 { margin: .4em 0 .25em; font-size: 15px; }
.rich img { max-width: 100%; height: auto; border-radius: 6px; }
.col-meta { display: flex; gap: 14px; margin-top: 6px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.col-meta input { height: 28px; border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; margin-left: 4px; }
.col-meta .num { width: 56px; text-align: right; }
.col-meta .date-text { width: 100px; }
.item-actions { text-align: right; margin-top: 10px; }

/* 첨부 */
.attach-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.file-list { list-style: none; margin: 0 0 10px; padding: 0; }
.file-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px; border-radius: 8px; }
.file-list li:hover { background: var(--line-2); }
.missing { color: var(--muted); text-decoration: line-through; }
.drop { display: block; border: 1.5px dashed #c9d2e0; border-radius: 10px; padding: 18px; text-align: center; color: var(--muted); cursor: pointer; }
.drop.over, .drop:hover { border-color: var(--primary); background: var(--primary-weak); color: var(--primary); }
.link-input { width: 100%; height: 34px; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; margin-bottom: 6px; }
.row-gap { display: flex; gap: 6px; justify-content: flex-end; align-items: center; }
.attach-line { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chip { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 4px 10px; border-radius: 99px; background: var(--line-2); font-size: 13px; color: var(--text); }
a.chip:hover { background: var(--primary-weak); color: var(--primary); }

/* 보고서 읽기 */
.rv { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.rv-head, .rv-row { display: grid; grid-template-columns: 220px 1fr 1fr; }
.rv-head { background: #f7f9fc; font-size: 12px; font-weight: 700; color: var(--muted); }
.rv-head > div { padding: 8px 14px; }
.rv-row { border-top: 1px solid var(--line); }
.rv-row > div { padding: 12px 14px; }
.rv-title { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; background: #fcfdfe; }
.rv-cell + .rv-cell { border-left: 1px solid var(--line-2); }
.rv-label { display: none; font-size: 12px; font-weight: 700; color: var(--muted); }
.meta { margin-top: 6px; font-size: 12px; color: var(--primary); font-weight: 600; }

/* 월간 업무 */
.mtable { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.mrow { display: grid; grid-template-columns: 1.1fr 1.4fr 1.6fr 140px 140px 40px; gap: 8px; padding: 8px 10px; border-top: 1px solid var(--line); align-items: start; }
.mhead { border-top: 0; background: #f7f9fc; font-size: 12px; font-weight: 700; color: var(--muted); }
.mrow input, .mrow textarea { width: 100%; border: 1px solid var(--line); border-radius: 7px; padding: 5px 8px; min-height: 32px; }
.mrow textarea { min-height: 32px; resize: vertical; overflow: hidden; }
.mnew { border: 1px dashed var(--line); border-radius: 10px; margin-top: 10px; background: #fafbfd; }

/* 관리자 */
.progress-card { display: flex; align-items: center; gap: 14px; }
.progress { flex: 1; height: 10px; background: var(--line-2); border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; background: var(--ok); border-radius: 99px; }
.staff-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.staff { display: block; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; color: var(--text); }
.staff:hover { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-weak); }
.staff.done { background: #fff; }
.staff.todo { background: #fbfbfc; }
.staff-name { font-weight: 700; }
.staff-name small { color: var(--muted); }
.staff-state { font-size: 13px; font-weight: 700; margin-top: 4px; }
.staff-state.ok { color: var(--ok); }
.staff-state.no { color: var(--danger); }
.staff-time { font-size: 12px; color: var(--muted); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-weight: 600; }
.tabs a.on { color: var(--primary); border-color: var(--primary); }
.pager { display: flex; gap: 10px; align-items: center; justify-content: center; }

/* 일정 */
#calendar { --fc-border-color: var(--line); --fc-today-bg-color: #f3f7ff; --fc-button-bg-color: #fff; --fc-button-text-color: var(--text); --fc-button-border-color: var(--line); --fc-button-hover-bg-color: var(--line-2); --fc-button-hover-border-color: var(--line); --fc-button-active-bg-color: var(--primary-weak); --fc-button-active-border-color: var(--line); }
#calendar .fc-button { font-weight: 600; box-shadow: none !important; }
#calendar .fc-button-active { color: var(--primary); }
#calendar .fc-toolbar-title { font-size: 18px; }
#calendar .fc-day-sun .fc-daygrid-day-number, #calendar .fc-day-sun .fc-col-header-cell-cushion { color: var(--danger); }
#calendar .fc-day-sat .fc-daygrid-day-number, #calendar .fc-day-sat .fc-col-header-cell-cushion { color: var(--primary); }
#calendar .holiday { background: #fdecec; opacity: 1; }
#calendar .holiday-label { background: transparent; border: 0; }
#calendar .holiday-label .fc-event-title { color: var(--danger); font-size: 12px; font-weight: 600; }
#calendar a { color: inherit; }

/* 대화상자 */
.dlg { border: 0; border-radius: 14px; padding: 0; width: min(460px, calc(100vw - 32px)); box-shadow: 0 20px 50px rgba(16, 24, 40, .25); }
.dlg::backdrop { background: rgba(15, 23, 42, .35); }
.dlg form { padding: 20px 22px; }
.dlg h2 { margin-bottom: 14px; }
.field { display: block; margin-bottom: 12px; flex: 1; }
.field > span { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 4px; }
.field input, .field select, .field textarea { width: 100%; height: 38px; border: 1px solid var(--line); border-radius: 9px; padding: 0 10px; background: #fff; }
.field textarea { height: auto; padding: 8px 10px; }
.field.time { flex: 0 0 130px; }
.field-row { display: flex; gap: 8px; align-items: flex-end; }
.field-row > .btn { margin-bottom: 12px; }
.check { display: flex; gap: 6px; align-items: center; margin-bottom: 10px; font-weight: 600; }
.dlg-actions { display: flex; gap: 6px; align-items: center; margin-top: 6px; }
.grow { flex: 1; }

/* 로그인 */
.bare { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.login-wrap { width: 100%; max-width: 360px; }
.login-card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 32px 28px; box-shadow: 0 10px 30px rgba(16, 24, 40, .06); }
.login-card h1 { font-size: 24px; margin-bottom: 4px; }
.login-card p { margin: 0 0 20px; }
.alert { background: #fdecec; color: #b42318; border-radius: 9px; padding: 9px 12px; margin-bottom: 14px; font-size: 13px; }

/* 알림 */
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: #1b2230; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 13px; z-index: 100; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); max-width: calc(100vw - 32px); }
.toast.error { background: var(--danger); }

/* 좁은 화면 */
@media (max-width: 900px) {
	.topbar-inner { gap: 12px; padding: 0 12px; }
	.me-name { display: none; }
	.page { padding: 16px 12px 40px; }
	.item-cols, .attach-grid { grid-template-columns: 1fr; }
	.rv-head { display: none; }
	.rv-row { grid-template-columns: 1fr; }
	.rv-cell + .rv-cell { border-left: 0; border-top: 1px dashed var(--line-2); }
	.rv-label { display: block; }
	.mhead { display: none; }
	.mrow { grid-template-columns: 1fr 1fr; }
	.mrow > div:nth-child(2), .mrow > div:nth-child(3) { grid-column: 1 / -1; }
}
