/* ═══════════════════════════════════════════
   SeMIS v2 — Design System
   심플 · 모던 · 전문적 · 반응형
   ═══════════════════════════════════════════ */
:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-2: #64748b;
  --text-3: #94a3b8;
  --primary: #1d4ed8;
  --primary-dark: #1e40af;
  --primary-soft: #eff6ff;
  --accent: #0ea5e9;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --success: #16a34a;
  --warning: #d97706;
  --sidebar-bg: #0f172a;
  --sidebar-text: #cbd5e1;
  --sidebar-hover: #1e293b;
  --sidebar-active: #1d4ed8;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(15,23,42,.08), 0 4px 16px rgba(15,23,42,.06);
  --shadow-lg: 0 8px 32px rgba(15,23,42,.18);
  --header-h: 56px;
  --sidebar-w: 250px;
  --font: "Pretendard", -apple-system, BlinkMacSystemFont, "Segoe UI", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 15px; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.55; -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: .95rem; }
.hidden { display: none !important; }

/* ═══════ 로그인 ═══════ */
.login-overlay {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 55%, #1d4ed8 130%);
  padding: 20px;
}
.login-card {
  width: 100%; max-width: 380px; background: var(--surface);
  border-radius: 16px; padding: 40px 32px 28px; text-align: center;
  box-shadow: var(--shadow-lg);
  animation: rise .4s ease;
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.login-logo { font-size: 2.6rem; }
.login-logo img { height: 84px; display: inline-block; }
.login-title { font-size: 1.7rem; letter-spacing: -.5px; margin-top: 6px; }
.login-title span { color: var(--primary); }
.login-sub { color: var(--text-2); font-size: .82rem; margin: 8px 0 24px; }
.login-input-wrap { position: relative; margin-bottom: 12px; }
.login-input-wrap input {
  width: 100%; padding: 13px 44px 13px 14px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 1rem; outline: none; transition: border-color .15s;
}
.login-input-wrap input:focus { border-color: var(--primary); }
.pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: none; border: none; font-size: 1.1rem; color: var(--text-3); padding: 6px;
}
.login-btn { width: 100%; padding: 13px; font-size: 1rem; }
.login-error { color: var(--danger); font-size: .85rem; min-height: 1.3em; margin-top: 10px; }
.login-foot { margin-top: 18px; font-size: .74rem; color: var(--text-3); }

/* ═══════ 앱 레이아웃 ═══════ */
.app { min-height: 100vh; }

