/* ══════════════════════════════════════════════
   Church CMS · Unified Design System
   ══════════════════════════════════════════════ */

/* [hidden] 보장 — .btn 등 display 지정 클래스가 hidden 속성을 덮어쓰는 것을 차단 */
[hidden] { display: none !important; }

/* ── CSS Variables ─────────────────────────── */
:root {
  color-scheme: dark;
  --bg:       #0F1117;
  --bg2:      #1A1E2A;
  --bg3:      #222840;
  --surface:  #1A1E2A;
  --border:   #2D3344;
  --border2:  #3A4560;
  --accent:   #256EF4;
  --accent2:  #4F8EF7;
  --text:     #F1F5F9;
  --muted:    #94A3B8;
  --muted2:   #64748B;
  --red:      #DE3412;
  --green:    #228738;
  --yellow:   #F59E0B;
  --orange:   #F97316;

  --topbar-h:  56px;
  --sidebar-w: 232px;
  --radius:    12px;
  --radius-sm: 8px;
  --shadow:    0 4px 24px rgba(0,0,0,.40);
  --shadow-sm: 0 2px 8px rgba(0,0,0,.30);
  --transition: 0.18s ease;
  --sidebar-bg: #12151F;
}

/* ── Light Theme Override ───────────────────── */
html[data-theme="light"] {
  color-scheme: light;
  --bg:        #F4F6F9;
  --login-glow: #C8DCEF;
  --bg2:       #FFFFFF;
  --bg3:       #EEF1F5;
  --surface:   #FFFFFF;
  --panel:     #EEF1F5;
  --border:    #DEE3EC;
  --border2:   #C8D0DD;
  --text:      #1A2236;
  --muted:     #4A5568;
  --muted2:    #6B7280;
  --shadow:    0 4px 24px rgba(0,0,0,.10);
  --shadow-sm: 0 2px 8px rgba(0,0,0,.07);
  --sidebar-bg: #E2E8F2;
}

/* ── Reset ─────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body {
  font-family: 'Pretendard Variable', 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  height: 100%;
  overflow: hidden;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; font-size: inherit; border: none; background: none; }
input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: var(--text);
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  outline: none;
  transition: border-color var(--transition);
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,110,244,.15);
}
input::placeholder { color: var(--muted); }
:focus-visible { outline: none; box-shadow: 0 0 0 4px rgba(37,110,244,.35); }
select option { background: var(--bg3); }
input[type="checkbox"], input[type="radio"] { width: auto; padding: 0; }
.filter-bar select,
.filter-bar input[type="date"] { width: auto; min-width: 0; }

/* ── Login Screen ──────────────────────────── */
#login-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 50% 30%, var(--login-glow, #152040) 0%, var(--bg) 70%);
  z-index: 1000;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px 36px;
  box-shadow: var(--shadow);
}

.login-brand {
  text-align: center;
  margin-bottom: 32px;
}
.login-brand-mark {
  display: flex;
  justify-content: center;
  margin-bottom: 14px;
}
.login-brand-mark svg {
  filter: drop-shadow(0 4px 14px rgba(37,110,244,0.4));
}
.login-brand-name {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
  margin-bottom: 4px;
}
.login-brand-sub {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.3px;
}

.login-form .field {
  margin-bottom: 14px;
}
.login-form .field label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted2);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.login-form input {
  font-size: 15px;
  padding: 11px 14px;
  border-radius: 8px;
  background: var(--bg3);
}

.btn-login {
  width: 100%;
  margin-top: 20px;
  padding: 12px;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  border-radius: 9px;
  transition: background var(--transition), transform var(--transition);
}
.btn-login:hover  { background: var(--accent2); }
.btn-login:active { transform: scale(0.98); }

.login-err {
  margin-top: 12px;
  font-size: 13px;
  color: var(--red);
  text-align: center;
  min-height: 18px;
}

/* ── App Shell Layout ──────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ── Topbar ────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  flex-shrink: 0;
  z-index: 100;
}

.hamburger {
  width: 36px;
  height: 36px;
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}
.hamburger:hover { background: var(--border); }
.hamburger span {
  display: block;
  height: 2px;
  background: var(--muted2);
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
}
.topbar-brand-icon { display: inline-flex; align-items: center; }

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}
.topbar-user-info {
  display: flex;
  align-items: center;
  gap: 8px;
}
.topbar-username {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background var(--transition);
}
.topbar-username:hover  { background: var(--border); }
.topbar-username:active { background: var(--border2); }

/* ── 비밀번호 변경 바 ── */
.pw-change-bar  { background: var(--bg2); border-bottom: 1px solid var(--border); flex-shrink: 0; }
.pw-change-inner { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 14px; align-items: center; }
.pw-input {
  flex: 1 1 140px; min-width: 120px; padding: 5px 8px;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--bg); color: var(--text); font-size: 12px; font-family: inherit;
}
.pw-change-btns { display: flex; gap: 6px; }

