:root {
  /* B.FLOW 브랜드 팔레트(bowoosystem-brand-theme.css)와 같은 값 — 메인 #0A2A4B, 포인트 #E4002B.
     모서리는 B.FLOW 공통 규칙처럼 전부 직각(radius 0)으로 두고 여백을 촘촘하게 쓴다. */
  color-scheme: light;
  --primary: #0a2a4b;
  --primary-hover: #08223c;
  --primary-soft: #e9eef4;
  --primary-line: #aebdcd;
  --accent: #2563eb;
  --point: #e4002b;
  --save: #16a34a;
  --save-hover: #12813b;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --tab-bg: #eef1f4;
  --border: #e5e9ef;
  --border-strong: #cbd2db;
  --text: #374151;
  --text-muted: #6b7280;
  --danger: #dc2626;
  --sun: #dc2626;
  --sat: #2563eb;
  --today: #0a2a4b;
  --radius: 0;
  --radius-sm: 0;
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.16);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.08);
  --header-h: 48px;
  --tabs-h: 38px;
  --top-h: calc(var(--header-h) + var(--tabs-h));
  --hour-h: 48px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Malgun Gothic", "Apple SD Gothic Neo", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  -webkit-tap-highlight-color: transparent;
}
body.modal-open { overflow: hidden; }
button, input, select, textarea { font-family: inherit; color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--text-muted); }
.small { font-size: 12px; }
.spacer { flex: 1; }

/* ---------- 폼 기본 ---------- */
input[type="text"], input[type="password"], input[type="tel"], input[type="email"], input[type="search"],
input[type="date"], input[type="number"], select, textarea {
  font-size: 13px;
  padding: 6px 9px;
  border: 1px solid var(--border-strong);
  border-radius: 0;
  background: var(--surface);
  min-height: 34px;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(10, 42, 75, 0.18); }
/* 휴대폰은 입력칸 글자가 16px보다 작으면 포커스할 때 화면이 확대된다 (iOS) */
@media (max-width: 767px) {
  input[type="text"], input[type="password"], input[type="tel"], input[type="email"], input[type="search"],
  input[type="date"], input[type="number"], select, textarea { font-size: 16px; }
}
input[readonly] { background: var(--surface-2); color: var(--text-muted); }
textarea { resize: vertical; line-height: 1.5; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); width: 16px; height: 16px; margin: 0; }

.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; font-size: 12px; color: var(--text-muted); }
.field input, .field select { min-height: 36px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 480px) { .two-col { grid-template-columns: 1fr; } }