.header {
  position: fixed; top: 0; left: 0; right: 0; height: var(--header-h); z-index: 200;
  display: flex; align-items: center; gap: 10px; padding: 0 16px;
  background: var(--sidebar-bg); color: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
}
.icon-btn {
  background: none; border: none; color: #e2e8f0; font-size: 1.25rem;
  padding: 6px 10px; border-radius: var(--radius-sm); line-height: 1;
}
.icon-btn:hover { background: rgba(255,255,255,.12); }
.brand { display: flex; align-items: baseline; gap: 8px; color: #fff; }
.brand-logo { font-size: 1.2rem; align-self: center; display: flex; align-items: center; }
.brand-logo img { height: 30px; display: block; filter: drop-shadow(0 1px 2px rgba(0,0,0,.35)); }
.brand-text { font-size: 1.15rem; font-weight: 700; letter-spacing: -.3px; }
.brand-text b { color: #60a5fa; }
.brand-sub { font-size: .74rem; color: #94a3b8; }
.header-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.user-chip { font-size: .82rem; color: #cbd5e1; background: rgba(255,255,255,.09); padding: 5px 12px; border-radius: 20px; white-space: nowrap; }

.sec-badge {
  font-size: .78rem; font-weight: 700; padding: 5px 12px; border-radius: 20px;
  background: #334155; color: #fff; white-space: nowrap; cursor: default;
}
.sec-badge[data-level="평시"] { background: #16a34a; }
.sec-badge[data-level="관심"] { background: #2563eb; }
.sec-badge[data-level="주의"] { background: #ca8a04; }
.sec-badge[data-level="경계"] { background: #ea580c; }
.sec-badge[data-level="심각"] { background: #dc2626; }

/* 사이드바 */
.sidebar {
  position: fixed; top: var(--header-h); bottom: 0; left: 0; width: var(--sidebar-w); z-index: 150;
  background: var(--sidebar-bg); color: var(--sidebar-text);
  display: flex; flex-direction: column;
  overflow-y: auto; transition: transform .22s ease;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: #334155; border-radius: 2px; }
.nav-menu { flex: 1; padding: 12px 10px 20px; }

.nav-group-label {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; background: none; border: none; text-align: left;
  padding: 9px 12px; margin-top: 6px;
  color: #7d8ea8; font-size: .72rem; font-weight: 700; letter-spacing: .08em;
  border-radius: var(--radius-sm);
}
.nav-group-label:hover { color: #cbd5e1; }
.nav-group-label .chev { transition: transform .18s; font-size: .65rem; }
.nav-group.collapsed .chev { transform: rotate(-90deg); }
.nav-group.collapsed .nav-group-items { display: none; }

.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 12px; margin: 1px 0; border-radius: var(--radius-sm);
  color: var(--sidebar-text); font-size: .89rem; cursor: pointer;
  border: none; background: none; width: 100%; text-align: left;
}
.nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item.active { background: var(--sidebar-active); color: #fff; font-weight: 600; }
.nav-item .nav-ico { width: 20px; text-align: center; flex-shrink: 0; }
.nav-item .ext-mark { margin-left: auto; font-size: .68rem; color: #64748b; }
.nav-sep { border-top: 1px solid #1e293b; margin: 8px 12px; }

.sidebar-foot { padding: 14px 20px; font-size: .7rem; color: #475569; border-top: 1px solid #1e293b; }
.sidebar-backdrop { display: none; }

/* 메인 */
.main { margin-left: var(--sidebar-w); padding-top: var(--header-h); min-height: 100vh; }
.view { padding: 24px; max-width: 1180px; margin: 0 auto; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ═══════ 공통 컴포넌트 ═══════ */
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-title { font-size: 1.35rem; font-weight: 700; letter-spacing: -.4px; }
.page-desc { color: var(--text-2); font-size: .88rem; width: 100%; margin-top: -6px; }
.page-head .spacer { flex: 1; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px; margin-bottom: 18px;
}
.card-title { font-size: 1.02rem; font-weight: 700; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.card-title .spacer { flex: 1; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  padding: 8px 16px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font-size: .88rem; font-weight: 600; transition: background .12s, opacity .12s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--danger-soft); color: var(--danger); border-color: #fecaca; }
.btn-danger:hover { background: #fee2e2; }
.btn-sm { padding: 5px 10px; font-size: .8rem; }

.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: .82rem; font-weight: 600; color: var(--text-2); margin-bottom: 5px; }
.form-row input, .form-row select, .form-row textarea {
  width: 100%; padding: 9px 12px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); outline: none; background: var(--surface);
  transition: border-color .15s;
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus { border-color: var(--primary); }
.form-row textarea { resize: vertical; min-height: 90px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-hint { font-size: .75rem; color: var(--text-3); margin-top: 4px; }

.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .88rem; }
.tbl th { text-align: left; padding: 9px 12px; background: var(--surface-2); color: var(--text-2); font-size: .78rem; font-weight: 700; border-bottom: 1.5px solid var(--border); white-space: nowrap; }
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: var(--surface-2); }

.badge { display: inline-block; padding: 2px 9px; border-radius: 12px; font-size: .73rem; font-weight: 700; }
.badge-blue { background: var(--primary-soft); color: var(--primary); }
.badge-gray { background: #f1f5f9; color: var(--text-2); }
.badge-red { background: var(--danger-soft); color: var(--danger); }
.badge-green { background: #f0fdf4; color: var(--success); }
.badge-amber { background: #fffbeb; color: var(--warning); }
.badge-orange { background: #fff7ed; color: #ea580c; }

.empty { text-align: center; color: var(--text-3); padding: 36px 10px; font-size: .9rem; }

/* 대시보드 */
.dash-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; align-items: start; }
.dash-col { min-width: 0; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow);
}
.stat .stat-label { font-size: .76rem; color: var(--text-2); font-weight: 600; }
.stat .stat-value { font-size: 1.3rem; font-weight: 800; margin-top: 2px; letter-spacing: -.5px; }
.stat .stat-sub { font-size: .72rem; color: var(--text-3); }

.notice-item { padding: 12px 4px; border-bottom: 1px solid var(--border); cursor: pointer; }
.notice-item:last-child { border-bottom: none; }
.notice-item:hover .notice-title { color: var(--primary); }
.notice-title { font-weight: 600; font-size: .93rem; display: flex; align-items: center; gap: 7px; }
.notice-meta { font-size: .76rem; color: var(--text-3); margin-top: 3px; }
.notice-body { margin-top: 8px; font-size: .88rem; color: var(--text-2); white-space: pre-wrap; display: none; }
.notice-item.open .notice-body { display: block; }

.quick-links { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.quick-link {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); font-size: .84rem; font-weight: 600;
}
.quick-link:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }

/* 모듈 준비중 */
.placeholder-box { text-align: center; padding: 60px 20px; }
.placeholder-box .ph-ico { font-size: 3rem; }
.placeholder-box h2 { margin: 12px 0 6px; }
.placeholder-box p { color: var(--text-2); font-size: .9rem; margin-bottom: 20px; }

/* 모달 */
.modal-overlay {
  position: fixed; inset: 0; z-index: 500; background: rgba(15,23,42,.55);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-box {
  background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg);
  width: 100%; max-width: 520px; max-height: 88vh; overflow-y: auto;
  padding: 24px; animation: rise .25s ease;
}
.modal-box.wide { max-width: 780px; }
.modal-box h3 { font-size: 1.1rem; margin-bottom: 16px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }

/* 토스트 */
.toast-wrap { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 900; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: #0f172a; color: #fff; padding: 11px 20px; border-radius: 24px;
  font-size: .86rem; box-shadow: var(--shadow-lg); animation: rise .25s ease;
}
.toast.err { background: var(--danger); }

/* 설정 탭 */
.tabs { display: flex; gap: 4px; border-bottom: 1.5px solid var(--border); margin-bottom: 18px; flex-wrap: wrap; }
.tab {
  padding: 9px 16px; border: none; background: none; font-size: .9rem; font-weight: 600;
  color: var(--text-2); border-bottom: 2.5px solid transparent; margin-bottom: -1.5px;
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.menu-tree-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 6px; background: var(--surface); }
.menu-tree-item.is-child { margin-left: 26px; }
.menu-tree-item .mt-label { flex: 1; font-size: .88rem; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-tree-item .mt-type { font-size: .7rem; }
.menu-tree-item .mt-actions { display: flex; gap: 2px; }
.mt-btn { background: none; border: none; font-size: .85rem; padding: 4px 6px; border-radius: 4px; color: var(--text-2); }
.mt-btn:hover { background: var(--surface-2); color: var(--text); }
.mt-btn.danger:hover { color: var(--danger); background: var(--danger-soft); }

/* ═══════ 동기화 상태 (헤더) ═══════ */
.sync-dot {
  display: none; align-items: center; gap: 6px;
  font-size: .74rem; font-weight: 700; padding: 5px 11px; border-radius: 20px;
  border: none; color: #fff; background: #334155; white-space: nowrap; cursor: pointer;
}
.sync-dot .sync-dot-ico { width: 8px; height: 8px; border-radius: 50%; background: #94a3b8; display: inline-block; }
.sync-dot.online  { display: inline-flex; background: #14532d; }
.sync-dot.online .sync-dot-ico { background: #4ade80; }
.sync-dot.syncing { display: inline-flex; background: #713f12; }
.sync-dot.syncing .sync-dot-ico { background: #fbbf24; animation: pulse 1s infinite; }
.sync-dot.offline { display: inline-flex; background: #7f1d1d; }
.sync-dot.offline .sync-dot-ico { background: #f87171; }
@keyframes pulse { 50% { opacity: .35; } }

/* ═══════ 캘린더 (일정관리 v2.1) ═══════ */
.cal-card { padding: 14px 14px 16px; }
.cal-toolbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.cal-toolbar .spacer { flex: 1; }
.cal-title { font-size: 1.05rem; font-weight: 800; letter-spacing: -.3px; margin-left: 8px; }
.cal-views { display: flex; gap: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 2px; }
.cal-viewbtn { border: none; background: none; padding: 5px 12px; font-size: .82rem; font-weight: 600; color: var(--text-2); border-radius: 5px; }
.cal-viewbtn.active { background: var(--primary); color: #fff; }

.cal-filters { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.cal-filters .spacer { flex: 1; }
.cal-filter-label { font-size: .78rem; color: var(--text-3); font-weight: 700; }
.cal-fchip { border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-size: .78rem; font-weight: 600; padding: 4px 11px; border-radius: 16px; }
.cal-fchip:hover { border-color: var(--primary); color: var(--primary); }
.cal-fchip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.cal-grid-head { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; font-size: .75rem; font-weight: 700; color: var(--text-2); padding: 4px 0; }
.cal-grid-head .sun { color: var(--danger); }
.cal-grid-head .sat { color: var(--primary); }
/* 주 단위 레인 그리드 (구글캘린더식 스패닝 바) */
.cal-gridwrap { border-top: 1px solid var(--border); }
.cal-gridwrap.view-month { --wkmin: 128px; }
.cal-gridwrap.view-week  { --wkmin: 268px; }
.cal-gridwrap.view-2week { --wkmin: 228px; }
.cal-week { position: relative; border-left: 1px solid var(--border); }
.cal-week-bg { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-week-bg .cal-cell {
  min-height: var(--wkmin, 120px);
  border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
  padding: 3px 5px; background: var(--surface); overflow: hidden;
  display: flex; flex-direction: column;
}
.cal-cell.other { background: var(--surface-2); }
.cal-cell.other .cal-daynum { color: var(--text-3); }
.cal-cell.today { background: var(--primary-soft); }
.cal-cell.today .cal-daynum { color: #fff; background: var(--primary); border-radius: 10px; padding: 0 7px; }
.cal-cell.drop-hover { outline: 2px dashed var(--primary); outline-offset: -2px; }
.cal-daynum { font-size: .72rem; font-weight: 700; display: inline-block; margin-bottom: 2px; align-self: flex-start; }
.cal-daynum.sun { color: var(--danger); }
.cal-daynum.sat { color: var(--primary); }

.cal-week-ev {
  position: absolute; left: 0; right: 0; top: 24px; bottom: 22px;
  display: grid; grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: 20px; row-gap: 2px;
  pointer-events: none; overflow: hidden; align-content: start;
}
.cal-week-ev > * { pointer-events: auto; min-width: 0; }
#cal-body.drag-active .cal-week-ev > * { pointer-events: none; } /* 드래그 중 셀로 통과 */

/* 기간/종일 일정: 한 줄 연결 바 */
.cal-bar {
  margin: 0 3px; display: flex; align-items: center; gap: 3px;
  font-size: .67rem; font-weight: 600; padding: 1px 6px; border-radius: 4px;
  cursor: pointer; user-select: none; overflow: hidden; line-height: 1.4;
}
.cal-bar .chip-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: -.2px; }
.cal-bar.done { opacity: .45; filter: saturate(.4); }
.cal-bar.done .chip-title { text-decoration: line-through; }
.cal-bar.cont-l { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: 0; }
.cal-bar.cont-r { border-top-right-radius: 0; border-bottom-right-radius: 0; margin-right: 0; }
.cal-bar.cont-l::before { content: "‹"; opacity: .8; }
.cal-bar.cont-r::after { content: "›"; opacity: .8; }
.cal-bar.dragging { opacity: .4; }
.cal-bar.ev-gcal { padding-top: 0; padding-bottom: 0; }

/* 시간 일정: 투명 배경 + 색 글씨 (구글캘린더식) */
.cal-tchip {
  margin: 0 3px; display: flex; align-items: center; gap: 3px;
  font-size: .67rem; font-weight: 700; padding: 1px 4px; border-radius: 4px;
  cursor: pointer; user-select: none; overflow: hidden; line-height: 1.4;
  background: transparent !important; color: var(--evc, var(--text)) !important;
  border: none !important;
}
.cal-tchip:hover { background: var(--surface-2) !important; }
.cal-tchip .chip-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: -.2px; }
.cal-tchip .chip-time { font-weight: 600; opacity: .8; }
.cal-tchip.done { opacity: .5; }
.cal-tchip.done .chip-title { text-decoration: line-through; }
.cal-tchip.dragging { opacity: .4; }
.cal-tchip .chip-tag { background: var(--surface-2); }
.chip-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--evc, #64748b); flex-shrink: 0; }

.cal-chip {
  display: flex; align-items: center; gap: 3px;
  font-size: .67rem; font-weight: 600; padding: 2px 5px; border-radius: 4px;
  cursor: pointer; user-select: none; min-width: 0; line-height: 1.35;
}
.cal-chip .chip-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; letter-spacing: -.2px; }
.cal-chip .chip-time { font-size: .6rem; opacity: .85; white-space: nowrap; }
.cal-chip .chip-check { font-size: .72rem; cursor: pointer; opacity: .9; }
.cal-chip .chip-resize { cursor: ew-resize; font-size: .72rem; opacity: .55; }
.cal-chip .chip-resize:hover { opacity: 1; }
.cal-chip.dragging { opacity: .4; }
.cal-chip.done { opacity: .45; filter: saturate(.4); }
.cal-chip.done .chip-title { text-decoration: line-through; }
.cal-more { border: none; background: none; font-size: .7rem; color: var(--primary); font-weight: 700; text-align: left; padding: 1px 4px; margin-top: auto; align-self: flex-start; pointer-events: auto; }
.nb-toolbar.nb-mini button { font-size: .78rem; padding: 3px 8px; }
.nb-memo { min-height: 110px; }

/* 색상 팔레트 (14색 — --evc 변수, 진한 단색 배경 + 흰 글자) */
.ev-blue   { --evc: #2563eb; background: var(--evc); color: #fff; }
.ev-sky    { --evc: #0284c7; background: var(--evc); color: #fff; }
.ev-teal   { --evc: #0d9488; background: var(--evc); color: #fff; }
.ev-green  { --evc: #16a34a; background: var(--evc); color: #fff; }
.ev-lime   { --evc: #4d7c0f; background: var(--evc); color: #fff; }
.ev-yellow { --evc: #a16207; background: var(--evc); color: #fff; }
.ev-amber  { --evc: #d97706; background: var(--evc); color: #fff; }
.ev-orange { --evc: #ea580c; background: var(--evc); color: #fff; }
.ev-red    { --evc: #dc2626; background: var(--evc); color: #fff; }
.ev-pink   { --evc: #db2777; background: var(--evc); color: #fff; }
.ev-purple { --evc: #7c3aed; background: var(--evc); color: #fff; }
.ev-indigo { --evc: #4f46e5; background: var(--evc); color: #fff; }
.ev-brown  { --evc: #7c2d12; background: var(--evc); color: #fff; }
.ev-gray   { --evc: #64748b; background: var(--evc); color: #fff; }
.cal-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex-shrink: 0; }

/* 구글캘린더 일정 칩 (읽기 전용 오버레이) */
.ev-gcal { --evc: #1a73e8; background: #fff; color: #1a73e8; border: 1.5px dashed #1a73e8; }
.chip-g {
  display: inline-flex; align-items: center; justify-content: center;
  width: 13px; height: 13px; border-radius: 3px; flex-shrink: 0;
  background: #1a73e8; color: #fff; font-size: .6rem; font-weight: 800;
}

/* 담당자 태그 / 리마인더 */
.chip-tag {
  background: rgba(255,255,255,.28); border-radius: 3px; padding: 0 3px;
  font-size: .64rem; font-weight: 700; white-space: nowrap; flex-shrink: 0;
}
.ev-gcal .chip-tag { background: #e8f0fe; }
.rem-picker { display: flex; gap: 12px; flex-wrap: wrap; }
.rem-opt { display: flex; align-items: center; gap: 5px; font-size: .84rem; cursor: pointer; font-weight: 600; color: var(--text-2); }
.team-picker { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 7px; }

.color-picker { display: flex; gap: 6px; flex-wrap: wrap; }
.color-swatch { width: 26px; height: 26px; border-radius: 50%; border: 2.5px solid transparent; box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.55); }
.color-swatch.sel { border-color: var(--text); transform: scale(1.15); }

/* 일 뷰 */
.cal-dayview { padding: 4px 2px; }
.cal-sec-label { font-size: .74rem; font-weight: 700; color: var(--text-3); margin: 10px 0 6px; }
.cal-agenda-row { display: flex; gap: 12px; padding: 7px 4px; border-bottom: 1px solid var(--border); align-items: flex-start; }
.cal-agenda-row:last-child { border-bottom: none; }
.ag-time { width: 92px; flex-shrink: 0; font-size: .8rem; font-weight: 700; color: var(--text-2); padding-top: 2px; }
.ag-chip { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ag-chip .cal-chip { font-size: .88rem; padding: 5px 12px; flex: 1 1 100%; } /* 일 보기: 제목 전체 폭 표시 */
.ag-memo { width: 100%; font-size: .8rem; color: var(--text-2); padding-left: 2px; }

/* 년 뷰 */
.cal-year { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.cal-mini { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px; background: var(--surface); }
.cal-mini-title { border: none; background: none; font-size: .88rem; font-weight: 800; color: var(--primary); margin-bottom: 4px; padding: 2px 4px; }
.cal-mini-title:hover { text-decoration: underline; }
.cal-mini-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; text-align: center; }
.mini-dow { font-size: .6rem; color: var(--text-3); font-weight: 700; }
.mini-day { border: none; background: none; font-size: .68rem; padding: 2px 0; border-radius: 4px; color: var(--text-2); position: relative; }
.mini-day:hover { background: var(--surface-2); }
.mini-day.today { background: var(--primary); color: #fff; font-weight: 700; }
.mini-day.has-ev::after { content: ""; position: absolute; bottom: -1px; left: 50%; transform: translateX(-50%); width: 4px; height: 4px; border-radius: 50%; background: var(--accent); }

/* ═══════ 보안등급 이력 (세로 정렬) ═══════ */
.lv-row {
  display: grid; grid-template-columns: 128px 46px 1fr auto;
  gap: 6px; align-items: center; padding: 3px 0;
  font-size: .78rem; color: var(--text-2);
}
.lv-row.expired { opacity: .55; }
.lv-range { white-space: nowrap; font-variant-numeric: tabular-nums; }
.lv-badge { text-align: center; }
.lv-note { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ═══════ 보안점검 (연간 매트릭스) ═══════ */
.insp-matrix { width: 100%; border-collapse: collapse; font-size: .78rem; table-layout: fixed; }
.insp-matrix th {
  background: var(--surface-2); color: var(--text-2); font-size: .72rem; font-weight: 700;
  border: 1px solid var(--border); padding: 6px 2px; text-align: center;
}
.insp-matrix th.insp-cat-h { width: 84px; }
.insp-matrix th.insp-sum-h { width: 56px; }
.insp-matrix td { border: 1px solid var(--border); vertical-align: top; }
.insp-cat { padding: 8px 6px; font-weight: 700; font-size: .8rem; white-space: nowrap; background: var(--surface-2); }
.insp-cell { padding: 3px; min-height: 54px; height: auto; cursor: pointer; }
.insp-cell:hover { background: var(--primary-soft); }
.insp-cell.now { background: #fefce8; }
.insp-sum { text-align: center; font-weight: 800; font-size: .8rem; background: var(--surface-2); padding: 8px 2px; }
.insp-chip {
  display: block;
  font-size: .68rem; font-weight: 600; padding: 3px 6px; border-radius: 4px;
  margin-bottom: 2px; cursor: pointer; line-height: 1.35; word-break: break-all;
}
.insp-chip.dragging { opacity: .4; }
.insp-target { font-weight: 800; font-size: .72rem; }
.insp-people { display: flex; gap: 3px; flex-wrap: wrap; margin-top: 2px; }
.insp-chip.st-완료 { opacity: .62; }
.insp-chip.st-취소 { opacity: .45; text-decoration: line-through; }
.insp-chip.st-연기 { outline: 1.5px dashed #d97706; outline-offset: -1.5px; }
.insp-tag {
  background: rgba(255,255,255,.3); border-radius: 3px; padding: 0 3px;
  font-size: .62rem; font-weight: 700;
}
tr.insp-cancel td { opacity: .5; text-decoration: line-through; }
.insp-bar { height: 7px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 5px; margin-top: 7px; overflow: hidden; }
.insp-bar-fill { height: 100%; background: var(--success); border-radius: 5px; transition: width .3s; }

/* ═══════ CARES 환경센서 위젯 ═══════ */
.cares-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.cares-head .spacer { flex: 1; }
.cares-alarms { margin-bottom: 10px; }
.cares-alarm {
  font-size: .8rem; padding: 6px 10px; margin-bottom: 4px;
  background: var(--danger-soft); border: 1px solid #fecaca; border-radius: 6px;
}
.cares-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.cares-cell {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 8px 10px 6px; background: var(--surface-2); color: var(--primary);
}
.cares-cell.exceed { background: var(--danger-soft); border-color: #fca5a5; color: var(--danger); }
.cares-label { font-size: .7rem; font-weight: 700; color: var(--text-2); }
.cares-cell.exceed .cares-label { color: var(--danger); }
.cares-value { font-size: 1.02rem; font-weight: 800; color: var(--text); margin: 1px 0 2px; }
.cares-cell.exceed .cares-value { color: var(--danger); }
.cares-unit { font-size: .66rem; font-weight: 600; color: var(--text-3); margin-left: 2px; }
.cares-spark { width: 100%; height: 30px; display: block; }

/* ═══════ 공지 리치 에디터 ═══════ */
.nb-toolbar {
  display: flex; gap: 2px; flex-wrap: wrap; align-items: center;
  border: 1.5px solid var(--border); border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: var(--surface-2); padding: 5px 7px;
}
.nb-toolbar button {
  border: none; background: none; padding: 4px 9px; border-radius: 5px;
  font-size: .84rem; color: var(--text-2); font-weight: 600;
}
.nb-toolbar button:hover { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.nb-sep { width: 1px; height: 18px; background: var(--border); margin: 0 5px; }
.nb-editor {
  min-height: 220px; max-height: 45vh; overflow-y: auto;
  border: 1.5px solid var(--border); border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  padding: 12px 14px; font-size: .92rem; outline: none; background: var(--surface);
}
.nb-editor:focus { border-color: var(--primary); }
.nb-editor img, .notice-html img { max-width: 100%; height: auto; border-radius: 6px; }
.nb-editor table, .notice-html table { border-collapse: collapse; margin: 8px 0; width: auto; min-width: 50%; }
.nb-editor td, .nb-editor th, .notice-html td, .notice-html th {
  border: 1px solid var(--border); padding: 6px 10px; font-size: .86rem; min-width: 60px;
}
.notice-html { white-space: normal; }
.notice-html p { margin: 4px 0; }
.notice-html ul, .notice-html ol { padding-left: 22px; margin: 6px 0; }
.nb-files-view { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 4px; }
.nb-file {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px;
  padding: 3px 11px; font-size: .8rem; font-weight: 600; color: var(--text);
}
a.nb-file:hover { border-color: var(--primary); color: var(--primary); }

/* ═══════ 반응형 ═══════ */
@media (max-width: 960px) {
  .dash-grid { grid-template-columns: 1fr; }
  .brand-sub { display: none; }
}
@media (max-width: 768px) {
  html { font-size: 14.5px; }
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .sidebar-backdrop.show { display: block; position: fixed; inset: 0; top: var(--header-h); background: rgba(15,23,42,.45); z-index: 140; }
  .main { margin-left: 0; }
  .view { padding: 16px 14px; }
  .user-chip { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .quick-links { grid-template-columns: 1fr; }
  .cal-gridwrap.view-month { --wkmin: 78px; }
  .cal-gridwrap.view-week { --wkmin: 200px; }
  .cal-gridwrap.view-2week { --wkmin: 160px; }
  .cal-bar .chip-time, .cal-tchip .chip-time, .cal-chip .chip-time { display: none; }
  .cal-title { font-size: .92rem; }
  .sync-dot { font-size: 0; gap: 0; padding: 6px; }
  .sync-dot .sync-dot-ico { width: 9px; height: 9px; }
}

/* ═══════ 보고체계 연락망 (v2.6) ═══════ */
.ct-hero {
  background: linear-gradient(120deg, #7f1d1d 0%, #b91c1c 55%, #dc2626 120%);
  color: #fff; border-radius: var(--radius); padding: 18px 22px; margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.ct-hero-main { font-size: 1.12rem; font-weight: 700; letter-spacing: -.2px; }
.ct-hero-main b { background: rgba(255,255,255,.18); border-radius: 6px; padding: 1px 8px; text-decoration: underline; text-underline-offset: 3px; }
.ct-hero-sub { font-size: .82rem; opacity: .92; margin-top: 6px; }
.ct-searchwrap { position: sticky; top: 0; z-index: 5; padding: 2px 0 10px; background: var(--bg); }
.ct-search {
  width: 100%; padding: 11px 16px; font-size: .95rem;
  border: 1.5px solid var(--border); border-radius: 24px; background: var(--surface);
  box-shadow: var(--shadow); outline: none;
}
.ct-search:focus { border-color: var(--primary); }
.ct-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.ct-sec { margin-bottom: 14px; }
.ct-grid .ct-sec { margin-bottom: 0; }
.ct-sec mark { background: #fde68a; border-radius: 3px; padding: 0 2px; }
.ct-danger { border: 1.5px solid #fca5a5; background: var(--danger-soft); }
.ct-duty {
  font-size: .78rem; font-weight: 700; color: var(--danger);
  background: var(--danger-soft); border: 1px solid #fecaca; border-radius: 14px;
  padding: 3px 10px; margin-right: 6px; white-space: nowrap;
}
.ct-duty:hover { background: #fee2e2; }
.ct-row { padding: 8px 2px; border-bottom: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
.ct-row:last-of-type { border-bottom: none; }
.ct-who { min-width: 150px; flex: 1 1 150px; }
.ct-role { font-size: .78rem; color: var(--text-2); margin-right: 6px; }
.ct-name { font-size: .92rem; }
.ct-dutytxt { display: block; font-size: .75rem; color: var(--text-3); }
.ct-nums { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; }
.ct-num { display: inline-flex; align-items: center; gap: 5px; font-size: .88rem; white-space: nowrap; }
.ct-tel { color: var(--text); font-variant-numeric: tabular-nums; font-weight: 600; }
a.ct-tel:hover { color: var(--primary); }
.ct-mini {
  font-size: .7rem; font-weight: 700; color: var(--primary);
  border: 1px solid var(--primary); border-radius: 10px; padding: 0 7px;
}
.ct-mini:hover { background: var(--primary-soft); }
.ct-copy { background: none; border: none; font-size: .82rem; opacity: .55; padding: 2px; }
.ct-copy:hover { opacity: 1; }
.ct-note { flex-basis: 100%; font-size: .76rem; color: var(--text-3); }
.ct-secnote { margin-top: 10px; font-size: .78rem; color: var(--text-2); background: var(--surface-2); border-radius: var(--radius-sm); padding: 8px 12px; }
.ct-mailall { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
/* 보고 절차 아코디언 */
.ct-acc { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 8px; background: var(--surface-2); }
.ct-acc summary { cursor: pointer; padding: 10px 14px; font-weight: 700; font-size: .9rem; list-style: none; }
.ct-acc summary::before { content: "▸ "; color: var(--primary); }
.ct-acc[open] summary::before { content: "▾ "; }
.ct-acc-body { padding: 2px 16px 12px; font-size: .86rem; color: var(--text); white-space: normal; }
/* 사건별 보고처 */
.ct-inc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ct-inc { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; background: var(--surface-2); }
.ct-inc-head { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 8px; }
.ct-inc-no { font-size: 1.3rem; line-height: 1.2; }
.ct-inc-to { flex: 1; font-size: .82rem; font-weight: 700; color: var(--danger); background: var(--danger-soft); border-radius: var(--radius-sm); padding: 6px 10px; }
.ct-inc-tolabel { display: block; font-size: .68rem; color: var(--text-3); font-weight: 600; }
.ct-inc-items { font-size: .8rem; color: var(--text-2); }
/* 편집 모달 */
.ct-editlist { max-height: 46vh; overflow-y: auto; padding-right: 4px; }
.ct-editrow { display: flex; gap: 8px; align-items: flex-start; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; margin-bottom: 8px; background: var(--surface-2); }
.ct-editfields { flex: 1; display: flex; flex-wrap: wrap; gap: 6px 10px; }
.ct-ef { display: flex; flex-direction: column; flex: 1 1 130px; }
.ct-ef-sm { flex: 0 0 56px; }
.ct-ef-wide { flex: 1 1 100%; }
.ct-ef span { font-size: .68rem; color: var(--text-3); font-weight: 600; }
.ct-ef input, .ct-ef textarea { padding: 5px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: .84rem; }
.ct-editrow-btns { display: flex; flex-direction: column; gap: 2px; }
.ct-editrow-btns .btn { padding: 2px 7px; }
@media (max-width: 900px) {
  .ct-grid, .ct-inc-grid { grid-template-columns: 1fr; }
}

/* ═══════ v2.6.1 — 사건 등급색 · 점검 결과 · CARES 축소 ═══════ */
/* 사건별 보고처: ① 노랑 → ④ 짙은 빨강 */
.ct-inc { border-left-width: 5px; }
.ct-inc .ct-inc-no {
  width: 30px; height: 30px; flex: 0 0 30px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.05rem; color: #fff; background: var(--text-3);
}
.ct-inc.ct-lv1 { border-left-color: #eab308; background: #fefce8; }
.ct-inc.ct-lv1 .ct-inc-no { background: #eab308; }
.ct-inc.ct-lv2 { border-left-color: #f59e0b; background: #fffbeb; }
.ct-inc.ct-lv2 .ct-inc-no { background: #f59e0b; }
.ct-inc.ct-lv3 { border-left-color: #ea580c; background: #fff7ed; }
.ct-inc.ct-lv3 .ct-inc-no { background: #ea580c; }
.ct-inc.ct-lv4 { border-left-color: #991b1b; background: #fef2f2; }
.ct-inc.ct-lv4 .ct-inc-no { background: #991b1b; }
/* 점검 결과(findings) 편집 행 */
.ifd-row { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.ifd-row .ifd-type { flex: 0 0 106px; padding: 6px 8px; }
.ifd-row .ifd-text { flex: 1; min-width: 0; }
.ifd-row .btn { padding: 4px 8px; flex-shrink: 0; }
/* 대시보드 점검 결과 통계 (4열 고정, 줄바꿈 없음) */
.insp-fdgrid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
  margin-top: 10px; padding: 8px 4px; background: var(--surface-2);
  border-radius: var(--radius-sm);
}
.insp-fdcell { display: flex; flex-direction: column; align-items: center; min-width: 0; }
.insp-fdcell b { font-size: 1.02rem; line-height: 1.15; font-variant-numeric: tabular-nums; }
.insp-fdcell span { font-size: .66rem; color: var(--text-3); font-weight: 600; white-space: nowrap; }
.insp-fdcell .fd-c1 { color: #dc2626; }
.insp-fdcell .fd-c2 { color: #d97706; }
.insp-fdcell .fd-c3 { color: #1d4ed8; }
.insp-fdcell .fd-c4 { color: #64748b; }
/* CARES 축소 모드: 전체 정상 한 줄 */
.cares-allok { padding: 12px 6px 4px; font-size: .84rem; color: var(--text-2); }

/* ═══════ 지점 관리 (v2.7 — 세계지도) ═══════ */
.br-map {
  height: 62vh; min-height: 380px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: #eef2f7; z-index: 0;
}
.br-search {
  width: 240px; max-width: 100%; padding: 8px 14px; font-size: .86rem;
  border: 1.5px solid var(--border); border-radius: 18px; outline: none; background: var(--surface);
}
.br-search:focus { border-color: var(--primary); }
.br-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex-shrink: 0; vertical-align: baseline; }
/* 퀵 오버뷰 툴팁 */
.leaflet-tooltip.br-tip {
  padding: 0; border: none; border-radius: 10px; box-shadow: var(--shadow-lg);
  font-family: var(--font); background: var(--surface); opacity: 1;
}
.br-tip-in { padding: 10px 12px 8px; min-width: 190px; }
.br-tip-head { display: flex; align-items: baseline; gap: 6px; border-bottom: 2px solid var(--brc, #64748b); padding-bottom: 5px; margin-bottom: 6px; }
.br-tip-head b { font-size: 1rem; letter-spacing: -.2px; }
.br-tip-iata { font-size: .72rem; color: var(--text-3); font-weight: 700; }
.br-tip-region { margin-left: auto; font-size: .7rem; font-weight: 700; color: var(--brc, #64748b); }
.br-tip-row { display: flex; justify-content: space-between; gap: 12px; font-size: .78rem; color: var(--text-2); padding: 1.5px 0; }
.br-tip-row b { color: var(--text); font-weight: 700; }
.br-tip-flags { display: flex; gap: 6px; margin-top: 6px; }
.br-tip-flags span { font-size: .66rem; font-weight: 700; color: var(--text-3); background: var(--surface-2); border-radius: 10px; padding: 1px 7px; opacity: .55; }
.br-tip-flags span.on { color: var(--primary); background: var(--primary-soft); opacity: 1; }
.br-tip-more { margin-top: 7px; font-size: .66rem; color: var(--text-3); text-align: center; }
/* 범례 */
.br-legend {
  background: rgba(255,255,255,.92); border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 10px; font-size: .72rem; font-weight: 700; color: var(--text-2);
  display: flex; gap: 10px; box-shadow: var(--shadow); font-family: var(--font);
}
.br-legend span { display: inline-flex; align-items: center; gap: 4px; }
.br-legend i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
/* 상세/폼 */
.br-d-tbl { font-size: .9rem; }
.br-d-label { width: 110px; color: var(--text-2); font-size: .82rem; }
.br-ex-row { display: flex; gap: 6px; margin-bottom: 6px; }
.br-ex-row .br-ex-label { flex: 0 0 150px; }
.br-ex-row .br-ex-value { flex: 1; min-width: 0; }
.br-ex-row .btn { flex-shrink: 0; padding: 4px 8px; }
@media (max-width: 768px) {
  .br-map { height: 55vh; min-height: 320px; }
  .br-search { width: 100%; }
  .br-ex-row { flex-wrap: wrap; }
  .br-ex-row .br-ex-label { flex: 1 1 100%; }
}