.btn-logout {
  font-size: 12px;
  padding: 6px 12px;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.btn-logout:hover {
  border-color: var(--border2);
  color: var(--text);
  background: var(--border);
}
.btn-theme-toggle {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  color: var(--muted);
  transition: background var(--transition), color var(--transition);
}
.btn-theme-toggle:hover { background: var(--border); color: var(--text); }
.btn-theme-toggle::before { content: '🌙'; font-size: 15px; }
html[data-theme-mode="light"] .btn-theme-toggle::before { content: '☀️'; }
html[data-theme-mode="system"] .btn-theme-toggle::before { content: '🌓'; }
.btn-font-top {
  width: 32px; height: 32px;
  display: none;
  align-items: center; justify-content: center;
  border-radius: 50%;
  color: var(--muted);
  font-size: 12px; font-weight: 700; letter-spacing: -0.5px;
  flex-shrink: 0;
  transition: background var(--transition), color var(--transition);
}
.btn-font-top:hover { background: var(--border); color: var(--text); }
.btn-font-top::before { content: 'A+'; }
html[data-font="lg"] .btn-font-top::before { content: 'A-'; }
@media (max-width: 1024px) { .btn-font-top { display: inline-flex; } }
.btn-font-toggle {
  margin-left: auto;
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  color: var(--muted);
  flex-shrink: 0;
  transition: background var(--transition), color var(--transition);
}
.btn-font-toggle:hover { background: var(--border); color: var(--text); }
.btn-font-toggle::before { content: 'A+'; font-size: 12px; font-weight: 700; letter-spacing: -0.5px; }
html[data-font="lg"] .btn-font-toggle::before { content: 'A-'; }

/* ── Shell (sidebar + main) ────────────────── */
.shell {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}

/* ── Sidebar ───────────────────────────────── */
/* Module CSS (e.g. finance) may set .sidebar{display:none} for their own layout.
   Override with #sidebar to protect the CMS shell sidebar at all times. */
#sidebar { display: block; }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 1000;
}

.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  flex-shrink: 0;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 200;
}
.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

.sidebar-inner { padding: 12px 0 0; display: flex; flex-direction: column; height: 100%; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 0 8px; }
.sidebar-user {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.sidebar-user-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: rgba(37,110,244,.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: var(--accent2);
  flex-shrink: 0;
}
.sidebar-username { font-size: 13px; font-weight: 600; line-height: 1.3; }
.sidebar-userrole { font-size: 10px; color: var(--muted); margin-top: 1px; }

.sidebar-header {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
  font-weight: 700;
  font-size: 15px;
}
.sidebar-logo { display: inline-flex; align-items: center; }

.sidebar-nav { padding: 0 8px; }

/* ── 사이드바 그룹 접기/펼치기 ─────────────────── */
.nav-group { margin-bottom: 2px; }
.nav-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 10px 4px;
  cursor: pointer;
  user-select: none;
  border-radius: 6px;
}
.nav-group-header:hover { background: var(--bg3); }
.nav-group-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
}
.nav-group-arrow {
  font-size: 18px;
  line-height: 1;
  color: var(--muted);
  display: inline-block;
  transition: transform .2s ease;
}
.nav-group.open .nav-group-arrow { transform: rotate(90deg); }
.nav-group-items {
  overflow: hidden;
  max-height: 0;
  transition: max-height .25s ease;
}
.nav-group.open .nav-group-items { max-height: 700px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--muted2);
  font-size: 13.5px;
  font-weight: 500;
  transition: all var(--transition);
  margin-bottom: 1px;
}
.nav-item:hover {
  background: var(--border);
  color: var(--text);
}
.nav-item.active {
  background: rgba(37,110,244,.15);
  color: var(--text);
  box-shadow: inset 4px 0 0 var(--accent);
}
.nav-icon {
  width: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: .85;
}

/* ── Main Content ──────────────────────────── */
.main {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  min-width: 0;
}
.main::-webkit-scrollbar { width: 4px; }
.main::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }

.page-content {
  padding: 20px;
  min-height: 100%;
}



/* ── Home Dashboard ────────────────────────── */
.home-wrap {
  max-width: 900px;
}
.home-header {
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.home-greeting {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
}
.home-role {
  font-size: 13px;
  color: var(--muted2);
}
.accent { color: var(--accent2); }

.home-stat-group { margin-bottom: 24px; }
.home-stat-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}
.home-stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}
.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 16px;
  cursor: pointer;
  transition: border-color var(--transition), transform var(--transition);
}
.stat-card:hover {
  border-color: var(--accent);
  background: rgba(37,110,244,.06);
  transform: translateY(-2px);
}
.stat-icon { font-size: 22px; margin-bottom: 8px; }
.stat-label { font-size: 12px; color: var(--muted2); margin-bottom: 4px; }
.stat-value { font-size: 18px; font-weight: 700; color: var(--text); }

/* ── Page Loading State ────────────────────── */
.page-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 80px 0;
}

/* ── Common: Loading & Spinner ─────────────── */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  color: var(--muted);
  font-size: 13px;
}
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Empty State ───────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}
.empty-state .icon { font-size: 36px; margin-bottom: 12px; opacity: .5; }
.empty-state p { font-size: 14px; }

/* ── Toast ─────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg3);
  border: 1px solid var(--border2);
  color: var(--text);
  padding: 10px 20px;
  border-radius: 40px;
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s, transform .22s;
  white-space: nowrap;
  z-index: 9999;
  box-shadow: var(--shadow);
}
#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
#toast.error   { border-color: var(--red);   color: var(--red); }
#toast.warning { border-color: var(--yellow); color: var(--yellow); }
#toast.success { border-color: var(--green);  color: var(--green); }

/* ── Common Card / Btn (page content 공통) ── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,.20), 0 1px 2px rgba(0,0,0,.15);
  transition: border-color var(--transition);
}
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}
.page-title { font-size: 18px; font-weight: 700; }
.page-sub   { font-size: 12px; color: var(--muted); margin-top: 2px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 14px;
  height: 36px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition);
  cursor: pointer;
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent2); }
.btn-ghost {
  background: transparent;
  color: var(--muted2);
  border: 1px solid var(--border);
}
.btn-ghost:hover { border-color: var(--border2); color: var(--text); background: var(--border); }
.btn-red {
  background: transparent;
  color: var(--red);
  border: 1px solid rgba(222,52,18,.3);
}
.btn-red:hover { background: rgba(222,52,18,.12); }
/* 복구 불가능한 파괴적 동작 전용 — 채운 빨강으로 일반 버튼과 확실히 구분한다 */
.btn-danger {
  background: var(--red);
  color: #fff;
  border: 1px solid var(--red);
  font-weight: 700;
}
.btn-danger:hover:not(:disabled) { filter: brightness(.85); }
.btn-danger:disabled { opacity: .35; cursor: not-allowed; }
.btn-sm { padding: 0 10px; height: 30px; font-size: 12px; }