.btn-primary, .btn-secondary, .btn-danger, .btn-outline, .btn-save {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 32px; padding: 5px 12px;
  border-radius: 0;
  font-size: 13px; font-weight: 600; letter-spacing: 0.04em; line-height: 1.2;
  cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn-primary { background: var(--primary); color: #fff; border: 1px solid var(--primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: default; }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); font-weight: 500; }
.btn-secondary:hover { background: var(--surface-2); border-color: var(--primary-line); }
.btn-danger { background: var(--surface); color: var(--danger); border: 1px solid #f0b4b4; font-weight: 500; }
.btn-danger:hover { background: #fef2f2; }
.btn-outline { background: var(--surface); color: var(--primary); border: 1px solid var(--primary-line); font-weight: 500; }
.btn-outline:hover { background: var(--primary-soft); }
.btn-outline.danger { color: var(--danger); border-color: #f0b4b4; }
.btn-outline.small { min-height: 28px; padding: 4px 10px; font-size: 12px; }
/* 저장(확정) 버튼 — 다른 버튼과 한눈에 구분되도록 초록색 */
.btn-save { background: var(--save); color: #fff; border: 1px solid var(--save); font-weight: 700; }
.btn-save:hover { background: var(--save-hover); }
.btn-block { width: 100%; min-height: 38px; font-size: 13px; }
.btn-link { display: block; width: 100%; margin-top: 8px; background: none; border: none; color: var(--primary); font-size: 13px; padding: 6px; cursor: pointer; }
.btn-small { font-size: 12px; padding: 5px 10px; border-radius: 0; border: 1px solid var(--primary-line); color: var(--primary); background: var(--surface); cursor: pointer; letter-spacing: 0.04em; }
.btn-small:hover { background: var(--primary-soft); }
.btn-small.danger { color: var(--danger); border-color: #f0b4b4; }
.link-small { background: none; border: none; color: var(--accent); font-size: 12px; cursor: pointer; padding: 2px 4px; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; flex-shrink: 0;
  border-radius: 0; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn.plain { border: none; background: none; color: var(--text-muted); }
.error-text { color: var(--danger); font-size: 13px; margin: 6px 0 10px; }
.empty-text { color: var(--text-muted); text-align: center; padding: 40px 0; }

/* ---------- 로그인 ---------- */
.screen { min-height: 100vh; min-height: 100dvh; }
#view-login {
  display: flex; align-items: center; justify-content: center;
  padding: 20px; padding-top: calc(20px + env(safe-area-inset-top));
  background: linear-gradient(160deg, #0a2a4b 0%, #133d69 45%, #f3f5f8 45.1%);
}
.login-box { width: 100%; max-width: 380px; background: var(--surface); border-radius: 0; padding: 28px 24px 18px; box-shadow: var(--shadow); border-top: 4px solid var(--primary); }
.login-logo { text-align: center; }
.login-logo img { border-radius: 0; }
.app-title { text-align: center; font-size: 22px; font-weight: 800; color: var(--primary); margin: 8px 0 22px; }
.checkbox-row { display: flex; gap: 16px; font-size: 13px; color: var(--text-muted); margin-bottom: 14px; }
.checkbox-row label { display: flex; align-items: center; gap: 6px; cursor: pointer; }

/* ---------- 헤더 (B.FLOW: 흰 상단바 48px + 회색 탭 줄, 활성 탭은 흰 배경 + 남색 밑줄) ---------- */
.app-top { position: sticky; top: 0; z-index: 30; padding-top: env(safe-area-inset-top); background: var(--surface); }
.app-header {
  display: flex; align-items: center; gap: 6px;
  height: var(--header-h); padding: 0 14px;
  background: var(--surface); color: var(--text);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 9px; flex-shrink: 0; }
.brand-icon { width: 30px; height: 30px; display: block; }
.brand-mark {
  width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary); color: #fff; font-weight: 800; font-size: 12px; letter-spacing: 0.02em;
  border-bottom: 3px solid var(--point);
}
.brand-text { font-weight: 800; font-size: 16px; color: var(--primary); letter-spacing: -0.01em; }
.header-btn {
  display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
  height: 32px; padding: 0 10px; border: 0; background: none; border-radius: 0;
  color: var(--text-muted); font-size: 12px; cursor: pointer;
}
.header-btn:hover { background: var(--primary-soft); color: var(--primary); }
#user-name-label { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; color: var(--text); }
.tabs {
  display: flex; height: var(--tabs-h); overflow-x: auto; scrollbar-width: none;
  background: var(--tab-bg); border-bottom: 1px solid var(--border);
}
.tabs::-webkit-scrollbar { display: none; }
.tab-btn {
  position: relative; flex-shrink: 0; display: inline-flex; align-items: center; gap: 4px;
  padding: 0 18px; background: none; border: 0;
  border-right: 1px solid var(--border); border-bottom: 2px solid transparent;
  color: var(--text-muted); font-size: 13px; cursor: pointer; white-space: nowrap;
}
.tab-btn:hover { background: color-mix(in srgb, var(--primary) 8%, var(--tab-bg)); font-weight: 700; }
.tab-btn.active { background: var(--surface); color: var(--primary); font-weight: 700; border-bottom-color: var(--primary); }
.badge { display: inline-block; min-width: 16px; height: 16px; line-height: 16px; padding: 0 4px; border-radius: 0; background: var(--point); color: #fff; font-size: 10px; font-weight: 700; text-align: center; }

.only-mobile { display: none !important; }
@media (max-width: 767px) {
  .only-mobile { display: inline-flex !important; }
  .hide-mobile { display: none !important; }
  :root { --header-h: 46px; --tabs-h: 40px; }
  .app-header { padding: 0 8px; }
  .brand-text { font-size: 15px; }
  .tab-btn { padding: 0 14px; }
  #user-name-label { max-width: 110px; }
}

/* ---------- 캘린더 레이아웃 ---------- */
#tabview-calendar { height: calc(100dvh - var(--top-h) - env(safe-area-inset-top)); }
.cal-layout { display: flex; height: 100%; }
.cal-side {
  width: 248px; flex-shrink: 0; overflow-y: auto;
  padding: 16px 14px; background: var(--surface); border-right: 1px solid var(--border);
}
.new-event-btn { margin-bottom: 16px; }
.cal-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cal-toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 14px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.nav-arrows { display: flex; gap: 4px; }
.cal-title { margin: 0 8px 0 4px; font-size: 19px; font-weight: 700; flex: 1; white-space: nowrap; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.seg button { background: var(--surface); border: none; padding: 7px 14px; font-size: 13px; cursor: pointer; border-left: 1px solid var(--border); }
.seg button:first-child { border-left: none; }
.seg button.active { background: var(--primary); color: #fff; font-weight: 700; }
.cal-body { flex: 1; min-height: 0; position: relative; background: var(--surface); overflow: hidden; display: flex; flex-direction: column; }

.side-group { margin-top: 18px; }
.side-title { display: flex; align-items: center; justify-content: space-between; font-size: 12px; font-weight: 700; color: var(--text-muted); margin-bottom: 8px; }
.side-check { display: flex; align-items: center; gap: 8px; padding: 5px 2px; font-size: 13.5px; cursor: pointer; }
.cat-check { display: flex; align-items: center; gap: 8px; padding: 5px 2px; font-size: 13.5px; cursor: pointer; }
.cat-check input { position: absolute; opacity: 0; pointer-events: none; }
.cat-check .sw { width: 14px; height: 14px; border-radius: 0; border: 2px solid var(--c); background: var(--c); position: relative; flex-shrink: 0; }
.cat-check .sw::after { content: ''; position: absolute; left: 4px; top: 0; width: 4px; height: 8px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.cat-check input:not(:checked) + .sw { background: transparent; }
.cat-check input:not(:checked) + .sw::after { display: none; }

/* 미니 달력 */
.mini-cal { user-select: none; }
.mini-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; font-weight: 700; font-size: 13.5px; }
.mini-head button { background: none; border: none; cursor: pointer; padding: 4px 8px; color: var(--text-muted); font-size: 14px; }
.mini-grid { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; font-size: 11.5px; }
.mini-grid .wd { color: var(--text-muted); padding: 4px 0; }
.mini-grid .d { padding: 0; height: 26px; line-height: 26px; border-radius: 0; cursor: pointer; margin: 1px; position: relative; }
.mini-grid .d:hover { background: var(--primary-soft); }
.mini-grid .d.other { color: #b5bec8; }
.mini-grid .d.sun, .mini-grid .d.hol { color: var(--sun); }
.mini-grid .d.sat { color: var(--sat); }
.mini-grid .d.other.sun, .mini-grid .d.other.sat, .mini-grid .d.other.hol { opacity: 0.45; }
.mini-grid .d.inrange { background: var(--primary-soft); border-radius: 0; }
.mini-grid .d.today { background: var(--today); color: #fff; font-weight: 700; border-radius: 0; }
.mini-grid .d.has::after { content: ''; position: absolute; bottom: 3px; left: 50%; width: 4px; height: 4px; margin-left: -2px; border-radius: 0; background: var(--point); }
.mini-grid .d.today.has::after { background: #fff; }

/* 모바일: 사이드바는 왼쪽 서랍 */
@media (max-width: 767px) {
  .cal-side { position: fixed; top: 0; bottom: 0; left: 0; z-index: 60; width: 280px; transform: translateX(-100%); transition: transform 0.2s ease; box-shadow: var(--shadow); padding-top: calc(16px + env(safe-area-inset-top)); }
  .cal-side.open { transform: none; }
  .side-dim { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.35); z-index: 55; }
  .cal-toolbar { padding: 8px 10px; gap: 6px; }
  .cal-title { font-size: 16px; order: -1; flex-basis: calc(100% - 50px); margin: 0; }
  #side-open { order: -2; }
  .seg button { padding: 6px 11px; }
  #cal-today { min-height: 34px; padding: 5px 10px; }
  .nav-arrows .icon-btn { width: 34px; height: 34px; }
}

.fab {
  position: fixed; right: 18px; bottom: calc(22px + env(safe-area-inset-bottom)); z-index: 40;
  width: 54px; height: 54px; border-radius: 0; border: none; border-bottom: 3px solid var(--point);
  background: var(--primary); color: #fff; box-shadow: 0 6px 18px rgba(10, 42, 75, 0.4);
  align-items: center; justify-content: center; cursor: pointer;
}

/* ---------- 월간 보기 ---------- */
.month { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.month-wd { display: grid; grid-template-columns: repeat(7, 1fr); border-bottom: 1px solid var(--border); flex-shrink: 0; }
.month-wd div { padding: 7px 8px; font-size: 12px; color: var(--text-muted); text-align: left; }
.month-wd div:first-child { color: var(--sun); }
.month-wd div:last-child { color: var(--sat); }
.month-rows { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.week-row { position: relative; flex: 1 1 0; min-height: 92px; border-bottom: 1px solid var(--border); }
.week-row .cells { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(7, 1fr); }
.week-row .cell { border-left: 1px solid var(--border); padding: 4px 6px; cursor: pointer; min-width: 0; }
.week-row .cell:first-child { border-left: none; }
.week-row .cell:hover { background: #fafcfe; }
.week-row .cell.other { background: #fafbfc; }
.week-row .cell.other .dnum, .week-row .cell.other .hname { opacity: 0.45; }
.cell-head { display: flex; align-items: center; gap: 4px; height: 20px; font-size: 12px; overflow: hidden; white-space: nowrap; }
.dnum { font-weight: 600; min-width: 22px; height: 20px; line-height: 20px; text-align: center; border-radius: 0; }
.cell.sun .dnum, .cell.hol .dnum { color: var(--sun); }
.cell.sat .dnum { color: var(--sat); }
.cell.today .dnum { background: var(--today); color: #fff; padding: 0 6px; }
/* 토요일이 공휴일이면 빨간색이 이긴다 (토요일 파란색 규칙보다 뒤에 둔다) */
.cell.hol .dnum, .tg-dayhead.hol .dn, .tg-dayhead.hol .wd, .list-date.hol .dn, .list-date.hol .wd, .mini-grid .d.hol { color: var(--sun); }
.cell.today .dnum, .tg-dayhead.today .dn, .mini-grid .d.today { color: #fff; }
.hname { color: var(--sun); font-size: 11px; overflow: hidden; text-overflow: ellipsis; }
.lunar { color: #9aa5b1; font-size: 10.5px; margin-left: auto; }
.cell.selected { background: var(--primary-soft) !important; }

.ev-layer { position: absolute; left: 0; right: 0; top: 24px; bottom: 0; pointer-events: none; }
.ev-bar {
  position: absolute; height: 19px; line-height: 19px; padding: 0 6px; margin: 0 2px;
  font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  border-radius: 0; cursor: pointer; pointer-events: auto;
  background: var(--c); color: #fff;
}
.ev-bar.timed { background: transparent; color: var(--text); padding-left: 4px; }
.ev-bar.timed::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 0; background: var(--c); margin-right: 5px; vertical-align: 1px; }
.ev-bar.timed .t { color: var(--text-muted); margin-right: 4px; font-size: 11px; }
.ev-bar.cont-l { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: 0; }
.ev-bar.cont-r { border-top-right-radius: 0; border-bottom-right-radius: 0; margin-right: 0; }
.ev-bar:hover { filter: brightness(0.94); }
.ev-bar.timed:hover { background: var(--surface-2); filter: none; }
.more-link { position: absolute; height: 18px; line-height: 18px; font-size: 11.5px; color: var(--text-muted); padding: 0 6px; cursor: pointer; pointer-events: auto; font-weight: 600; }
.more-link:hover { color: var(--primary); text-decoration: underline; }

@media (max-width: 767px) {
  .month { flex: 0 0 auto; }
  .month-rows { flex: 0 0 auto; }
  .week-row { flex: 0 0 auto; height: 74px; min-height: 0; }
  .week-row .cell { padding: 2px 2px; }
  .cell-head { justify-content: center; height: 18px; }
  .hname, .lunar { display: none; }
  .ev-layer { top: 20px; }
  .ev-bar { height: 15px; line-height: 15px; font-size: 10px; padding: 0 3px; margin: 0 1px; border-radius: 0; }
  .ev-bar.timed { background: var(--c); color: #fff; opacity: 0.85; }
  .ev-bar.timed::before, .ev-bar.timed .t { display: none; }
  .more-link { font-size: 10px; height: 14px; line-height: 14px; padding: 0 3px; }
  .cal-body.mobile-month { overflow-y: auto; display: block; }
}

/* 모바일 월간 보기 아래 선택한 날의 일정 */
.day-agenda { border-top: 6px solid var(--bg); padding: 10px 14px 90px; }
.day-agenda-head { display: flex; align-items: baseline; gap: 8px; font-weight: 700; font-size: 15px; margin-bottom: 6px; }
.day-agenda-head small { color: var(--text-muted); font-weight: 400; font-size: 12px; }

/* ---------- 주간/일간 보기 ---------- */
.tg { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.tg-head { display: grid; border-bottom: 1px solid var(--border); flex-shrink: 0; padding-right: var(--sbw, 0px); }
.tg-head .corner { border-right: 1px solid var(--border); }
.tg-dayhead { text-align: center; padding: 6px 2px; border-left: 1px solid var(--border); cursor: pointer; min-width: 0; }
.tg-dayhead:first-of-type { border-left: none; }
.tg-dayhead .wd { font-size: 12px; color: var(--text-muted); }
.tg-dayhead .dn { font-size: 20px; font-weight: 600; line-height: 30px; display: inline-block; min-width: 32px; border-radius: 0; }
.tg-dayhead.sun .dn, .tg-dayhead.sun .wd, .tg-dayhead.hol .dn { color: var(--sun); }
.tg-dayhead.sat .dn, .tg-dayhead.sat .wd { color: var(--sat); }
.tg-dayhead.today .dn { background: var(--today); color: #fff; }
.tg-dayhead .hn { font-size: 10.5px; color: var(--sun); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tg-allday { position: relative; display: grid; border-bottom: 1px solid var(--border-strong); flex-shrink: 0; padding-right: var(--sbw, 0px); }
.tg-allday .label { font-size: 11px; color: var(--text-muted); padding: 4px; text-align: right; border-right: 1px solid var(--border); }
.tg-allday .adcell { border-left: 1px solid var(--border); cursor: pointer; }
.tg-allday .adcell:first-of-type { border-left: none; }
.tg-allday .ev-layer { top: 2px; }
.tg-scroll { flex: 1; overflow-y: auto; position: relative; }
.tg-grid { position: relative; display: grid; height: calc(var(--hour-h) * 24); }
.tg-hours { position: relative; border-right: 1px solid var(--border); }
.tg-hours div { position: absolute; right: 6px; font-size: 11px; color: var(--text-muted); transform: translateY(-7px); }
.tg-col { position: relative; border-left: 1px solid var(--border); cursor: cell; touch-action: pan-y; }
.tg-col:first-of-type { border-left: none; }
.tg-col.today { background: #fbfcff; }
.tg-lines { position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(to bottom, var(--border) 1px, transparent 1px), linear-gradient(to bottom, #eef1f5 1px, transparent 1px);
  background-size: 100% var(--hour-h), 100% calc(var(--hour-h) / 2);
  background-position: 0 0, 0 calc(var(--hour-h) / 2);
}
.tg-ev {
  position: absolute; overflow: hidden; border-radius: 0; padding: 2px 5px;
  font-size: 12px; line-height: 1.3; cursor: pointer;
  background: color-mix(in srgb, var(--c) 16%, #fff); color: var(--text);
  border-left: 3px solid var(--c); box-shadow: 0 0 0 1px #fff;
}
.tg-ev:hover { background: color-mix(in srgb, var(--c) 26%, #fff); z-index: 3; }
.tg-ev .tt { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tg-ev .tm { font-size: 11px; color: var(--text-muted); }
.tg-now { position: absolute; left: 0; right: 0; height: 2px; background: #e5484d; z-index: 4; pointer-events: none; }
.tg-now::before { content: ''; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: #e5484d; }
.tg-select { position: absolute; left: 2px; right: 2px; background: rgba(10, 42, 75, 0.14); border: 1px solid var(--primary); border-radius: 0; z-index: 5; pointer-events: none; font-size: 11px; padding: 2px 4px; color: var(--primary); font-weight: 600; }
@media (max-width: 767px) {
  :root { --hour-h: 44px; }
  .tg-dayhead .dn { font-size: 16px; line-height: 26px; min-width: 26px; }
  .tg-dayhead .hn { display: none; }
  .tg-ev { font-size: 10.5px; padding: 1px 3px; }
  .tg-ev .tm { display: none; }
}

/* ---------- 목록 보기 / 일정 목록 공통 ---------- */
.list-view { flex: 1; overflow-y: auto; padding: 8px 16px 90px; }
.list-day { display: flex; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.list-date { width: 76px; flex-shrink: 0; }
.list-date .dn { font-size: 22px; font-weight: 700; line-height: 1.1; }
.list-date .wd { font-size: 12px; color: var(--text-muted); }
.list-date.sun .dn, .list-date.sun .wd, .list-date.hol .dn { color: var(--sun); }
.list-date.sat .dn, .list-date.sat .wd { color: var(--sat); }
.list-date.today .dn { color: var(--primary); text-decoration: underline; text-underline-offset: 4px; }
.list-date .hn { font-size: 11px; color: var(--sun); }
.agenda { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 0; }
.agenda li { display: flex; align-items: flex-start; gap: 10px; padding: 8px 6px; border-radius: var(--radius-sm); cursor: pointer; }
.agenda li:hover { background: var(--surface-2); }
.agenda .dot { width: 10px; height: 10px; border-radius: 0; background: var(--c); margin-top: 5px; flex-shrink: 0; }
.agenda .when { width: 96px; flex-shrink: 0; color: var(--text-muted); font-size: 12.5px; padding-top: 1px; }
.agenda .what { flex: 1; min-width: 0; }
.agenda .what b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agenda .what small { display: block; color: var(--text-muted); font-size: 12px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agenda .empty { color: var(--text-muted); cursor: default; }
.agenda .empty:hover { background: none; }
.rep-icon { display: inline-block; font-size: 11px; color: var(--text-muted); margin-left: 4px; }

/* ---------- 모달 공통 ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 70;
  display: flex; align-items: center; justify-content: center;
  padding: 20px; background: rgba(10, 20, 35, 0.45);
}
.modal {
  width: 100%; max-width: 440px; max-height: 88vh; max-height: 88dvh; overflow-y: auto;
  background: var(--surface); border-radius: 0; box-shadow: var(--shadow);
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
}
.modal h2 { margin: 0 0 12px; font-size: 15px; }
/* 제목(h2.modal-title 또는 .modal-head)을 팝업 맨 위 남색 띠로 */
.modal > .modal-title, .modal > .modal-head, .modal > form > .modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin: -16px -16px 14px; padding: 10px 14px;
  background: var(--primary); color: #fff; font-size: 14px; font-weight: 700;
  position: sticky; top: -16px; z-index: 6;
}
.modal > .modal-head h2 { margin: 0; font-size: 14px; color: #fff; }
.modal > .modal-head .icon-btn.plain { color: rgba(255, 255, 255, 0.85); width: 28px; height: 28px; }
.modal > .modal-head .icon-btn.plain:hover { color: #fff; background: rgba(255, 255, 255, 0.12); }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.modal-head h2 { margin: 0; }
.modal-actions { display: flex; gap: 6px; margin: 14px -16px 0; padding: 10px 16px 0; border-top: 1px solid var(--border); }
.modal-actions > * { flex: 1; }
.modal-actions.center { justify-content: center; }
.modal-actions.center > * { flex: 0 0 auto; min-width: 76px; }
#choice-modal, #customer-modal, #password-modal, #day-modal { z-index: 80; }
#repeat-modal { z-index: 75; }
.choice-modal { max-width: 360px; }
.choice-buttons { display: flex; flex-direction: column; gap: 8px; }

/* ---------- 일정 등록 폼 ---------- */
.event-modal { max-width: 900px; padding: 0; }
.ev-topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--primary); color: #fff; }
.ev-topbar h2 { margin: 0; flex: 1; font-size: 14px; color: #fff; }
.ev-topbar .icon-btn.plain { color: rgba(255, 255, 255, 0.85); }
.ev-topbar .icon-btn.plain:hover { color: #fff; background: rgba(255, 255, 255, 0.12); }
#event-form > .error-text { margin: 0 16px 16px 100px; }
.ev-grid { display: grid; grid-template-columns: 84px 1fr; gap: 12px 12px; padding: 18px 18px 22px; align-items: start; }
.ev-label { font-weight: 700; font-size: 13px; padding-top: 8px; }
.ev-field { min-width: 0; }
.ev-field > input[type="text"], .ev-field > textarea { width: 100%; max-width: 760px; }
.ev-divider { grid-column: 1 / -1; border-top: 1px solid var(--border); margin: 2px 0; }
.dt-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.dt-pair { display: flex; gap: 6px; }
.dt-dash { color: var(--text-muted); }
.sel-caltype { width: 84px; }
.sel-time { width: 118px; }
.btn-repeat { display: inline-flex; align-items: center; gap: 4px; height: 34px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: 0; background: var(--surface); font-size: 13px; cursor: pointer; }
.btn-repeat.on { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); font-weight: 600; }
.chk { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; margin-left: 4px; }
.lunar-hint { margin-top: 6px; font-size: 12px; color: var(--text-muted); }
.repeat-summary { margin-top: 8px; padding: 8px 10px; background: var(--surface-2); border-radius: var(--radius-sm); font-size: 13px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.field-hint { margin-top: 6px; font-size: 12px; color: var(--text-muted); }
.field-hint.warn { color: #b7791f; }
.field-hint button { font-size: 12px; }
.input-group { display: flex; max-width: 760px; }
.input-group input { flex: 1; min-width: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.group-btn { flex-shrink: 0; min-width: 40px; border: 1px solid var(--border-strong); border-left: none; background: var(--surface); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; font-size: 18px; color: var(--text-muted); cursor: pointer; }
.group-btn.text { font-size: 12.5px; padding: 0 10px; color: var(--primary); }
.group-btn:hover { background: var(--surface-2); }
.ac-wrap { position: relative; }
.suggestions {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 20;
  list-style: none; margin: 0; padding: 4px; max-height: 260px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow);
}
.suggestions li { padding: 7px 10px; border-radius: 0; cursor: pointer; font-size: 14px; }
.suggestions li small { color: var(--text-muted); font-size: 12px; margin-left: 6px; }
.suggestions li.active, .suggestions li:hover { background: var(--primary-soft); }

.chip-input { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; max-width: 760px; min-height: 38px; padding: 3px 0 3px 6px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); }
.chip-input:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(10, 42, 75, 0.12); }
.chip-input input { flex: 1; min-width: 120px; border: none !important; box-shadow: none !important; min-height: 30px; padding: 4px; }
.chip-input .group-btn { align-self: stretch; margin: -3px 0; border-top: none; border-bottom: none; border-right: none; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; border-left: 1px solid var(--border-strong); }
.chips { display: contents; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 8px; border-radius: 0; background: var(--primary-soft); color: var(--primary); font-size: 13px; }
.chip.guest { background: #fff4e0; color: #8a5a00; }
.chip button { border: none; background: none; cursor: pointer; color: inherit; opacity: 0.6; font-size: 14px; line-height: 1; padding: 0 3px; }
.chip button:hover { opacity: 1; }

.cat-select-wrap { position: relative; display: inline-block; }
.cat-dot { position: absolute; left: 10px; top: 50%; width: 10px; height: 10px; margin-top: -5px; border-radius: 0; pointer-events: none; }
.sel-category { width: 300px; max-width: 100%; padding-left: 28px; }

.notify-row { display: flex; gap: 18px; flex-wrap: wrap; padding-top: 6px; }
.big-check { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; color: var(--text-muted); cursor: pointer; }
.big-check input { position: absolute; opacity: 0; pointer-events: none; }
.big-check .box { width: 22px; height: 22px; border: 2px solid #b7c0ca; border-radius: 0; position: relative; }
.big-check input:checked + .box { border-color: #1a73c9; }
.big-check input:checked + .box::after { content: ''; position: absolute; left: 6px; top: 1px; width: 7px; height: 13px; border: solid #1a73c9; border-width: 0 3px 3px 0; transform: rotate(45deg); }
.big-check:has(input:checked) { color: #1a73c9; }
.big-check input:focus-visible + .box { box-shadow: 0 0 0 3px rgba(26, 115, 201, 0.25); }
.alarm-list { display: flex; flex-direction: column; gap: 8px; margin: 14px 0 10px; }
.alarm-row { display: flex; align-items: center; gap: 8px; }
.alarm-row select { width: 250px; max-width: 70%; }
.alarm-del { display: inline-flex; align-items: center; gap: 3px; background: none; border: none; cursor: pointer; font-size: 14px; color: var(--text); }
.alarm-del:hover { color: var(--danger); }

@media (max-width: 767px) {
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal { max-height: 92dvh; border-radius: 0; }
  .event-modal { max-width: none; height: 100dvh; max-height: 100dvh; border-radius: 0; }
  .ev-topbar { padding-top: calc(12px + env(safe-area-inset-top)); }
  .ev-grid { grid-template-columns: 1fr; gap: 4px; padding: 12px 14px 30px; }
  .ev-label { padding-top: 10px; font-size: 13px; color: var(--text-muted); }
  #event-form > .error-text { margin: 0 14px 20px; }
  .dt-row { gap: 6px; }
  .sel-caltype { width: 100%; }
  .dt-pair { flex: 1 1 100%; }
  .dt-pair input { flex: 1; min-width: 0; }
  .dt-dash { display: none; }
  .sel-time { width: 120px; }
  .sel-category { width: 100%; }
  .cat-select-wrap { display: block; }

}

/* ---------- 반복 설정 ---------- */
.repeat-modal { max-width: 560px; }
.rp-grid { display: grid; grid-template-columns: 90px 1fr; gap: 14px 10px; align-items: start; padding-top: 6px; }
.rp-label { color: var(--text-muted); padding-top: 9px; font-size: 14px; }
.rp-grid select#rp-freq { width: 130px; }
.num { width: 68px; }
.rp-days { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.rp-days label, .rp-modes label, .rp-radios label { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; font-size: 14px; }
.rp-modes { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px; }
.rp-time { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.rp-time .sel-time { width: 116px; }
#rp-span { width: 84px; }
.rp-radios { display: flex; gap: 18px; padding-top: 8px; }
.rp-endrow { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.rp-caltype { padding: 8px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface-2); font-size: 14px; }
.rp-endbox { display: inline-block; width: 110px; height: 38px; background: #dedde3; border-radius: var(--radius-sm); }
.rp-summary { margin: 18px 0 4px; padding: 14px 16px; background: var(--surface-2); border-radius: var(--radius-sm); line-height: 1.7; white-space: pre-line; border-top: 1px solid var(--border); }
@media (max-width: 480px) { .rp-grid { grid-template-columns: 1fr; gap: 4px; } .rp-label { padding-top: 10px; } }

/* ---------- 일정 상세 ---------- */
.detail-modal { max-width: 460px; }
.detail-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 12px; }
.cat-bar { width: 5px; align-self: stretch; border-radius: 0; }
.detail-title-wrap { flex: 1; min-width: 0; }
.detail-cat { font-size: 12px; font-weight: 600; }
.detail-head h2 { margin: 2px 0 0; font-size: 19px; word-break: break-all; }
.detail-list { display: grid; grid-template-columns: 70px 1fr; gap: 10px 10px; margin: 0; font-size: 14px; }
.detail-list dt { color: var(--text-muted); font-size: 13px; }
.detail-list dd { margin: 0; white-space: pre-wrap; word-break: break-word; }
.detail-list dd .chip { margin: 0 4px 4px 0; }

.day-modal { max-width: 420px; }

/* ---------- 내 정보 ---------- */
.myinfo-modal { max-width: 520px; }
.section-title { font-size: 14px; margin: 8px 0 10px; padding-top: 12px; border-top: 1px solid var(--border); }
.link-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; margin-bottom: 10px; background: var(--surface-2); }
.link-card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.link-card .full { width: 100%; }
.link-card .input-group { max-width: none; }
.link-state { margin-left: auto; font-size: 12px; color: var(--text-muted); }
.link-state.on { color: #16a34a; font-weight: 600; }
.link-actions { display: flex; align-items: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.link-card p { margin: 8px 0 0; }
.svc { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 0; font-size: 13px; font-weight: 800; color: #fff; }
.svc-slack { background: #4a154b; }
.svc-kakao { background: #fee500; color: #3c1e1e; }
.svc-mail { background: #2f80ed; }
.btn-kakao { display: inline-flex; align-items: center; padding: 7px 14px; border-radius: var(--radius-sm); background: #fee500; color: #3c1e1e; font-weight: 700; font-size: 13px; text-decoration: none; }

/* ---------- 페이지(건의사항/주간일지/관리) ---------- */
.page { max-width: 1100px; margin: 0 auto; padding: 18px 18px calc(40px + env(safe-area-inset-bottom)); }
.page-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.page-title { margin: 0 12px 0 0; font-size: 20px; }
.inline-search { flex: 1; min-width: 160px; max-width: 320px; margin-left: auto; }
.inline-search input { width: 100%; }
.input-inline { width: 220px; }
.select-inline { min-width: 130px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

.board-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.board-list li { display: grid; grid-template-columns: 56px 72px 1fr 110px 100px; align-items: center; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--border); cursor: pointer; }
.board-list li:first-child { border-top: none; }
.board-list li:hover { background: var(--surface-2); }
.board-list .no { color: var(--text-muted); font-size: 12px; text-align: center; }
.board-list .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-list .title .re { color: var(--accent); font-size: 12px; font-weight: 500; margin-left: 6px; }
.board-list .who, .board-list .date { color: var(--text-muted); font-size: 12.5px; }
@media (max-width: 640px) {
  .board-list li { grid-template-columns: auto 1fr; grid-template-areas: 'status title' 'meta meta'; gap: 4px 8px; }
  .board-list .no { display: none; }
  .board-list .st { grid-area: status; }
  .board-list .title { grid-area: title; }
  .board-list .who, .board-list .date { display: inline; grid-area: meta; }
  .board-list .date { justify-self: end; }
}
.status-badge { display: inline-block; padding: 2px 8px; border-radius: 0; font-size: 11.5px; font-weight: 700; text-align: center; background: #eef1f5; color: var(--text-muted); }
.status-badge.s-접수 { background: #eef1f5; color: #4b5563; }
.status-badge.s-검토중 { background: #fff4e0; color: #9a6400; }
.status-badge.s-반영 { background: #e3f6e8; color: #15803d; }
.status-badge.s-보류 { background: #fde8e8; color: #b42318; }

.doc { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; }
.doc-head { border-bottom: 1px solid var(--border); padding-bottom: 12px; margin-bottom: 16px; }
.doc-head h2 { margin: 8px 0 6px; font-size: 20px; word-break: break-all; }
.doc-meta { color: var(--text-muted); font-size: 12.5px; }
.reply-box { margin-top: 14px; background: var(--primary-soft); border: 1px solid var(--primary-line); border-radius: var(--radius); padding: 14px 18px; }
.reply-head { font-weight: 700; color: var(--primary); margin-bottom: 8px; }
.reply-head .muted { font-weight: 400; font-size: 12px; }
.reply-controls { display: flex; gap: 12px; align-items: center; margin: 10px 0; font-size: 13px; }
.reply-controls select { margin-left: 6px; }

/* 에디터가 만든 HTML을 보여주는 영역 */
.rich { line-height: 1.7; word-break: break-word; overflow-wrap: anywhere; }
.rich img { max-width: 100%; height: auto; }
.rich table, .wz-body table { border-collapse: collapse; margin: 6px 0; max-width: 100%; }
.rich td, .rich th, .wz-body td, .wz-body th { border: 1px solid var(--border-strong); padding: 5px 8px; min-width: 40px; vertical-align: top; }
.rich blockquote, .wz-body blockquote { margin: 6px 0; padding: 4px 12px; border-left: 3px solid var(--primary-line); color: #4b5563; }
.rich h1, .wz-body h1 { font-size: 1.5em; margin: 0.5em 0 0.3em; }
.rich h2, .wz-body h2 { font-size: 1.3em; margin: 0.5em 0 0.3em; }
.rich h3, .wz-body h3 { font-size: 1.12em; margin: 0.5em 0 0.3em; }
.rich p, .wz-body p { margin: 0.2em 0; }
.rich a, .wz-body a { color: var(--accent); }
.rich hr, .wz-body hr { border: none; border-top: 1px solid var(--border-strong); margin: 10px 0; }
.rich:empty::before { content: '(내용 없음)'; color: var(--text-muted); }

/* WYSIWYG */
.wysiwyg { border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); }
.wysiwyg:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(10, 42, 75, 0.1); }
.wz-toolbar { position: sticky; top: calc(var(--header-h) + env(safe-area-inset-top)); z-index: 4; display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 6px; border-bottom: 1px solid var(--border); background: var(--surface-2); border-radius: var(--radius) var(--radius) 0 0; }
.wz-toolbar button { width: 32px; height: 30px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid transparent; background: none; border-radius: 0; cursor: pointer; font-size: 14px; color: #374151; }
.wz-toolbar button:hover { background: #e9edf2; }
.wz-toolbar button.on { background: var(--primary-soft); border-color: var(--primary-line); color: var(--primary); }
.wz-block { min-height: 30px; padding: 3px 6px; font-size: 13px; width: 86px; }
.wz-sep { width: 1px; height: 20px; background: var(--border-strong); margin: 0 4px; }
.wz-color-wrap { position: relative; }
.wz-a { font-weight: 800; border-bottom: 3px solid #d64545; line-height: 1; padding: 0 2px; }
.wz-hl { font-weight: 800; background: #fff3a3; padding: 0 3px; }
.wz-pop { position: absolute; top: 34px; left: 0; z-index: 10; display: grid; grid-template-columns: repeat(6, 22px); gap: 5px; padding: 8px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow); }
.wz-toolbar .wz-swatch { width: 22px; height: 22px; border-radius: 0; border: 1px solid rgba(0, 0, 0, 0.15); padding: 0; }
.wz-swatch.none { background: linear-gradient(135deg, #fff 45%, #d64545 45%, #d64545 55%, #fff 55%) !important; }
.wz-body { min-height: 320px; padding: 14px 16px; outline: none; line-height: 1.7; word-break: break-word; }
.wz-body img { max-width: 100%; height: auto; }
.wysiwyg.empty .wz-body::before { content: attr(data-placeholder); color: #a0aab5; position: absolute; pointer-events: none; }
@media (max-width: 767px) {
  .page { padding: 12px 12px calc(40px + env(safe-area-inset-bottom)); }
  .page-title { font-size: 18px; }
  .wz-toolbar { top: calc(86px + env(safe-area-inset-top)); }
  .wz-toolbar button { width: 30px; }
  .wz-body { min-height: 240px; }
}

/* 주간일지 */
.week-nav { display: flex; align-items: center; gap: 6px; }
.week-label { display: flex; flex-direction: column; align-items: center; min-width: 150px; line-height: 1.25; }
.week-label small { color: var(--text-muted); font-size: 12px; }
.journal-list { display: flex; flex-direction: column; gap: 12px; }
.journal-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.journal-card.mine { border-color: var(--primary-line); box-shadow: 0 0 0 1px var(--primary-line); }
.journal-card-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.journal-card-head b { font-size: 15px; }
.journal-card-head .muted { font-size: 12px; }
.journal-card-body { padding: 14px 16px; }
.journal-card-body.collapsed { max-height: 320px; overflow: hidden; position: relative; }
.journal-card-body.collapsed::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 60px; background: linear-gradient(transparent, #fff); }
.journal-more { display: block; width: 100%; border: none; border-top: 1px solid var(--border); background: none; padding: 8px; color: var(--accent); cursor: pointer; font-size: 13px; }
@media (max-width: 767px) {
  .week-nav { order: 5; width: 100%; justify-content: space-between; }
  #jn-filter { flex: 1; }
}

/* 관리 테이블 */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th, .data-table td { padding: 7px 10px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table th { background: var(--surface); color: var(--primary); font-weight: 700; font-size: 12px; border-bottom: 2px solid var(--primary); }
.data-table tbody tr { cursor: pointer; }
.data-table tbody tr:hover { background: #fafcfe; }
.data-table tbody tr.selected { background: var(--primary-soft); }
.data-table tbody tr.pending td:first-child { border-left: 3px solid #f59e0b; }
.data-table td select { min-height: 30px; padding: 3px 6px; }
.tag { display: inline-block; padding: 1px 7px; border-radius: 0; font-size: 11.5px; background: #eef1f5; color: var(--text-muted); }
.tag.on { background: #e3f6e8; color: #15803d; }
.tag.warn { background: #fff4e0; color: #9a6400; }

/* ---------- 토스트 ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  z-index: 100; max-width: 90vw; padding: 10px 18px; border-radius: 0; border-left: 4px solid var(--point);
  background: #1f2d3d; color: #fff; font-size: 13.5px; text-align: center; box-shadow: var(--shadow);
}

/* ---------- 가져오기 ---------- */
.import-btn { margin: -6px 0 16px; min-height: 38px; font-size: 13px; }
.import-modal { max-width: 480px; }
.import-sources { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.source-card { display: flex; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--border-strong); border-radius: var(--radius); cursor: pointer; }
.source-card input { position: absolute; opacity: 0; pointer-events: none; }
.source-card:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-line); background: var(--primary-soft); }
.source-card:has(input:disabled) { opacity: 0.55; cursor: not-allowed; }
.source-card b { display: block; font-size: 14px; }
.source-card small { display: block; font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }
.svc-google { background: #4285f4; }
.svc-naver { background: #03c75a; }
.field-check { display: flex; align-items: center; gap: 8px; font-size: 13px; margin: 4px 0 10px; cursor: pointer; }
.import-result { padding: 10px 12px; border-radius: var(--radius-sm); background: #e3f6e8; color: #15803d; font-size: 13px; }
.ext-badge { display: inline-block; font-size: 10px; font-weight: 800; color: #fff; border-radius: 0; padding: 0 4px; margin-left: 4px; vertical-align: 1px; }
.ext-badge.google { background: #4285f4; }
.ext-badge.naver { background: #03c75a; }

/* 캘린더 연동 입력 (내 정보 · 사용자 관리) */
.cal-links .link-card .field { margin-bottom: 8px; }
.cal-links .link-card .field input { font-size: 14px; min-height: 38px; }
.user-edit-modal { max-width: 560px; }

/* ---------- 공통코드 ---------- */
.codes-layout { display: grid; grid-template-columns: 220px 1fr; gap: 14px; align-items: start; }
.code-groups { list-style: none; margin: 0; padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.code-groups li { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-radius: var(--radius-sm); cursor: pointer; font-size: 14px; }
.code-groups li small { color: var(--text-muted); font-size: 11.5px; }
.code-groups li:hover { background: var(--surface-2); }
.code-groups li.active { background: var(--primary); color: #fff; }
.code-groups li.active small { color: rgba(255, 255, 255, 0.75); }
.code-panel-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.code-table td { padding: 6px 8px; }
.code-table input[type="text"], .code-table input[type="number"] { width: 100%; min-height: 32px; padding: 4px 8px; font-size: 13px; }
.code-table .c-sort { width: 64px; }
.code-table .c-code { width: 150px; }
.code-table .c-del { width: 40px; text-align: center; }
.code-table .row-del { border: none; background: none; color: var(--danger); cursor: pointer; font-size: 16px; }
.code-table tbody tr { cursor: default; }
@media (max-width: 767px) {
  .codes-layout { grid-template-columns: 1fr; }
  .code-groups { display: flex; overflow-x: auto; }
  .code-groups li { flex-shrink: 0; }
  .code-table .c-code { width: 110px; }
}

/* ---------- 사용자 관리 (가입 관리 통합) ---------- */
#users-table td select { min-height: 28px; padding: 2px 6px; font-size: 12px; }
#users-table tbody tr { cursor: default; }
#users-table.admin tbody tr { cursor: pointer; }
#users-table tbody tr.pending { background: #fffbeb; }
#users-table tbody tr.pending td:first-child { box-shadow: inset 3px 0 0 #f59e0b; }
#users-table tbody tr.selected { background: var(--primary-soft); }
#users-table tbody tr.selected td:first-child { box-shadow: inset 3px 0 0 var(--primary); }

/* ---------- 주간일지 ---------- */
.week-label { display: flex; flex-direction: column; line-height: 1.25; }
.week-label small { color: var(--text-muted); font-size: 11px; }

/* ---------- 일정 폼: 유지보수 항목 ---------- */
.maint-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 8px; }
.maint-row .chk { margin-left: 0; }
.maint-done-at { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }

/* ---------- 리포트 ---------- */
/* 조회줄: 모든 항목이 "라벨 한 줄 + 컨트롤 한 줄(높이 32px)"로 같은 기준선에 선다 */
.report-bar { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); margin-bottom: 8px; }
.rb-field { display: flex; flex-direction: column; gap: 4px; }
.rb-label { font-size: 12px; color: var(--text-muted); line-height: 16px; height: 16px; white-space: nowrap; }
.rb-label small { margin-left: 6px; color: var(--primary); font-weight: 600; }
.rb-control { display: flex; align-items: center; gap: 4px; height: 32px; }
.rb-control select, .rb-control input[type="date"] { height: 32px; min-height: 32px; padding-top: 0; padding-bottom: 0; }
.rb-control select { min-width: 200px; }
.rb-check { gap: 6px; font-size: 13px; cursor: pointer; }
.report-viewer { margin-top: 10px; border: 1px solid var(--border); background: var(--surface); }
.report-viewer-bar { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-bottom: 1px solid var(--border); }
#rep-frame { display: block; width: 100%; height: 75vh; border: 0; background: #525659; }
@media (max-width: 767px) { #rep-frame { height: 60vh; } }

/* PDF로 옮길 A4 가로 페이지 (1123×794px = 96dpi 기준 A4 가로). 화면 밖에서 그린 뒤 캡처한다. */
.rep-pages { position: fixed; left: -20000px; top: 0; pointer-events: none; }
.rp-page {
  position: relative; width: 1123px; height: 794px; padding: 34px 46px 30px;
  background: #fff; color: #111; font-family: "Malgun Gothic", "Apple SD Gothic Neo", sans-serif; font-size: 11px;
  display: flex; flex-direction: column;
}
.rp-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; margin-bottom: 12px; min-height: 48px; }
.rp-head .rp-meta { font-size: 11.5px; line-height: 1.6; font-family: "Malgun Gothic", monospace; }
.rp-head .rp-title { font-size: 20px; font-weight: 800; letter-spacing: 0.2em; }
.rp-head .rp-logo { justify-self: end; height: 34px; }
.rp-body { flex: 1; min-height: 0; overflow: hidden; }
.rp-foot { text-align: center; font-size: 11px; padding-top: 6px; }
.rp-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.rp-table th { background: #f2f2f2; font-weight: 600; font-size: 11px; padding: 3px 4px; border: 1px solid #222; border-width: 2px 1px 1px; text-align: center; }
.rp-table td { border: 1px solid #222; padding: 3px 5px; vertical-align: top; font-size: 11px; line-height: 1.45; overflow: hidden; word-break: break-all; }
.rp-table td.c { text-align: center; vertical-align: middle; }
.rp-i td { height: 67px; }
.rp-i .rp-line1 { display: flex; gap: 40px; }
.rp-i .rp-title-line { font-weight: 700; }
.rp-i .rp-content { color: #333; white-space: pre-wrap; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rp-ii td { height: 22.4px; white-space: nowrap; text-overflow: ellipsis; }
.rp-iii { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: auto 1fr auto 110px; border: 2px solid #222; height: 100%; }
.rp-iii .h { background: #f2f2f2; text-align: center; font-weight: 600; padding: 3px; border-bottom: 1px solid #222; }
.rp-iii .h + .h, .rp-iii .cell + .cell { border-left: 1px solid #222; }
.rp-iii .cell { padding: 8px 10px; overflow: hidden; line-height: 1.55; }
.rp-iii .full { grid-column: 1 / -1; border-top: 1px solid #222; }
.rp-iii .rich img { max-width: 100%; max-height: 220px; }
.rp-who { font-size: 11.5px; margin: -4px 0 4px; }
.rp-sum-list { margin: 0; padding-left: 16px; }
.rp-cal { width: 100%; height: 100%; border-collapse: collapse; table-layout: fixed; }
.rp-cal th { border: 1px solid #222; background: #f2f2f2; padding: 4px; font-size: 11.5px; }
.rp-cal td { border: 1px solid #222; vertical-align: top; padding: 3px 5px; font-size: 11px; }
.rp-cal td.other { background: #fafafa; color: #aaa; }
.rp-cal .dn { font-weight: 700; }
.rp-cal .sat .dn { color: #1d4ed8; }
.rp-cal .sun .dn, .rp-cal .hol .dn { color: #d00; }
.rp-cal .vac { display: block; margin-top: 2px; padding: 1px 4px; background: #fde2e7; border-left: 3px solid #e11d48; font-size: 10.5px; }
.rp-empty { color: #999; text-align: center; padding: 40px 0; }

/* ---------- 팝업 스크롤: 제목·버튼은 고정, 내용만 스크롤 (.modal-scroll) ---------- */
.modal.modal-scroll { display: flex; flex-direction: column; overflow: hidden; padding: 0; }
.modal.modal-scroll > .modal-head { margin: 0; position: static; flex: none; }
.modal.modal-scroll > form { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.modal.modal-scroll .modal-body { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 16px 6px; }
.modal.modal-scroll .modal-actions { flex: none; margin: 0; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: var(--surface); }

/* 숨김 스크롤바 — 평소엔 안 보이고, 스크롤 영역에 마우스를 올리면 나타난다 (자리는 미리 잡아 둬서 내용이 밀리지 않음) */
.modal, .modal-body, .cal-side, .tg-scroll, .list-view, .table-wrap, .suggestions {
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}
.modal:hover, .modal-body:hover, .cal-side:hover, .tg-scroll:hover, .list-view:hover, .table-wrap:hover, .suggestions:hover {
  scrollbar-color: #b6c0cc transparent;
}
.modal::-webkit-scrollbar, .modal-body::-webkit-scrollbar, .cal-side::-webkit-scrollbar, .tg-scroll::-webkit-scrollbar,
.list-view::-webkit-scrollbar, .table-wrap::-webkit-scrollbar, .suggestions::-webkit-scrollbar { width: 8px; height: 8px; }
.modal::-webkit-scrollbar-thumb, .modal-body::-webkit-scrollbar-thumb, .cal-side::-webkit-scrollbar-thumb, .tg-scroll::-webkit-scrollbar-thumb,
.list-view::-webkit-scrollbar-thumb, .table-wrap::-webkit-scrollbar-thumb, .suggestions::-webkit-scrollbar-thumb { background: transparent; }
.modal:hover::-webkit-scrollbar-thumb, .modal-body:hover::-webkit-scrollbar-thumb, .cal-side:hover::-webkit-scrollbar-thumb, .tg-scroll:hover::-webkit-scrollbar-thumb,
.list-view:hover::-webkit-scrollbar-thumb, .table-wrap:hover::-webkit-scrollbar-thumb, .suggestions:hover::-webkit-scrollbar-thumb { background: #b6c0cc; }
.modal::-webkit-scrollbar-track, .modal-body::-webkit-scrollbar-track { background: transparent; }

/* 사용자 관리: 바뀐 행 표시 */
#users-table tbody tr.changed td { background: #f0fdf4; }
#users-table tbody tr.changed td:first-child { box-shadow: inset 3px 0 0 var(--save); }
