:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --border: #e2e6ec;
  --text: #1f2733;
  --muted: #6b7684;
  --accent: #2f6fed;
  --br: #2f6fed;      /* Bridge IoT */
  --cr: #e07b39;      /* Customer Req */
  --etc: #7a869a;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: -apple-system, "Segoe UI", "Malgun Gothic", sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* ── 로그인 ── */
.login-body { display: flex; align-items: center; justify-content: center; }
.login-card {
  background: var(--panel); padding: 40px; border-radius: 14px;
  box-shadow: 0 10px 40px rgba(0,0,0,.08); width: 360px; text-align: center;
}
.login-card h1 { font-size: 22px; margin: 0 0 4px; }
.login-card .sub { color: var(--muted); margin: 0 0 28px; }
.btn-google {
  display: block; padding: 12px; border: 1px solid var(--border); border-radius: 8px;
  text-decoration: none; color: var(--text); font-weight: 600; margin-bottom: 20px;
}
.btn-google:hover { background: #f7f9fc; }
.dev-login { border-top: 1px solid var(--border); padding-top: 20px; }
.dev-label { font-size: 13px; color: var(--muted); margin: 0 0 10px; }
#devForm { display: flex; gap: 8px; }
#devForm input { flex: 1; padding: 10px; border: 1px solid var(--border); border-radius: 8px; }
#devForm button {
  padding: 10px 16px; border: 0; background: var(--accent); color: #fff;
  border-radius: 8px; font-weight: 600; cursor: pointer;
}
.msg { color: #d23f3f; min-height: 18px; font-size: 13px; margin-top: 14px; }

/* ── 상단바 ── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  height: 56px; padding: 0 20px; background: var(--panel); border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; font-size: 17px; }
.user-area { display: flex; align-items: center; gap: 12px; color: var(--muted); }
.ghost { background: none; border: 1px solid var(--border); padding: 6px 12px; border-radius: 7px; cursor: pointer; color: var(--text); }
.ghost:hover { background: #f4f6f9; }

/* ── 레이아웃 ── */
.layout {
  display: grid; grid-template-columns: 340px 1fr; gap: 16px;
  padding: 16px; height: calc(100vh - 56px);
}
.panel {
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px; display: flex; flex-direction: column; min-height: 0;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.panel-head h2 { font-size: 15px; margin: 0; }
.badge { background: var(--accent); color: #fff; border-radius: 20px; padding: 1px 10px; font-size: 12px; font-weight: 700; }
.hint { font-size: 12px; color: var(--muted); margin: 0 0 12px; line-height: 1.5; }

/* 캘린더 이벤트를 왼쪽으로 끌어올 때의 드롭 영역 표시 */
.tasks-panel { position: relative; }
.tasks-panel.drop-target { outline: 2px dashed var(--accent); outline-offset: -5px; }
.tasks-panel.drop-target::after {
  content: "여기에 놓으면 목록으로 되돌리기 ↩";
  position: absolute; inset: 0; z-index: 5; pointer-events: none;
  display: flex; align-items: center; justify-content: center; text-align: center;
  background: rgba(47, 111, 237, 0.10); color: var(--accent);
  font-weight: 700; font-size: 14px; border-radius: 12px;
}

/* ── 작업 카드 ── */
.task-list { overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 10px; padding-right: 4px; }
.empty { color: var(--muted); text-align: center; margin-top: 40px; }
.task-card {
  position: relative;
  border: 1px solid var(--border); border-left: 4px solid var(--etc);
  border-radius: 9px; padding: 10px 12px; cursor: grab; background: #fff;
  transition: box-shadow .15s, transform .05s;
}
.card-del {
  border: 0; background: none; color: var(--muted); cursor: pointer;
  font-size: 13px; line-height: 1; padding: 2px 4px; border-radius: 5px;
  opacity: 0; transition: opacity .12s, background .12s, color .12s;
}
.task-card:hover .card-del { opacity: 1; }
.card-del:hover { background: #ffe4e1; color: #d2402f; }
.task-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,.08); }
.task-card:active { cursor: grabbing; transform: scale(.99); }
.task-card.proj-br { border-left-color: var(--br); }
.task-card.proj-cr { border-left-color: var(--cr); }
.task-card.mine { background: #f3f8ff; box-shadow: inset 0 0 0 1px #cfe0ff; }
.mine-tag { font-size: 10.5px; font-weight: 700; color: #1f6feb; background: #e3eeff; padding: 1px 7px; border-radius: 20px; }

/* 내 작업만 보기 토글 */
.mine-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); cursor: pointer; margin-bottom: 10px; user-select: none; }
.mine-toggle input { cursor: pointer; }
.task-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.proj-tag { font-size: 11px; font-weight: 700; color: var(--muted); }
.task-summary { font-size: 13.5px; font-weight: 600; line-height: 1.4; margin-bottom: 6px; }
.task-meta { font-size: 11.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 3px; }

/* 마감 D-day 배지 */
.due { font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 20px; }
.due-ok { background: #eef1f5; color: #6b7684; }
.due-soon { background: #fff4e0; color: #b8761b; }
.due-urgent { background: #ffe4e1; color: #d2402f; }
.due-over { background: #d2402f; color: #fff; }

/* ── 캘린더 ── */
.calendar-panel { min-width: 0; }
#calendar { flex: 1; min-height: 0; overflow-y: auto; }
.refresh {
  background: var(--accent); color: #fff; border: 0; padding: 7px 14px;
  border-radius: 8px; font-weight: 600; cursor: pointer;
}
.refresh:hover { filter: brightness(1.05); }
.refresh:disabled { opacity: .6; cursor: default; }

/* FullCalendar 이벤트 색상 */
.fc-event.proj-br { background: var(--br); border-color: var(--br); }
.fc-event.proj-cr { background: var(--cr); border-color: var(--cr); }
.fc-event.proj-etc { background: var(--etc); border-color: var(--etc); }
.fc-event { font-size: 12px; cursor: pointer; }
.fc-event.event-urgent { box-shadow: 0 0 0 2px #d2402f inset; font-weight: 700; }
.fc-event.mine { box-shadow: 0 0 0 2px #1f6feb inset; font-weight: 700; }
/* Jira에서 완료된 작업: 회색 처리 (프로젝트 색/내작업 강조보다 우선) */
.fc-event.done { background: #9aa3b0 !important; border-color: #9aa3b0 !important; box-shadow: none !important; font-weight: 400 !important; }
.fc-event.done .fc-event-title { text-decoration: line-through; opacity: .85; }
.fc .fc-toolbar-title { font-size: 18px; }
.fc .fc-button { text-transform: none; }

/* 월별 배경 구분 (연속 뷰에서 달 경계 식별) — 오늘 칸 강조는 유지 */
.fc-day.month-a:not(.fc-day-today) { background-color: #f4f7fc; }
.fc-day.month-b:not(.fc-day-today) { background-color: #ffffff; }
.month-badge {
  font-size: 10.5px; font-weight: 700; color: #4d5d7a;
  background: #e7eefb; padding: 0 6px; border-radius: 10px; margin-right: 4px;
}

/* 날짜 칸 상단 날씨(서울/부산/대전) — 박스 없이, 글씨는 일정 글씨 크기(12px), 아이콘은 1.5배(18px) */
.wx-strip { display: flex; flex-wrap: wrap; gap: 5px; padding: 2px 3px 0; align-items: center; }
.wx { display: inline-flex; align-items: center; gap: 1px; font-size: 12px; line-height: 1; white-space: nowrap; }
.wx .wx-ico { font-size: 18px; line-height: 1; }
.wx-seoul { color: #34507e; }
.wx-busan { color: #9a5a2b; }
.wx-daejeon { color: #2f6d40; }
.wx-rain { font-weight: 700; }

/* ── 체크리스트 진행도 동그라미 ── */
.cl-dot { width: 13px; height: 13px; border-radius: 50%; display: inline-block; cursor: pointer; box-sizing: border-box; }
.cl-dot:hover { transform: scale(1.15); }
.cl-dot-lg { width: 18px; height: 18px; border-radius: 50%; display: inline-block; box-sizing: border-box; }

/* 캘린더 블럭 오른쪽 끝에 고정되는 체크리스트 동그라미 (글씨가 잘려도 항상 보임) */
.fc-daygrid-event.has-cl-dot { position: relative; }
.fc-daygrid-event .fc-event-main { padding-right: 13px; }
.cl-dot-ev {
  width: 10px; height: 10px; border-radius: 50%; box-sizing: border-box;
  position: absolute; right: 2px; top: 50%; transform: translateY(-50%); z-index: 4;
}

/* 체크리스트 팝업 */
.checklist-card { width: 420px; max-height: 86vh; overflow-y: auto; }
.cl-progress { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; color: var(--muted); font-weight: 700; font-size: 13px; }
.cl-items { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.cl-item { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 13.5px; cursor: pointer; }
.cl-item:hover { background: #f7f9fc; }
.cl-item input { width: 16px; height: 16px; cursor: pointer; }

/* ── 모달 ── */
.modal {
  position: fixed; inset: 0; background: rgba(20,28,40,.45);
  display: flex; align-items: center; justify-content: center; z-index: 1100;
}
.modal[hidden] { display: none; }
.modal-card {
  background: #fff; border-radius: 14px; padding: 24px; width: 360px; max-width: 90vw;
  box-shadow: 0 16px 50px rgba(0,0,0,.25);
}
.modal-card h3 { margin: 0 0 12px; font-size: 16px; line-height: 1.4; }
.modal-body { color: var(--muted); font-size: 13.5px; line-height: 1.7; margin: 0 0 20px; }
.modal-body a { color: var(--accent); }
.modal-actions { display: flex; flex-direction: column; gap: 8px; }
.modal-actions button { padding: 11px; border-radius: 8px; font-weight: 600; cursor: pointer; border: 1px solid var(--border); }
.btn-secondary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-danger { background: #fff; color: #d2402f; border-color: #f3c2bc; }
.btn-danger:hover { background: #ffe4e1; }

/* ── 설정 모달 ── */
.settings-card { width: 460px; max-height: 86vh; overflow-y: auto; }
.settings-section { border: 1px solid var(--border); border-radius: 10px; padding: 14px; margin-bottom: 14px; }
.settings-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.settings-help { font-size: 12px; color: var(--muted); line-height: 1.5; margin: 0 0 10px; }
.settings-help a { color: var(--accent); }
.settings-card label { display: block; font-size: 12.5px; color: var(--text); margin-bottom: 10px; }
.settings-card label input {
  display: block; width: 100%; margin-top: 4px; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 7px; font-size: 13px;
}
.settings-card code { background: #f1f3f7; padding: 2px 6px; border-radius: 5px; font-size: 11.5px; word-break: break-all; }
.status-pill { font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 20px; background: #eef1f5; color: var(--muted); }
.status-pill.on { background: #e3f5e9; color: #1f9d57; }
.status-pill.off { background: #fff4e0; color: #b8761b; }
.modal-actions.row { flex-direction: row; justify-content: flex-end; }

/* ── 토스트 ── */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #1f2733; color: #fff; padding: 12px 22px; border-radius: 24px;
  font-size: 14px; box-shadow: 0 6px 24px rgba(0,0,0,.2); z-index: 1000;
}
.toast.error { background: #d2402f; }