/* ── Form Fields ───────────────────────────── */
.field {
  margin-bottom: 12px;
}
.field label, .form-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted2);
  margin-bottom: 5px;
}
.form-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.form-row .field { flex: 1; min-width: 120px; }

/* ── Tables ─────────────────────────────────── */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
thead th {
  background: var(--bg3);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}
tbody td {
  padding: 12px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tbody tr:hover { background: rgba(37,110,244,.06); }
tbody tr:last-child td { border-bottom: none; }

/* ── Pagination ─────────────────────────────── */
.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--muted2);
  background: transparent;
  border: 1px solid var(--border);
  margin: 0 2px;
  cursor: pointer;
  transition: all var(--transition);
}
.page-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.page-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.page-btn:disabled { opacity: .35; cursor: not-allowed; }

/* ── Modals ─────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-overlay.show { display: flex; }
.modal-box {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 16px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}
.modal-box::-webkit-scrollbar { width: 3px; }
.modal-box::-webkit-scrollbar-thumb { background: var(--border2); }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 15px; font-weight: 700; }
.modal-close {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 18px;
  transition: all var(--transition);
}
.modal-close:hover { background: var(--border); color: var(--text); }
.modal-body { padding: 20px; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
}

/* ── Search Dropdown ────────────────────────── */
.search-dropdown, .acc-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  margin-top: 2px;
  z-index: 500;
  max-height: 200px;
  overflow-y: auto;
  display: none;
  box-shadow: var(--shadow-sm);
}
.search-dropdown.show, .acc-dropdown.show { display: block; }
.search-item {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  transition: background var(--transition);
}
.search-item:hover { background: var(--border); }

/* ── Selected Tag ───────────────────────────── */
.selected-tag {
  margin-top: 6px;
  padding: 5px 10px;
  background: rgba(37,110,244,.12);
  border: 1px solid rgba(37,110,244,.3);
  border-radius: 20px;
  font-size: 12px;
  color: var(--accent2);
  display: inline-block;
}

/* ── Tabs ───────────────────────────────────── */
.tab-btn {
  padding: 8px 14px;
  border-radius: 6px 6px 0 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted2);
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
}
.tab-btn.active { color: var(--accent2); border-bottom-color: var(--accent); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ── Finance: Entry tabs ────────────────────── */
.entry-tab {
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted2);
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  transition: all var(--transition);
}
.entry-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.entry-panel { border-radius: 0 var(--radius) var(--radius); margin-top: 0; }
.entry-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.entry-field label {
  display: block;
  font-size: 11px;
  color: var(--muted2);
  margin-bottom: 4px;
}
.hint { font-size: 10px; color: var(--muted); }

/* ── Finance: Account Tree ──────────────────── */
.acc-tree { font-size: 13px; }
.acc-tree-l1 {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  background: var(--bg3);
  border-radius: 6px;
  margin-bottom: 4px;
  cursor: pointer;
  font-weight: 600;
}
.acc-tree-l2, .acc-tree-l3 {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px 6px 24px;
  border-radius: 6px;
  cursor: default;
  color: var(--muted2);
}
.acc-tree-l3 { padding-left: 40px; }
.tree-children { overflow: hidden; }
.tree-children:not(.open) { display: none; }
.tree-toggle { transition: transform var(--transition); font-size: 10px; color: var(--muted); }
.acc-tree-l1.open .tree-toggle { transform: rotate(90deg); }
.acc-tree-item-actions { margin-left: auto; display: flex; gap: 4px; }

