/*
 * © 이레아이맘 부평지사. 무단 복제·수정·재배포 및 타 업체의 무단 사용을 금지합니다.
 * 연간 업무 관리 — 따뜻하고 차분한 미니멀(화이트·웜그레이·크림·베이지 + 톤다운 코랄/테라코타)
 */
:root{
  --bg:#fff7d6; --card:#ffffff; --card-2:#fffbea; --line:#f1e4b3; --line-2:#e6d48a;
  --ink:#4a3a3f; --muted:#8f7d78; --sel:#ffe9a8;
  --accent:#e0668f; --accent-dark:#b63f6b; --accent-soft:#ffe0ea; --rose:#d1708f;
  --ok:#6f8f6b; --ok-soft:#e8efe4; --warn:#b9854a; --warn-soft:#f8eddc; --danger:#b5524b; --danger-soft:#f7e3e0;
  --shadow:0 2px 12px rgba(120,90,60,.07);
  --radius:16px;
}
*{ box-sizing:border-box; }
html,body{ margin:0; }
body{ background:var(--bg); color:var(--ink); font-family:'Pretendard','Noto Sans KR','Malgun Gothic','Apple SD Gothic Neo',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(--accent-dark); word-break:break-all; }
[hidden]{ display:none !important; }
.muted{ color:var(--muted); font-size:13px; }
.req{ color:var(--accent); }