.tag-l1, .tag-l2 {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 4px;
  font-weight: 700;
}
.tag-l1 { background: rgba(37,110,244,.2); color: var(--accent2); }
.tag-l2 { background: rgba(34,197,94,.15); color: #4ade80; }
.acc-code { font-family: 'DM Mono', monospace; font-size: 11px; color: var(--muted); }

/* ── Photo / Profile ────────────────────────── */
.photo-wrap {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg3);
  border: 2px solid var(--border2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: var(--muted);
}
.photo-wrap img { width: 100%; height: 100%; object-fit: cover; }

/* ── Misc ───────────────────────────────────── */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--muted); }
.text-accent { color: var(--accent2); }
.text-red    { color: var(--red); }
.text-green  { color: var(--green); }
.fw-bold { font-weight: 700; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-8   { margin-top: 8px; }
.mt-12  { margin-top: 12px; }
.mb-8   { margin-bottom: 8px; }
.mb-12  { margin-bottom: 12px; }

/* ── Responsive ─────────────────────────────── */
@media (max-width: 768px) {
  :root { --sidebar-w: 248px; }

  .hamburger { display: flex; }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: var(--shadow);
    z-index: 1100;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.visible { display: block; }

  .sidebar-header { display: flex; }

  .page-content { padding: 14px; }

  .entry-grid { grid-template-columns: 1fr; }
  .form-row   { flex-direction: column; }
}

@media (min-width: 769px) {
  .topbar-brand { display: flex; }
}

@media (max-width: 480px) {
  .home-stat-row { grid-template-columns: 1fr 1fr; }
  .modal-box { max-height: 95vh; }
}

/* ── 홈포털 공통 ─────────────────────────────────── */
/* 공지사항 카테고리 탭 */
.hn-cat-row { display:flex; gap:6px; flex-wrap:wrap; margin-bottom:12px; }
.hn-cat {
  padding: 4px 14px; border-radius: 20px; font-size: 13px; font-weight: 500; cursor: pointer;
  border: 1px solid var(--border); background: var(--bg2); color: var(--muted);
  transition: background .15s, color .15s;
}
.hn-cat.active, .hn-cat:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

/* 공지 카테고리 태그 */
.tag-assoc  { background: rgba(37,110,244,.15); color: var(--accent);  font-size:11px; padding:1px 6px; border-radius:4px; font-weight:600; }
.tag-jungbu { background: rgba(34,197,94,.15);  color: #4ade80;        font-size:11px; padding:1px 6px; border-radius:4px; font-weight:600; }
.tag-nambu  { background: rgba(251,146,60,.15); color: #fb923c;        font-size:11px; padding:1px 6px; border-radius:4px; font-weight:600; }
.tag-sales  { background: rgba(167,139,250,.15);color: #a78bfa;        font-size:11px; padding:1px 6px; border-radius:4px; font-weight:600; }

/* 업무일지 월 네비게이션 */
.hw-nav-row { display:flex; align-items:center; gap:8px; margin-bottom:12px; flex-wrap:wrap; }
.hw-month-title { font-size:16px; font-weight:700; min-width:100px; text-align:center; }
.hw-vtoggle { opacity:.55; }
.hw-vtoggle.active { opacity:1; }

/* 업무일지 달력 */
.hw-cal-head {
  display: grid; grid-template-columns: repeat(7, 1fr);
  font-size: 11px; font-weight: 600; color: var(--muted);
  padding: 8px 8px 4px; border-bottom: 1px solid var(--border);
  text-align: center;
}
.hw-cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; padding: 6px;
}
.hw-cell {
  min-height: 52px; border-radius: 6px; padding: 4px 6px;
  cursor: pointer; display: flex; flex-direction: column; align-items: flex-start;
  transition: background .15s;
  border: 1px solid transparent;
}
.hw-cell:hover { background: var(--bg3); }
.hw-cell-empty { cursor: default; }
.hw-cell.hw-today .hw-day { color: var(--accent); font-weight: 700; }
.hw-cell.hw-selected { border-color: var(--accent); background: rgba(37,110,244,.08); }
.hw-day { font-size: 13px; }
.hw-dot { width:6px; height:6px; border-radius:50%; background:var(--accent); margin-top:4px; }

/* 업무일지 상세 패널 */
.hw-detail-panel { margin-top: 12px; }
.hw-detail-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.hw-detail-date { font-size: 15px; font-weight: 700; }
.hw-textarea {
  width: 100%; min-height: 100px; resize: vertical; padding: 10px;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--bg2); color: var(--text); font-size: 13px;
  font-family: inherit; line-height: 1.6;
}
.hw-textarea:focus { border-color: var(--accent); outline: none; }
.hw-detail-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

/* 업무일지 타인 항목 */
.hw-entry-item {
  padding: 8px 10px; border-radius: 6px;
  background: var(--bg3); margin-bottom: 8px;
}
.hw-entry-who { font-size: 11px; color: var(--muted); display: block; margin-bottom: 4px; }
.hw-entry-body { font-size: 13px; white-space: pre-wrap; line-height: 1.5; }

/* 모바일 대응 */
@media (max-width: 600px) {
  .hw-cell { min-height: 40px; }
  .hw-day  { font-size: 12px; }
}

/* ── Home Portal (3-panel) ──────────────────────── */

/* modal-overlay.open: 홈포털이 classList.add('open')으로 모달 열기 */
.modal-overlay.open { display: flex !important; }

/* 누락 CSS 변수 별칭 */
:root { --text-sub: var(--muted); }

/* TODO FAB */
.todo-fab {
  position: fixed; bottom: 28px; right: 28px; z-index: 300;
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--accent); color: #fff;
  font-size: 22px; font-weight: 700; border: none; cursor: pointer;
  box-shadow: 0 4px 16px rgba(59,125,232,.4);
  display: none; /* renderHome 이후에 표시 */
  align-items: center; justify-content: center;
  transition: transform .15s, box-shadow .15s;
}
.todo-fab:hover { transform: scale(1.07); }
.cms-home-portal ~ .todo-fab,
.hp-body ~ .todo-fab { display: flex; }
/* page-content 안에 .cms-home-portal 가 있을 때 FAB 표시 */
#page-content:has(.cms-home-portal) ~ * .todo-fab,
body:has(.cms-home-portal) .todo-fab { display: flex; }

/* TODO 패널 */
.todo-panel {
  position: fixed; inset: 0; z-index: 400;
  background: rgba(0,0,0,.45); display: none; align-items: flex-end; justify-content: flex-end;
}
.todo-panel.open { display: flex; }
.todo-panel-box {
  background: var(--card, var(--bg2)); border-radius: 14px 14px 0 0;
  width: 360px; max-width: 100vw;
  max-height: 70vh; display: flex; flex-direction: column;
  box-shadow: 0 -4px 32px rgba(0,0,0,.22);
  margin-right: 16px;
}
.todo-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 10px; border-bottom: 1px solid var(--border);
}
.todo-panel-title { font-weight: 700; font-size: 15px; }
.todo-input-wrap { display: flex; gap: 8px; padding: 10px 14px; }
.todo-input {
  flex: 1; padding: 7px 10px; border: 1px solid var(--border);
  border-radius: 6px; background: var(--bg2); color: var(--text);
  font-size: 13px; font-family: inherit;
}
.todo-list { flex: 1; overflow-y: auto; padding: 4px 14px; }
.todo-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 4px; border-bottom: 1px solid var(--border);
}
.todo-item input[type="checkbox"] { flex-shrink: 0; }
.todo-item label { flex: 1; font-size: 13px; cursor: pointer; }
.todo-item.done label { text-decoration: line-through; color: var(--muted); }
.todo-item .todo-del {
  background: none; border: none; color: var(--muted); cursor: pointer;
  font-size: 16px; padding: 0 4px;
}
.todo-panel-foot {
  padding: 10px 14px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end;
}

/* 통계 바 */
.hp-stats-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 6px 16px; background: var(--bg2);
  border-bottom: 1px solid var(--border);
  font-size: 12px; flex-shrink: 0; min-height: 36px;
  overflow: hidden;
}
.hp-sb-left  { display: flex; gap: 6px; align-items: center; color: var(--muted); }
.hp-sep      { color: var(--border); }
.hp-sb-mid   { display: flex; gap: 8px; flex: 1; justify-content: center; flex-wrap: wrap; }
.hp-sb-right { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.hp-chip     { background: var(--bg3); border-radius: 20px; padding: 2px 8px; white-space: nowrap; }
.hp-role     { font-size: 11px; color: var(--muted); }

/* 모바일 탭 (≤1100px에서 표시) */
.hp-mobile-tabs {
  display: none; gap: 0; background: var(--bg2);
  border-bottom: 2px solid var(--border); flex-shrink: 0;
}
.hp-mtab {
  flex: 1; padding: 10px 0; border: none; background: none;
  color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer;
}
.hp-mtab.active { color: var(--accent); border-bottom: 2px solid var(--accent); margin-bottom: -2px; }

/* 3-panel body */
.cms-home-portal {
  display: flex; flex-direction: column;
  height: calc(100vh - var(--topbar-h, 52px));
  overflow: hidden;
}
.hp-body {
  display: flex; flex: 1; overflow: hidden;
}
.hp-panel {
  display: flex; flex-direction: column;
  border-right: 1px solid var(--border);
  overflow: hidden; background: var(--bg2);
}
.hp-panel:last-child { border-right: none; }
.notices-panel { flex: 0 0 310px; min-width: 220px; }
.cal-panel     { flex: 1 1 0; min-width: 260px; }
.mail-panel    { flex: 0 0 270px; min-width: 200px; }

/* 패널 헤더 */
.hp-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.hp-panel-title { font-weight: 700; font-size: 14px; }
.btn-write {
  padding: 4px 10px; border-radius: 6px; font-size: 12px; font-weight: 600;
  background: var(--accent); color: #fff; border: none; cursor: pointer;
}
.btn-write:hover { opacity: .88; }
.mail-disconnect {
  font-size: 11px; color: var(--muted); background: none; border: none; cursor: pointer;
}

/* 카테고리 탭 */
.cat-tabs {
  display: flex; gap: 0; border-bottom: 1px solid var(--border); flex-shrink: 0; overflow-x: auto;
}
.cat-tab {
  flex-shrink: 0; padding: 7px 12px; font-size: 12px; font-weight: 600;
  color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.cat-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* 공지 검색 */
.notice-search-wrap {
  display: flex; align-items: center; padding: 6px 10px;
  border-bottom: 1px solid var(--border); gap: 4px; flex-shrink: 0;
}
.notice-search-input {
  flex: 1; border: 1px solid var(--border); border-radius: 6px;
  padding: 5px 8px; background: var(--bg); color: var(--text);
  font-size: 12px; font-family: inherit;
}
.notice-search-clear {
  background: none; border: none; color: var(--muted); cursor: pointer; font-size: 14px; padding: 2px 4px;
}

/* 공지 목록 */
.notices-list { flex: 1; overflow-y: auto; }
.notice-item {
  padding: 10px 12px; border-bottom: 1px solid var(--border); cursor: pointer;
}
.notice-item:hover { background: var(--bg3); }
.notice-item.pinned { background: rgba(59,125,232,.06); }
.notice-item-head { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; flex-wrap: wrap; }
.notice-cat {
  font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 4px;
}
.cat-assoc   { background: rgba(59,125,232,.18); color: var(--accent); }
.cat-jungbu  { background: rgba(128,90,213,.18); color: #805AD5; }
.cat-nambu   { background: rgba(56,161,105,.18); color: #38a169; }
.cat-sales   { background: rgba(221,128,48,.18); color: #DD8030; }
.pin-mark    { font-size: 12px; }
.badge-new   { font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 4px; background: rgba(224,64,64,.15); color: var(--red); }
.notice-title{ font-size: 13px; font-weight: 600; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notice-meta { display: flex; gap: 8px; font-size: 11px; color: var(--muted); margin-top: 3px; flex-wrap: wrap; }
.empty       { padding: 32px; text-align: center; color: var(--muted); font-size: 13px; }

/* 공지 상세 슬라이드 패널 */
.notice-detail-panel {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg2); z-index: 10;
  transform: translateX(100%); transition: transform .22s ease; display: flex; flex-direction: column;
}
.notice-detail-panel.open { transform: translateX(0); }
.notices-panel { position: relative; }
.ndp-head {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.ndp-back {
  background: none; border: none; font-size: 18px; cursor: pointer; color: var(--accent); padding: 0 4px;
}
.ndp-head-title { font-weight: 700; font-size: 14px; }
.ndp-body { flex: 1; overflow-y: auto; padding: 14px; }
.ndp-title { font-size: 16px; font-weight: 700; line-height: 1.4; margin-bottom: 8px; }
.ndp-meta  { display: flex; gap: 8px; flex-wrap: wrap; font-size: 11px; color: var(--muted); margin-bottom: 14px; }
.ndp-content { font-size: 13px; line-height: 1.7; white-space: pre-wrap; }
.ndp-actions { display: flex; gap: 8px; justify-content: flex-end; padding: 10px 12px; border-top: 1px solid var(--border); flex-shrink: 0; }

/* 달력 */
.cal-panel { position: relative; }
.cal-head  { flex-direction: column; align-items: stretch; gap: 6px; }
.cal-nav-row { display: flex; align-items: center; gap: 8px; }
.cal-nav-center { display: flex; align-items: center; gap: 6px; }
.cal-nav {
  background: none; border: 1px solid var(--border); border-radius: 6px;
  padding: 3px 8px; font-size: 18px; cursor: pointer; color: var(--text); line-height: 1;
}
.cal-title { font-weight: 700; font-size: 15px; min-width: 80px; text-align: center; }
.cal-view-toggle { display: flex; gap: 4px; margin-left: auto; }
.cal-vtoggle {
  background: none; border: 1px solid var(--border); border-radius: 6px;
  padding: 4px 8px; cursor: pointer; font-size: 14px;
}
.cal-vtoggle.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.cal-legend { display: flex; gap: 10px; font-size: 11px; color: var(--muted); }
.lg { display: flex; align-items: center; gap: 4px; }
.cal-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-event    { background: var(--accent); }
.dot-schedule { background: var(--green); }
.dot-worklog  { background: var(--orange); }
.wl-filter-bar { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.wl-filter-label { font-size: 12px; color: var(--muted); }
.wl-day-input {
  width: 70px; padding: 4px 6px; border: 1px solid var(--border); border-radius: 5px;
  background: var(--bg); color: var(--text); font-size: 12px;
}
.cal-wrap { flex: 1; overflow-y: auto; padding: 8px; }
.cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.cal-grid-head {
  display: grid; grid-template-columns: repeat(7, 1fr);
  font-size: 11px; font-weight: 700; color: var(--muted); text-align: center;
  padding: 0 8px 4px;
}
.cal-day {
  min-height: 68px; padding: 4px; border-radius: 6px; cursor: pointer;
  border: 1px solid transparent; font-size: 12px; position: relative;
  display: flex; flex-direction: column; align-items: center;
}
.cal-day:hover { background: var(--bg3); }
.cal-day.today { background: rgba(59,125,232,.10); border-color: var(--accent); }
.cal-day.other-month .cal-dn { color: var(--muted); opacity: .45; }
.cal-day.selected { background: rgba(59,125,232,.18); }
.cal-dn { font-weight: 600; font-size: 12px; text-align: center; }
.cal-dots { display: flex; gap: 2px; flex-wrap: wrap; margin-top: 4px; }
.cal-day-items { font-size: 10px; line-height: 1.3; overflow: hidden; }
.cal-ev-chip  { font-size: 10px; padding: 1px 4px; border-radius: 3px; background: rgba(59,125,232,.2); color: var(--accent); margin-bottom: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-sc-chip  { font-size: 10px; padding: 1px 4px; border-radius: 3px; background: rgba(56,161,105,.2); color: var(--green); margin-bottom: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-wl-dot   { width: 6px; height: 6px; border-radius: 50%; background: var(--orange); display: inline-block; }
/* 홈포털 달력 칩: 줄바꿈 허용, 가운데 정렬 */
.cal-chip {
  display: block; font-size: 10px; padding: 1px 4px; border-radius: 3px;
  color: #fff; font-weight: 700; margin-bottom: 1px;
  text-align: center; word-break: break-word; line-height: 1.4;
}

/* 날짜 상세 패널 */
.day-detail {
  position: absolute; top: 0; right: 0; bottom: 0; width: 280px;
  background: var(--bg2); border-left: 1px solid var(--border);
  z-index: 10; display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .22s ease;
}
.day-detail.open { transform: translateX(0); }
.dd-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.dd-date { font-weight: 700; font-size: 14px; }
.dd-body { flex: 1; overflow-y: auto; padding: 10px; }
.dd-section { margin-bottom: 14px; }
.dd-sec-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; font-weight: 600; font-size: 13px; }
.dd-add { background: none; border: none; color: var(--accent); font-size: 16px; cursor: pointer; padding: 0 2px; }
.wf-textarea {
  width: 100%; min-height: 80px; resize: vertical; padding: 8px;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--bg); color: var(--text); font-size: 12px; font-family: inherit;
}
.wf-textarea:focus { border-color: var(--accent); outline: none; }
.wf-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 6px; }
.wl-list { flex: 1; overflow-y: auto; }
.wl-list-box {
  padding: 10px 12px; border-bottom: 1px solid var(--border); cursor: pointer;
}
.wl-list-box:hover { background: var(--bg3); }

/* 메일 패널 */
.mail-connect-prompt { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 32px 16px; flex: 1; }
.mcp-icon { font-size: 36px; }
.mcp-text { font-size: 13px; color: var(--muted); text-align: center; line-height: 1.6; }
.mail-filter-bar { display: flex; gap: 6px; padding: 6px 10px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.mail-label-sel { flex: 1; padding: 4px 6px; border: 1px solid var(--border); border-radius: 5px; background: var(--bg2); color: var(--text); font-size: 12px; }
.mail-filter-bar input { flex: 1; padding: 4px 8px; border: 1px solid var(--border); border-radius: 5px; background: var(--bg); color: var(--text); font-size: 12px; }
.mail-list { flex: 1; overflow-y: auto; }
.mail-item { padding: 10px 12px; border-bottom: 1px solid var(--border); cursor: pointer; }
.mail-item:hover { background: var(--bg3); }
.mail-item.unread .mail-subject { font-weight: 700; }
.mail-subject { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-meta    { display: flex; gap: 8px; font-size: 11px; color: var(--muted); margin-top: 2px; }
.mail-paging  { display: flex; gap: 8px; justify-content: center; padding: 8px; border-top: 1px solid var(--border); flex-shrink: 0; }
.mail-account { font-size: 11px; color: var(--muted); font-weight: 400; }
.wx-popover {
  position: fixed; right: 80px; top: 48px; z-index: 500;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 16px; box-shadow: var(--shadow);
  font-size: 13px; min-width: 160px;
}
.wx-row { display: flex; justify-content: space-between; gap: 16px; padding: 3px 0; }

/* 모바일 반응형 (≤1100px) */
@media (max-width: 1100px) {
  .hp-mobile-tabs { display: flex; }
  .notices-panel { flex: 0 0 280px; }
  .mail-panel { display: none; }
  .hp-body.mv-notices .notices-panel { display: flex; }
  .hp-body.mv-notices .cal-panel    { display: none; }
  .hp-body.mv-calendar .notices-panel { display: none; }
  .hp-body.mv-calendar .cal-panel    { display: flex; }
  .hp-body.mv-mail .notices-panel { display: none; }
  .hp-body.mv-mail .cal-panel    { display: none; }
  .hp-body.mv-mail .mail-panel   { display: flex; flex: 1; }
}
@media (max-width: 768px) {
  .hp-stats-bar { padding: 4px 10px; font-size: 11px; }
  .hp-sb-mid { display: none; }
  .notices-panel { flex: 1; }
  .day-detail { width: 100%; }
  .todo-fab { bottom: 18px; right: 18px; }
}

/* ── 공지 파일업로드 (모달 + 상세) ── */
.nm-upload-btn { cursor: pointer; display: inline-block; }
.nm-files-pending { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.nm-file-row {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 8px; background: var(--bg3);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 12px;
}
.nm-file-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nm-file-rm { background: none; border: none; cursor: pointer; color: var(--red); font-size: 13px; padding: 0 3px; }
.ndp-file-del { background: none; border: none; cursor: pointer; color: var(--red); font-size: 12px; padding: 0 3px; flex-shrink: 0; }
.ndp-upload-btn { cursor: pointer; display: inline-block; margin-top: 6px; }

/* ── 날짜 상세: 행사/일정 항목 ── */
.dd-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; background: var(--bg3);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  margin-bottom: 4px;
}
.dd-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--accent); }
.dd-item-title { flex: 1; min-width: 0; font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd-item-actions { display: flex; gap: 2px; flex-shrink: 0; }
.dd-empty { font-size: 12px; color: var(--muted); padding: 4px 2px; }
.dd-ev-desc {
  font-size: 12px; color: var(--muted); padding: 4px 10px 6px;
  white-space: pre-wrap; word-break: break-word; line-height: 1.5;
}
.dd-ev-recurrence {
  flex-shrink: 0; font-size: 10px; font-weight: 700; color: var(--muted);
  padding: 1px 5px; border-radius: 8px; background: var(--bg2);
}
.dd-ev-link { flex-shrink: 0; font-size: 11px; color: var(--accent); text-decoration: none; }
.dd-ev-link:hover { text-decoration: underline; }

/* ── 공지 첨부파일 ── */
.ndp-files {
  display: flex; flex-direction: column; gap: 8px;
  margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border);
}
.ndp-file-size { font-size: 11px; color: var(--muted); flex-shrink: 0; }

/* ── 공지 첨부파일 인라인 뷰어 (CMS 홈포털) ── */
.ndp-file-item {
  display: flex; flex-direction: column;
  border: 1px solid var(--border); border-radius: var(--radius);
  margin-bottom: 10px; overflow: hidden;
}
.ndp-file-title {
  padding: 7px 12px; font-size: 13px; font-weight: 600;
  background: var(--bg3); border-top: 1px solid var(--border);
  word-break: break-all;
}
.ndp-file-img {
  display: block; max-width: 100%;
  max-height: min(280px, 30vh);
  object-fit: contain; background: var(--bg);
}
.ndp-file-pdf {
  display: block; width: 100%;
  height: min(320px, 32vh);
  border: none;
}
/* 엑셀(xlsx) 표 미리보기 — 넓은 표는 컨테이너 안에서만 가로 스크롤 */
.ndp-file-sheet {
  max-height: min(320px, 32vh); overflow: auto;
  background: var(--bg); padding: 8px;
  font-size: 12px; color: var(--muted);
}
.ndp-sheet-table { border-collapse: collapse; white-space: nowrap; }
.ndp-sheet-table th,
.ndp-sheet-table td {
  border: 1px solid var(--border); padding: 4px 8px;
  font-size: 12px; text-align: left; color: var(--text);
}
.ndp-sheet-table th {
  background: var(--bg3); font-weight: 700;
  position: sticky; top: 0;
}
.ndp-sheet-more { margin-top: 6px; font-size: 11px; color: var(--muted); }
.ndp-file-meta {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 6px 12px; background: var(--bg3);
  border-top: 1px solid var(--border);
}
.ndp-file-size { font-size: 11px; color: var(--muted); margin-right: auto; }
.ndp-file-dl {
  color: var(--accent); text-decoration: none; font-size: 12px; font-weight: 600;
  padding: 3px 8px; border-radius: 6px; border: 1px solid var(--accent);
  flex-shrink: 0;
}
.ndp-file-dl:hover { background: rgba(59,125,232,.12); }
.ndp-dl-toggle {
  font-size: 11px; padding: 2px 8px; border-radius: 10px; border: none;
  cursor: pointer; flex-shrink: 0; font-weight: 600;
}
.ndp-dl-toggle.allowed { background: rgba(56,161,105,.15); color: var(--green); }
.ndp-dl-toggle.denied  { background: rgba(224,64,64,.12); color: var(--red); }
.nm-file-dl-label { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 4px; cursor: pointer; }

/* ── 모달 폼 필드 ── */
.field-label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.field-row { display: flex; gap: 10px; }
.field-col { flex: 1; min-width: 0; }
.field-color { flex: 0 0 58px; }
.field-check { display: flex; align-items: center; gap: 7px; font-size: 13px; cursor: pointer; color: var(--text); }
.field-check input { width: 15px; height: 15px; accent-color: var(--accent); }
.field-check-inline { display: flex; align-items: center; gap: 5px; font-size: 13px; color: var(--text); cursor: pointer; }
.field-check-inline input { width: 14px; height: 14px; accent-color: var(--accent); }

/* ── 행사 모달: 반복·참석자 ── */
.ev-recurrence-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.ev-attendee-wrap { position: relative; }
.ev-attendee-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.ev-attendee-chips:not(:empty) { margin-bottom: 6px; }
.ev-at-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 6px 2px 9px; border-radius: 10px;
  font-size: 12px; font-weight: 600; color: var(--accent);
  background: rgba(59,125,232,.12);
}
.ev-at-rm { background: transparent; border: none; cursor: pointer; padding: 0 1px; color: var(--accent); font-size: 11px; }
.ev-at-rm:hover { color: var(--red); }
.ev-attendee-dd {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 20;
  margin-top: 3px; max-height: 160px; overflow-y: auto;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow);
}
.ev-at-opt { padding: 8px 12px; font-size: 13px; color: var(--text); cursor: pointer; }
.ev-at-opt:hover { background: var(--bg3); color: var(--accent); }

/* ── 목록뷰 월간/주간 모드 탭 ── */
.wl-mode-tabs { display: flex; gap: 4px; flex-shrink: 0; }
.wl-mode-tab {
  padding: 4px 11px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--bg); color: var(--muted);
  font-size: 12px; font-weight: 600; cursor: pointer; font-family: inherit;
  transition: all .12s;
}
.wl-mode-tab:hover { border-color: var(--accent); }
.wl-mode-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.wl-inline-filter { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* ── 업무일지 태그 ── */
.wf-tags-input {
  width: 100%; padding: 6px 10px; margin-top: 5px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--text); font-size: 12px; font-family: inherit;
}
.wf-tags-input:focus { border-color: var(--accent); outline: none; }

/* ── 업무일지 첨부·댓글 ── */
.wf-sub-section {
  margin-top: 6px; padding-top: 8px; border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 6px;
}
.wf-sub-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; font-weight: 700; color: var(--muted);
}
.wf-upload-btn { cursor: pointer; }
.wf-files-list { display: flex; flex-direction: column; gap: 4px; }
.wf-file-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; background: var(--bg3);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.wf-file-link {
  flex: 1; min-width: 0; font-size: 12px; color: var(--accent); text-decoration: none;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.wf-file-link:hover { text-decoration: underline; }
.wf-file-size { font-size: 11px; color: var(--muted); flex-shrink: 0; }
.wf-file-del { background: none; border: none; cursor: pointer; color: var(--red); font-size: 12px; padding: 1px 3px; }
.wf-comments-list { display: flex; flex-direction: column; gap: 5px; }
.cmt-item {
  padding: 7px 9px; background: var(--bg3);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.cmt-reply { margin-left: 14px; }
.cmt-head { display: flex; align-items: baseline; gap: 6px; margin-bottom: 3px; }
.cmt-author { font-size: 12px; font-weight: 700; color: var(--text); }
.cmt-date { font-size: 11px; color: var(--muted); }
.cmt-content { font-size: 12px; color: var(--text); line-height: 1.5; word-break: break-word; }
.cmt-acts { display: flex; gap: 8px; margin-top: 4px; }
.cmt-act { background: none; border: none; cursor: pointer; padding: 0; font-size: 11px; font-weight: 600; color: var(--accent); font-family: inherit; }
.cmt-act:hover { text-decoration: underline; }
.cmt-act.danger { color: var(--red); }
.cmt-empty { font-size: 12px; color: var(--muted); padding: 4px 2px; }
.wf-cmt-input-wrap { display: flex; gap: 5px; }
.wf-cmt-input {
  flex: 1; min-width: 0; padding: 6px 9px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--text); font-size: 12px; font-family: inherit;
}
.wf-cmt-input:focus { border-color: var(--accent); outline: none; }

/* ── Print ──────────────────────────────────────── */
@media print {
  .sidebar, .sidebar-overlay, .topbar, .top-bar, .modal-overlay { display: none !important; }
  html, body { overflow: visible !important; height: auto !important; }
  .main { overflow: visible !important; height: auto !important; }
  .page-content { padding: 0 !important; }
  .no-print { display: none !important; }
  .print-only { display: block !important; }
}

/* desktopOnly 메뉴 항목 — 모바일에서 숨김 (app-ui.js renderMenu 가 클래스 부여).
   사이드바는 모듈과 무관하게 항상 떠 있으므로 모듈 CSS가 아니라 여기 있어야 한다.
   교적부처럼 화면 안에 PDF를 그려야 하는 페이지가 대상. */
@media (max-width: 767px) {
  .nav-item.desktop-only,
  .bnav-item.desktop-only { display: none; }
}