/* 버튼 */
.btn{ display:inline-flex; align-items:center; justify-content:center; gap:6px; min-height:38px; padding:7px 14px; border:1px solid var(--line-2); border-radius:12px; background:#fff; font-weight:700; font-size:14px; white-space:nowrap; }
.btn:hover{ background:var(--sel); }
.btn.primary{ background:var(--accent); border-color:var(--accent); color:#fff; }
.btn.primary:hover{ background:var(--accent-dark); }
.btn.danger{ color:var(--danger); border-color:#e6c6c2; }
.btn.danger:hover{ background:var(--danger-soft); }
.btn.ghost{ background:transparent; border-color:transparent; }
.btn.ghost:hover{ background:var(--sel); }
.btn.sq{ min-width:38px; padding:7px 10px; font-size:18px; line-height:1; }
.btn.block{ width:100%; }
.btn.small{ min-height:32px; padding:4px 10px; font-size:13px; border-radius:10px; }
.link{ border:0; background:none; color:var(--accent-dark); text-decoration:underline; padding:0; font-size:inherit; }

/* 로그인 */
.login{ min-height:100vh; display:flex; align-items:center; justify-content:center; padding:20px; }
.login-card{ width:min(380px,100%); background:#fff; border:1px solid var(--line); border-radius:20px; padding:30px 26px; box-shadow:var(--shadow); text-align:center; display:flex; flex-direction:column; gap:12px; }
.login-card h1{ margin:0; font-size:22px; }
.login-card p{ margin:0; }
.login-card input{ padding:12px 14px; border:1px solid var(--line-2); border-radius:12px; font-size:16px; background:var(--card-2); }
.brand-sm{ font-size:12px; letter-spacing:2px; color:var(--accent-dark); font-weight:800; }
.err{ color:var(--danger); font-size:13px; font-weight:700; min-height:1.2em; }

/* 상단 */
.topbar{ position:sticky; top:0; z-index:30; display:flex; align-items:center; gap:10px; flex-wrap:wrap; padding:10px 18px; background:rgba(255,247,214,.96); backdrop-filter:blur(6px); border-bottom:1px solid var(--line); }
.brand small{ display:block; font-size:11px; letter-spacing:2px; color:var(--accent-dark); font-weight:800; }
.brand h1{ margin:0; font-size:19px; font-weight:900; }
.nav{ display:flex; align-items:center; gap:2px; background:#fff; border:1px solid var(--line); border-radius:14px; padding:2px; }
.nav strong{ min-width:74px; text-align:center; font-size:15px; }
.spacer{ flex:1; }
.save-state{ border:1px solid var(--line); background:#fff; border-radius:999px; padding:5px 12px; font-size:12.5px; font-weight:800; color:var(--muted); }
.save-state.saving{ color:var(--warn); background:var(--warn-soft); border-color:transparent; }
.save-state.saved{ color:var(--ok); background:var(--ok-soft); border-color:transparent; }
.save-state.error{ color:#fff; background:var(--danger); border-color:transparent; }
.menu-toggle{ display:none; }
.more{ position:relative; }
.more-menu{ position:absolute; right:0; top:44px; min-width:210px; background:#fff; border:1px solid var(--line); border-radius:14px; box-shadow:0 10px 30px rgba(80,60,40,.18); padding:6px; display:flex; flex-direction:column; z-index:50; }
.more-menu button{ text-align:left; border:0; background:transparent; padding:10px 12px; border-radius:10px; font-size:14px; font-weight:700; }
.more-menu button:hover{ background:var(--sel); }

/* 본문 배치 */
.layout{ display:grid; grid-template-columns:220px minmax(0,1fr); gap:18px; max-width:1500px; margin:0 auto; padding:18px; align-items:start; }
.sidebar{ position:sticky; top:84px; background:#fff; border:1px solid var(--line); border-radius:var(--radius); padding:12px 10px; box-shadow:var(--shadow); max-height:calc(100vh - 100px); overflow:auto; }
.side-sec + .side-sec{ margin-top:12px; padding-top:10px; border-top:1px dashed var(--line); }
.side-sec h3{ margin:0 0 6px 8px; font-size:12px; letter-spacing:1px; color:var(--muted); font-weight:800; }
.menu{ display:flex; flex-direction:column; gap:2px; }
.menu button{ text-align:left; border:0; background:transparent; padding:9px 12px; border-radius:11px; font-size:14.5px; font-weight:700; color:var(--ink); min-height:40px; }
.menu button:hover{ background:var(--card-2); }
.menu button.on{ background:var(--sel); font-weight:900; color:var(--accent-dark); }
.side-scrim{ display:none; }

.main{ min-width:0; }
.cards{ display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; align-items:start; }
.card{ background:var(--card); border:1px solid var(--line); border-radius:var(--radius); box-shadow:var(--shadow); min-width:0; }
.card.full{ grid-column:1 / -1; }
.card-h{ display:flex; align-items:center; gap:8px; padding:14px 16px 8px; }
.card-h h2{ margin:0; font-size:16px; font-weight:900; flex:1; min-width:0; }
.card-h .num{ color:var(--accent); margin-right:4px; }
.card-tools{ display:flex; gap:4px; flex-wrap:wrap; justify-content:flex-end; }
.card-b{ padding:4px 12px 14px; }
.empty{ color:var(--muted); font-size:13.5px; padding:14px 8px; text-align:center; }
.sub-h{ margin:12px 6px 4px; font-size:12.5px; font-weight:900; color:var(--muted); letter-spacing:.5px; }
.sub-h.over{ color:var(--danger); }

/* 업무 줄 */
.rows{ display:flex; flex-direction:column; gap:6px; }
.row{ display:flex; align-items:flex-start; gap:8px; padding:9px 8px; border:1px solid var(--line); border-radius:12px; background:var(--card-2); }
.row.dragging{ opacity:.55; outline:2px dashed var(--accent); background:#fff; }
.row.done .title{ color:var(--muted); text-decoration:line-through; text-decoration-color:var(--line-2); }
.row.flash{ box-shadow:0 0 0 3px var(--accent-soft); }
.grip{ flex:none; width:22px; align-self:stretch; display:flex; align-items:center; justify-content:center; color:var(--line-2); cursor:grab; touch-action:none; user-select:none; font-size:16px; letter-spacing:-3px; }
.grip:hover{ color:var(--muted); }
.chkbox{ flex:none; display:flex; align-items:center; justify-content:center; width:34px; height:34px; margin:-4px 0 -4px -2px; cursor:pointer; }
.chkbox input{ width:20px; height:20px; accent-color:var(--accent); cursor:pointer; }
.rt{ flex:1; min-width:0; }
.rt .title{ display:block; width:100%; text-align:left; border:0; background:none; padding:0; font-weight:800; font-size:15px; line-height:1.4; overflow-wrap:anywhere; }
.rt .title:hover{ color:var(--accent-dark); }
.meta{ display:flex; flex-wrap:wrap; gap:4px 6px; margin-top:3px; align-items:center; }
.chip{ display:inline-block; font-size:11.5px; font-weight:800; padding:1px 8px; border-radius:999px; background:#fff; border:1px solid var(--line-2); color:var(--muted); white-space:nowrap; }
.chip.due{ background:var(--accent-soft); border-color:transparent; color:var(--accent-dark); }
.chip.over{ background:var(--danger-soft); border-color:transparent; color:var(--danger); }
.chip.today{ background:var(--warn-soft); border-color:transparent; color:#8a5f27; }
.chip.rep{ background:#f1ece4; border-color:transparent; }
.chip.sample{ background:#efe9f4; border-color:transparent; color:#7b6a8f; }
.chip.pri1{ color:#7b8f6b; } .chip.pri2{ color:var(--warn); } .chip.pri3{ color:var(--danger); border-color:#e6c6c2; }
.chip a{ text-decoration:none; }
.detail{ margin-top:3px; font-size:13px; color:var(--muted); white-space:pre-wrap; overflow-wrap:anywhere; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.acts{ flex:none; display:flex; gap:0; }
.acts button{ border:0; background:transparent; min-width:32px; min-height:32px; border-radius:9px; font-size:15px; color:var(--muted); }
.acts button:hover{ background:var(--sel); color:var(--ink); }
.add-row{ margin-top:8px; width:100%; border:1px dashed var(--line-2); background:transparent; border-radius:12px; padding:8px; color:var(--muted); font-weight:800; font-size:13.5px; }
.add-row:hover{ background:var(--card-2); color:var(--accent-dark); }

/* 반복 업무(정의) */
.rep-def .strip{ display:flex; flex-wrap:wrap; gap:4px; margin-top:6px; }
.occ-chip{ border:1px solid var(--line-2); background:#fff; border-radius:9px; padding:2px 9px; font-size:12px; font-weight:800; color:var(--muted); min-height:28px; }
.occ-chip.done{ background:var(--ok-soft); border-color:transparent; color:var(--ok); }
.occ-chip.cur{ border-color:var(--accent); }
.occ-chip:hover{ background:var(--sel); }

/* 메모 */
.memo-add{ display:flex; flex-direction:column; gap:6px; margin-bottom:10px; }
.memo-add textarea, .memo-search{ width:100%; padding:9px 11px; border:1px solid var(--line-2); border-radius:12px; background:var(--card-2); resize:vertical; min-height:44px; }
.memo-add .line{ display:flex; gap:6px; align-items:center; flex-wrap:wrap; }
.seg{ display:inline-flex; border:1px solid var(--line-2); border-radius:10px; overflow:hidden; }
.seg button{ border:0; background:#fff; padding:5px 12px; font-size:12.5px; font-weight:800; color:var(--muted); min-height:32px; }
.seg button.on{ background:var(--sel); color:var(--accent-dark); }
.memo{ border:1px solid var(--line); border-radius:12px; background:#fffef9; padding:8px 10px; display:flex; gap:8px; }
.memo.pinned{ background:#fff8ec; border-color:#ead8b8; }
.memo .mb{ flex:1; min-width:0; }
.memo .mt{ font-weight:900; font-size:14.5px; margin-bottom:2px; overflow-wrap:anywhere; }
.memo .mx{ white-space:normal; overflow-wrap:anywhere; font-size:14px; line-height:1.6; cursor:text; max-height:11em; overflow:hidden; }
.memo .mx.open{ max-height:none; }
.memo .mm{ margin-top:4px; font-size:11.5px; color:var(--muted); }
.memo input.mti, .memo textarea.mtx{ width:100%; border:1px solid var(--line-2); border-radius:10px; padding:7px 9px; background:#fff; }
.memo input.mti{ font-weight:800; margin-bottom:5px; }
.memo textarea.mtx{ min-height:110px; resize:vertical; line-height:1.55; }
.group-h{ margin:10px 4px 4px; font-size:12.5px; font-weight:900; color:var(--muted); }

/* 알림 */
.notice{ display:flex; align-items:center; gap:10px; flex-wrap:wrap; background:#f4ecfa; border:1px solid #e3d7ee; color:#5d4c78; border-radius:14px; padding:9px 14px; margin-bottom:14px; font-size:13.5px; font-weight:700; }
.notice.warn{ background:var(--warn-soft); border-color:#ecd9b8; color:#7a5424; }
.notice .btn{ min-height:30px; padding:3px 10px; font-size:12.5px; }

/* 대화상자 */
dialog.dlg{ border:0; border-radius:20px; padding:0; width:min(560px, calc(100vw - 20px)); max-height:calc(100vh - 20px); color:var(--ink); background:#fff; box-shadow:0 24px 60px rgba(70,50,30,.3); overflow:hidden; }
dialog.dlg.wide{ width:min(760px, calc(100vw - 20px)); }
dialog.dlg[open]{ display:flex; flex-direction:column; }
dialog.dlg form{ display:flex; flex-direction:column; min-height:0; max-height:calc(100vh - 20px); }
dialog.dlg::backdrop{ background:rgba(60,45,30,.4); }
.dlg-h{ display:flex; align-items:center; justify-content:space-between; gap:8px; padding:16px 20px 10px; border-bottom:1px solid var(--line); }
.dlg-h h2{ margin:0; font-size:18px; }
.x{ border:0; background:transparent; font-size:18px; min-width:36px; min-height:36px; border-radius:10px; color:var(--muted); }
.x:hover{ background:var(--sel); }
.dlg-b{ padding:14px 20px; display:flex; flex-direction:column; gap:12px; overflow:auto; }
.dlg-f{ display:flex; gap:8px; justify-content:flex-end; flex-wrap:wrap; padding:12px 20px 16px; border-top:1px solid var(--line); }
.f{ display:flex; flex-direction:column; gap:4px; min-width:0; }
.f > span{ font-size:13px; font-weight:800; color:var(--muted); }
.f input, .f select, .f textarea, .dlg-b input[type=search]{ padding:10px 12px; border:1px solid var(--line-2); border-radius:12px; background:var(--card-2); font-size:16px; width:100%; }
.f textarea{ resize:vertical; line-height:1.5; }
.f input:focus, .f select:focus, .f textarea:focus, .memo-add textarea:focus{ outline:2px solid var(--accent-soft); border-color:var(--accent); }
.row2{ display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.row2:empty{ display:none; }
.hint{ font-size:12.5px; color:var(--muted); }
.checks{ display:flex; flex-direction:column; gap:6px; }
.chk{ display:flex; align-items:center; gap:8px; font-weight:700; font-size:14.5px; min-height:34px; }
.chk input{ width:20px; height:20px; accent-color:var(--accent); }
.opt{ display:flex; gap:10px; align-items:flex-start; padding:10px 12px; border:1px solid var(--line); border-radius:12px; cursor:pointer; }
.opt:has(input:checked){ border-color:var(--accent); background:var(--accent-soft); }
.opt input{ margin-top:4px; accent-color:var(--accent); width:18px; height:18px; flex:none; }
.opt small{ display:block; color:var(--muted); font-size:12.5px; margin-top:2px; font-weight:500; }
.rd-name{ margin:0; font-weight:900; font-size:16px; }
.occ-info{ background:var(--card-2); border:1px solid var(--line); border-radius:12px; padding:10px 12px; font-size:14px; }
.occ-info b{ font-size:16px; display:block; margin-bottom:2px; }
.tabs{ display:flex; gap:6px; border-bottom:1px solid var(--line); }
.tab{ border:0; background:transparent; padding:9px 14px; font-weight:800; color:var(--muted); border-bottom:3px solid transparent; }
.tab.on{ color:var(--accent-dark); border-bottom-color:var(--accent); }
.pills{ display:flex; flex-wrap:wrap; gap:6px; margin:10px 0; }
.pill{ border:1px solid var(--line-2); background:#fff; border-radius:999px; padding:4px 12px; font-size:13px; font-weight:800; color:var(--muted); min-height:34px; }
.pill.on{ background:var(--sel); color:var(--accent-dark); border-color:var(--accent); }
.list{ display:flex; flex-direction:column; gap:6px; margin:6px 0 10px; }
.list .row{ align-items:center; }
.bk-row{ display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.bk-result{ font-size:13.5px; line-height:1.7; }
.bk-result .okk{ color:var(--ok); font-weight:800; } .bk-result .bad{ color:var(--danger); font-weight:800; }
.sq-kind{ flex:none; font-size:11px; font-weight:900; color:#fff; background:var(--rose); border-radius:6px; padding:1px 7px; }
.sq-kind.t{ background:var(--accent); } .sq-kind.r{ background:#8d8070; } .sq-kind.m{ background:#7f9a8a; } .sq-kind.d{ background:var(--ok); }
mark{ background:#fbe9c0; padding:0 1px; border-radius:3px; }

/* 토스트 */
.toast{ position:fixed; left:50%; bottom:calc(22px + env(safe-area-inset-bottom)); transform:translateX(-50%); background:var(--ink); color:#fff; padding:10px 18px; border-radius:999px; font-weight:700; font-size:14px; opacity:0; pointer-events:none; transition:opacity .2s; z-index:200; max-width:calc(100vw - 28px); text-align:center; }
.toast.show{ opacity:1; }
.toast.bad{ background:var(--danger); }

.print-title{ display:none; }

/* 모바일 */
@media (max-width:900px){
  .topbar{ padding:8px 12px; gap:8px; }
  .brand{ display:none; }
  .menu-toggle{ display:inline-flex; }
  .layout{ grid-template-columns:1fr; padding:12px; gap:12px; }
  .sidebar{ display:none; position:fixed; z-index:60; left:10px; right:10px; top:64px; max-height:calc(100vh - 80px); box-shadow:0 18px 40px rgba(70,50,30,.3); }
  body.menu-open .sidebar{ display:block; }
  body.menu-open .side-scrim{ display:block; position:fixed; inset:0; z-index:55; background:rgba(60,45,30,.3); }
  .menu{ display:grid; grid-template-columns:repeat(3,1fr); }
  .cards{ grid-template-columns:1fr; }
  .card.full{ grid-column:auto; }
  .row2{ grid-template-columns:1fr; }
  .nav strong{ min-width:60px; }
  .btn{ min-height:42px; }
  .chkbox{ width:40px; height:40px; }
  .chkbox input{ width:24px; height:24px; }
  .acts button{ min-width:40px; min-height:40px; font-size:17px; }
  .grip{ width:28px; }
  #searchBtn, #tplBtn{ flex:none; }
  .more-menu{ right:0; }
}
@media (max-width:520px){
  .menu{ grid-template-columns:repeat(2,1fr); }
  .save-state{ order:20; }
}

/* 인쇄 */
@media print{
  body{ background:#fff; font-size:12pt; }
  .topbar, .sidebar, .side-scrim, .toast, .notice, .acts, .grip, .add-row, .card-tools, .memo-add, .more, dialog{ display:none !important; }
  .layout{ display:block; padding:0; }
  .cards{ display:block; }
  .card{ box-shadow:none; break-inside:avoid; margin-bottom:10mm; border-color:#bbb; }
  .print-title{ display:block; font-size:18pt; font-weight:900; margin-bottom:8mm; }
  .row{ break-inside:avoid; background:#fff; }
  .chkbox input{ accent-color:#000; }
}

/* 좁은 화면 보정 */
.card-h{ flex-wrap:wrap; }
.card-h h2{ flex:1 1 9em; }
@media (max-width:900px){
  .row{ flex-wrap:wrap; }
  .row .rt{ flex:1 1 55%; }
  .row .acts{ margin-left:auto; flex:none; }
  .nav strong{ min-width:52px; font-size:14px; }
  .topbar .year-nav, .topbar .month-nav{ flex:none; }
}

/* 메뉴가 잘려 아래(수시 업무)가 안 보이던 문제: 스크롤 칸을 없애고 버튼을 두 줄로 모아 한눈에 보이게 한다 */
@media (min-width:901px){
  .sidebar{ position:static; max-height:none; overflow:visible; }
  #menuMonths, #menuRepeat{ display:grid; grid-template-columns:repeat(2,1fr); }
  .menu button{ min-height:36px; padding:7px 10px; }
}

.menu .menu-add{ grid-column:1 / -1; margin-top:4px; border:1px dashed var(--accent) !important; color:var(--accent-dark); font-weight:800; text-align:center; background:var(--accent-soft) !important; }
.menu .menu-add:hover{ background:#fff !important; }
