/* ============================================================
   기술지원 업무관리 - Microsoft Office(Fluent) 스타일
   ==========================================================*/
:root {
  --brand: #0f6cbd;          /* Fluent brand blue */
  --brand-hover: #115ea3;
  --brand-press: #0c3b5e;
  --brand-soft: #ebf3fc;
  --bg: #f5f5f5;
  --surface: #ffffff;
  --surface-2: #faf9f8;
  --border: #e1dfdd;
  --border-strong: #c8c6c4;
  --text: #242424;
  --text-2: #616161;
  --text-3: #8a8886;
  --danger: #d13438;
  --danger-soft: #fdf3f4;
  --success: #107c10;
  --warn: #ca5010;
  --shadow: 0 2px 8px rgba(0,0,0,.09), 0 1px 2px rgba(0,0,0,.06);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.18);
  --radius: 6px;
  --topbar-h: 48px;
}
html[data-theme="dark"] {
  --brand: #4695e0;
  --brand-hover: #62a9e8;
  --brand-press: #2b6cb0;
  --brand-soft: #12222f;
  --bg: #1b1a19;
  --surface: #252423;
  --surface-2: #2d2c2b;
  --border: #3b3a39;
  --border-strong: #52514f;
  --text: #f3f2f1;
  --text-2: #c8c6c4;
  --text-3: #8a8886;
  --danger: #f1707b;
  --danger-soft: #35201f;
  --shadow: 0 2px 8px rgba(0,0,0,.5);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.6);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Segoe UI", "Malgun Gothic", "맑은 고딕", "Apple SD Gothic Neo", sans-serif;
  font-size: 14px; color: var(--text); background: var(--bg);
}
.hidden { display: none !important; }
button { font-family: inherit; }
input, select, textarea {
  font-family: inherit; font-size: 14px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 4px; padding: 6px 9px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
textarea { resize: vertical; line-height: 1.55; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }

/* ---------------- 버튼 ---------------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 4px; cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-size: 13.5px; font-weight: 600; transition: background .12s, border-color .12s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn-primary:active { background: var(--brand-press); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-ghost.danger { color: var(--danger); }
.btn-block { width: 100%; justify-content: center; padding: 9px; font-size: 14.5px; }
.icon-btn {
  border: none; background: transparent; cursor: pointer; color: var(--text-2);
  font-size: 15px; padding: 5px 9px; border-radius: 4px;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.link-btn { border: none; background: none; color: var(--brand); cursor: pointer; font-size: 12.5px; padding: 0 4px; }
.link-btn:hover { text-decoration: underline; }

/* ---------------- 로그인 ---------------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, var(--brand-press) 0%, var(--brand) 55%, #3f8ccd 100%);
}
.login-card {
  width: 380px; background: var(--surface); border-radius: 10px; box-shadow: var(--shadow-lg);
  padding: 34px 34px 30px;
}
.login-brand { display: flex; gap: 14px; align-items: center; margin-bottom: 26px; }
.login-brand h1 { font-size: 19px; margin: 0; }
.login-brand p { font-size: 11.5px; color: var(--text-3); margin: 2px 0 0; letter-spacing: .4px; }
.brand-mark {
  width: 46px; height: 46px; border-radius: 9px; background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 18px;
  flex-shrink: 0; letter-spacing: .5px;
}
.brand-mark.small { width: 30px; height: 30px; font-size: 12.5px; border-radius: 7px; }
.login-error {
  background: var(--danger-soft); color: var(--danger); border: 1px solid var(--danger);
  border-radius: 4px; padding: 8px 11px; font-size: 13px; margin: 4px 0 12px; white-space: pre-wrap;
}

/* ---------------- 앱 레이아웃 ---------------- */
.app { height: 100vh; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h); background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: space-between; padding: 0 14px;
  flex-shrink: 0;
}
html[data-theme="dark"] .topbar { background: #16283a; border-bottom: 1px solid var(--border); }
.topbar-left { display: flex; align-items: center; gap: 11px; }
.topbar .brand-mark { background: rgba(255,255,255,.18); }
.app-title { font-weight: 700; font-size: 15px; letter-spacing: .2px; }
.topbar-right { display: flex; align-items: center; gap: 6px; }
.topbar-right .btn-ghost { color: rgba(255,255,255,.88); }
.topbar-right .btn-ghost:hover { background: rgba(255,255,255,.14); color: #fff; }
.topbar-right .icon-btn { color: rgba(255,255,255,.88); }
.topbar-right .icon-btn:hover { background: rgba(255,255,255,.14); color: #fff; }
.user-chip { font-size: 13px; opacity: .95; margin-right: 4px; }

.body-wrap { flex: 1; display: flex; min-height: 0; }
.sidenav {
  width: 190px; background: var(--surface); border-right: 1px solid var(--border);
  padding: 12px 8px; display: flex; flex-direction: column; gap: 2px; flex-shrink: 0;
}
.nav-item {
  text-align: left; border: none; background: transparent; color: var(--text-2);
  padding: 9px 13px; border-radius: 5px; cursor: pointer; font-size: 14px; font-weight: 600;
  border-left: 3px solid transparent;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--brand-soft); color: var(--brand); border-left-color: var(--brand); }

.content { flex: 1; overflow: auto; padding: 20px 24px 40px; min-width: 0; }
.page-title { font-size: 20px; font-weight: 700; margin: 0 0 16px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.page-head .page-title { margin: 0; }
.page-actions { display: flex; gap: 7px; flex-wrap: wrap; }

/* ---------------- KPI / 대시보드 ---------------- */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 15px 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 3px;
}
.kpi-label { font-size: 12.5px; color: var(--text-2); font-weight: 600; }
.kpi-value { font-size: 28px; font-weight: 800; color: var(--brand); line-height: 1.15; }
.kpi-sub { font-size: 12px; color: var(--text-3); }
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow); min-width: 0;
}
.card h3 { margin: 0 0 12px; font-size: 14.5px; color: var(--text-2); font-weight: 700; }
.card-wide { grid-column: 1 / -1; }
.chart-box { position: relative; height: 240px; }
.chart-box.tall { height: 300px; }
@media (max-width: 1000px) { .dash-grid { grid-template-columns: 1fr; } }

/* ---------------- 필터 바 ---------------- */
.filter-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px 12px; margin-bottom: 12px; box-shadow: var(--shadow);
}
.filter-bar .grow { flex: 1; min-width: 160px; }
.filter-bar .w80 { width: 82px; }
.tilde { color: var(--text-3); }
.chk { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--text-2); white-space: nowrap; cursor: pointer; }
.quick-group { display: flex; gap: 4px; padding-right: 6px; border-right: 1px solid var(--border); }
.chip {
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2);
  border-radius: 999px; padding: 4px 12px; font-size: 12.5px; cursor: pointer; font-weight: 600;
}
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ---------------- 데이터 그리드 ---------------- */
.result-meta { font-size: 12.5px; color: var(--text-2); margin: 0 2px 7px; }
.grid-wrap {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: auto; box-shadow: var(--shadow); max-height: calc(100vh - 330px); min-height: 200px;
}
table.grid { width: 100%; border-collapse: collapse; table-layout: fixed; min-width: 900px; }
.grid th {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface-2); color: var(--text-2); font-size: 12.5px; font-weight: 700;
  text-align: left; padding: 9px 11px; border-bottom: 1px solid var(--border-strong);
  user-select: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.grid th.sortable { cursor: pointer; }
.grid th.sortable:hover { color: var(--brand); }
.grid th .col-resizer {
  position: absolute; right: 0; top: 0; height: 100%; width: 6px; cursor: col-resize;
}
.grid th .col-resizer:hover { background: var(--brand); opacity: .5; }
.grid td {
  padding: 8px 11px; border-bottom: 1px solid var(--border); font-size: 13.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: top;
}
.grid tbody tr { cursor: pointer; }
.grid tbody tr:hover { background: var(--brand-soft); }
.grid td.contents-cell { color: var(--text-2); }
.grid .w120 { width: 120px; }
.badge {
  display: inline-block; font-size: 11.5px; font-weight: 700; border-radius: 3px; padding: 1.5px 7px;
}
.badge.done { background: #e6f4e6; color: var(--success); }
.badge.doing { background: #fdf0e7; color: var(--warn); }
html[data-theme="dark"] .badge.done { background: #17301a; }
html[data-theme="dark"] .badge.doing { background: #33230f; }
.star { color: #eaa300; font-size: 13px; }
.attach-mark { color: var(--text-3); font-size: 12px; }
.empty-row td { text-align: center; color: var(--text-3); padding: 34px 0; cursor: default; }

/* ---------------- 페이저 ---------------- */
.pager { display: flex; align-items: center; justify-content: center; gap: 4px; margin-top: 13px; flex-wrap: wrap; }
.pager button {
  min-width: 32px; padding: 5px 9px; border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text-2); border-radius: 4px; cursor: pointer; font-size: 13px;
}
.pager button:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.pager button.cur { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 700; }
.pager button:disabled { opacity: .4; cursor: default; }
.pager select { padding: 5px 6px; }

/* ---------------- 상세 패널 ---------------- */
.panel-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.25); z-index: 40; }
.detail-panel {
  position: fixed; top: 0; right: 0; width: min(560px, 92vw); height: 100vh; z-index: 41;
  background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; animation: slidein .16s ease-out;
}
@keyframes slidein { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .detail-panel { animation: none; } }
.detail-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 13px 16px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.detail-head h3 { margin: 0; font-size: 16px; }
.detail-body { padding: 16px 20px 30px; overflow: auto; }
.dl { display: grid; grid-template-columns: 92px 1fr; gap: 7px 12px; margin-bottom: 15px; }
.dl dt { color: var(--text-3); font-size: 12.5px; padding-top: 2px; }
.dl dd { margin: 0; font-size: 14px; }
.detail-contents {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 13px 15px; white-space: pre-wrap; word-break: break-word; line-height: 1.6; font-size: 13.5px;
}
.detail-section-title { font-size: 12.5px; color: var(--text-3); font-weight: 700; margin: 16px 0 6px; }
.admin-memo-box {
  background: #fff8e6; border: 1px solid #e8c96a; border-radius: var(--radius);
  padding: 11px 14px; white-space: pre-wrap; font-size: 13px;
}
html[data-theme="dark"] .admin-memo-box { background: #33290f; border-color: #6b5a1e; }
.attach-list { display: flex; flex-direction: column; gap: 5px; margin: 4px 0 6px; }
.attach-item {
  display: flex; align-items: center; gap: 8px; font-size: 13px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; padding: 5px 9px;
}
.attach-item a { color: var(--brand); text-decoration: none; overflow: hidden; text-overflow: ellipsis; }
.attach-item a:hover { text-decoration: underline; }
.attach-item .sz { color: var(--text-3); font-size: 11.5px; margin-left: auto; white-space: nowrap; }
.attach-item button { border: none; background: none; color: var(--danger); cursor: pointer; font-size: 13px; }

/* ---------------- 모달 ---------------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 50;
  display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px; overflow: auto;
}
.modal {
  background: var(--surface); border-radius: 9px; box-shadow: var(--shadow-lg);
  width: 760px; max-width: 100%; display: flex; flex-direction: column; max-height: 90vh;
}
.modal.narrow { width: 440px; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 20px 12px; border-bottom: 1px solid var(--border);
}
.modal-head h3 { margin: 0; font-size: 16.5px; }
.modal-body { padding: 16px 20px; overflow: auto; display: flex; flex-direction: column; gap: 12px; }
.modal-foot {
  display: flex; justify-content: flex-end; align-items: center; gap: 8px;
  padding: 12px 20px 15px; border-top: 1px solid var(--border);
}
.autosave-note { margin-right: auto; font-size: 12px; color: var(--text-3); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.fld { display: flex; flex-direction: column; gap: 4px; }
.fld > span { font-size: 12.5px; color: var(--text-2); font-weight: 600; }
.fld em { font-style: normal; color: var(--text-3); font-weight: 400; }
.hint { font-size: 11.5px; color: var(--text-3); margin: 2px 0 0; }

/* 콤보(자동완성) */
.combo { position: relative; display: flex; flex-direction: column; }
.combo-list {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 10; max-height: 210px; overflow: auto;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 4px; box-shadow: var(--shadow);
}
.combo-list .opt { padding: 7px 11px; cursor: pointer; font-size: 13.5px; }
.combo-list .opt:hover, .combo-list .opt.hl { background: var(--brand-soft); color: var(--brand); }
.tmpl-list { position: static; margin-bottom: 4px; }

/* 컬럼 표시 메뉴 */
.col-menu {
  position: fixed; z-index: 60; background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 6px; box-shadow: var(--shadow-lg); padding: 8px 4px; min-width: 160px;
}
.col-menu label { display: flex; gap: 7px; align-items: center; padding: 5px 12px; font-size: 13px; cursor: pointer; border-radius: 4px; }
.col-menu label:hover { background: var(--surface-2); }

/* 토스트 */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); z-index: 99;
  background: var(--text); color: var(--bg); padding: 10px 20px; border-radius: 6px;
  font-size: 13.5px; box-shadow: var(--shadow-lg); max-width: 90vw;
}
.toast.err { background: var(--danger); color: #fff; }

/* 통계 소형 테이블 */
.mini-table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 13px; }
.mini-table th { text-align: left; color: var(--text-3); font-size: 12px; padding: 5px 8px; border-bottom: 1px solid var(--border-strong); }
.mini-table td { padding: 5px 8px; border-bottom: 1px solid var(--border); }
.mini-table tr:last-child td { border-bottom: none; }
.mini-table .num { text-align: right; font-variant-numeric: tabular-nums; }

@media (max-width: 1100px) and (min-width: 761px) {
  .sidenav { width: 168px; }
  .content { padding: 16px 16px 40px; }
}

/* ---------------- 시작/종료 일시 입력 ---------------- */
.dt-pair { display: flex; gap: 6px; }
.dt-pair input[type="date"] { flex: 1.35; min-width: 0; }
.dt-pair input[type="time"] { flex: 1; min-width: 0; }
.form-grid .span-2 { grid-column: 1 / -1; margin-top: -6px; }
#w-span-hint.next-day { color: var(--brand); font-weight: 600; }
#w-span-hint.err { color: var(--danger); font-weight: 600; }
.next-tag { color: var(--brand); font-weight: 600; }
.day-split { display: flex; flex-wrap: wrap; gap: 6px; }
.day-split span {
  background: var(--brand-soft); color: var(--brand); border-radius: 3px;
  padding: 2px 8px; font-size: 12.5px; font-variant-numeric: tabular-nums;
}
.stats-note { margin: -4px 2px 12px; }

/* ============================================================
 * 장비 · 정기점검 메뉴
 * ==========================================================*/
.nav-group { font-size: 11.5px; font-weight: 700; color: var(--text-3); padding: 14px 16px 4px; letter-spacing: .2px; }
.nav-group:first-child { padding-top: 4px; }
.num { text-align: right !important; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.mt12 { margin-top: 12px; } .mb12 { margin-bottom: 12px; }
.w30 { width: 30px; } .w40 { width: 40px; } .w80 { width: 80px; } .w90 { width: 90px; }
.txt-bad { color: var(--danger); font-weight: 700; }
.txt-warn { color: var(--warn); font-weight: 600; }
td.empty { text-align: center; color: var(--text-3); padding: 34px 12px !important; white-space: normal !important; cursor: default; }
.link-btn.danger { color: var(--danger); }
.link-btn.muted { color: var(--text-3); }
.hint.big { font-size: 12.5px; line-height: 1.6; }
.inline-lbl { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); }
.clickable { cursor: pointer; }
.caret { color: var(--text-3); font-size: 11px; display: inline-block; transition: transform .12s; }
tr.open .caret { transform: rotate(90deg); }

/* 테이블 자동 폭 (열이 많은 화면) */
table.grid#eq-table, table.grid.insp-grid, table.grid.heat-grid, table.grid.ck-grid, table.grid.ib-grid { table-layout: auto; }
#eq-table { min-width: 1500px; }
.insp-grid { min-width: 1450px; }
.grid td.ellipsis { max-width: 220px; }
.grid td.wide-cell { max-width: 300px; }
.grid tr.inactive td { color: var(--text-3); }
.grid tr.flag-row td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.mono-ish { font-family: Consolas, "D2Coding", monospace; font-size: 12.5px !important; }

/* KPI 6개 + 클릭 가능한 KPI */
.kpi-row.kpi-6 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.kpi.clickable { cursor: pointer; transition: border-color .12s; }
.kpi.clickable:hover { border-color: var(--brand); }
.kpi.warn .kpi-value { color: var(--warn); }
.kpi.danger .kpi-value { color: var(--danger); }

/* 요약 표 */
.scroll-box { max-height: 420px; overflow: auto; }
.scroll-box.tall { max-height: calc(100vh - 260px); }
.mini-table.sticky th { position: sticky; top: 0; background: var(--surface); z-index: 1; }
.mini-table tr.total td { font-weight: 700; border-top: 2px solid var(--border-strong); }
.mini-table tr.clickable:hover td { background: var(--brand-soft); }
.mini-table .sub-row td { background: var(--surface-2); }
.mini-table.inner { margin: 4px 0; font-size: 12.5px; }
.ratio { height: 7px; background: var(--surface-2); border-radius: 4px; overflow: hidden; min-width: 60px; }
.ratio i { display: block; height: 100%; background: var(--brand); }
.model-chip { display: inline-block; margin: 2px 6px 2px 0; padding: 2px 8px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); font-size: 12px; }
.model-chip b { color: var(--brand); margin-left: 3px; }

/* 확인이 필요한 장비 카드 */
.alert-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.alert-card { border: 1px solid var(--border); border-left: 4px solid var(--warn); border-radius: var(--radius); padding: 10px 12px; }
.alert-card.quiet { border-left-color: var(--success); }
.alert-head { display: flex; justify-content: space-between; align-items: baseline; }
.alert-count { font-size: 22px; font-weight: 800; color: var(--warn); }
.alert-card.quiet .alert-count { color: var(--success); }
.alert-card ul { list-style: none; margin: 8px 0 4px; padding: 0; font-size: 12.5px; }
.alert-card li { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; border-bottom: 1px dashed var(--border); cursor: pointer; }
.alert-card li:hover span { color: var(--brand); }
.alert-card li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alert-card li em { font-style: normal; white-space: nowrap; }
.ok-line { font-size: 12.5px; color: var(--success); margin: 8px 0 0; }

/* 상태 표시 */
.badge.res-ok { background: #e6f4e6; color: var(--success); }
.badge.res-warn { background: #fdf0e7; color: var(--warn); }
.badge.res-bad { background: var(--danger-soft); color: var(--danger); }
.badge.off { background: var(--surface-2); color: var(--text-3); }
.badge.cat { background: var(--brand-soft); color: var(--brand); }
.badge.link { background: var(--surface-2); color: var(--text-2); }
[data-theme="dark"] .badge.res-ok { background: #1d2e1d; }
[data-theme="dark"] .badge.res-warn { background: #35261b; }
.dflag { padding: 1px 5px; border-radius: 3px; font-variant-numeric: tabular-nums; }
.dflag.past { background: var(--danger-soft); color: var(--danger); font-weight: 600; }
.dflag.soon { background: #fdf0e7; color: var(--warn); font-weight: 600; }
[data-theme="dark"] .dflag.soon { background: #35261b; }
.rn { font-size: 12px; color: var(--text-2); }
.ubar { position: relative; height: 18px; min-width: 76px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.ubar i { position: absolute; inset: 0 auto 0 0; background: #9cc3e8; }
.ubar.u-mid i { background: #f2c68f; } .ubar.u-high i { background: #f0a274; } .ubar.u-crit i { background: #ee8a8d; }
[data-theme="dark"] .ubar i { background: #2f5d86; }
[data-theme="dark"] .ubar.u-mid i { background: #7a5a2c; } [data-theme="dark"] .ubar.u-high i { background: #8a4b2a; } [data-theme="dark"] .ubar.u-crit i { background: #8a3236; }
.ubar b { position: relative; font-size: 11.5px; padding-left: 6px; line-height: 18px; font-variant-numeric: tabular-nums; }

/* 점검 이력: 체크 + 서명 */
.stamp { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; cursor: pointer; }
.stamp span { display: inline-flex; flex-direction: column; line-height: 1.15; color: var(--success); font-weight: 600; }
.stamp small { color: var(--text-3); font-weight: 400; font-size: 10.5px; }
.bulk-bar { display: flex; align-items: center; gap: 8px; padding: 7px 10px; margin-bottom: 8px; background: var(--brand-soft); border-radius: var(--radius); font-size: 13px; }
.bulk-bar span { font-weight: 700; color: var(--brand); margin-right: 6px; }

/* 장비 상세 패널 */
.detail-panel.wide { width: min(760px, 96vw); }
.eq-hero { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-bottom: 12px; }
.eq-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.detail-contents.small { font-size: 12.5px; }
.chart-box.short { height: 170px; }
.mini-table td.wrap { white-space: normal; }

/* 모달 확장 */
.modal.wide { width: 980px; }
.modal.xwide { width: 1240px; }
.form-sec { font-size: 12.5px; font-weight: 700; color: var(--brand); border-bottom: 1px solid var(--border); padding-bottom: 4px; margin-top: 4px; }
.form-grid.g3 { grid-template-columns: repeat(3, 1fr); }
.form-grid.g4 { grid-template-columns: repeat(4, 1fr); }
.fld em { font-style: normal; color: var(--text-3); font-weight: 400; font-size: 11px; }
.ib-wrap { max-height: 52vh; min-height: 120px; }
.ib-grid { min-width: 1100px !important; }
.ib-grid td { vertical-align: middle; padding: 5px 7px; overflow: visible; }
.ib-grid input[type="text"], .ib-grid input[type="number"], .ib-grid select { width: 100%; min-width: 70px; padding: 4px 6px; }
.ib-grid .ib-notes { min-width: 200px; }
.ib-grid tr.off td { opacity: .45; }
.ib-grid tr.off td:first-child { opacity: 1; }
.ib-grid input:disabled { background: var(--surface-2); border-color: transparent; }
.ib-grid tbody tr:hover { background: transparent; }

/* 사용률 추이 */
.type-strip { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.type-pill { display: flex; gap: 8px; align-items: baseline; padding: 6px 12px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); font-size: 13px; }
.type-pill b { color: var(--brand); }
.type-pill em { font-style: normal; color: var(--danger); font-weight: 700; font-size: 12px; }
.type-pill.hot { border-color: var(--danger); }
.heat { display: inline-block; min-width: 38px; padding: 1px 5px; border-radius: 3px; font-variant-numeric: tabular-nums; }
.heat.h0 { color: var(--text-2); } .heat.h1 { background: #e8f1fb; } .heat.h2 { background: #fdf0e0; color: #8a4b00; }
.heat.h3 { background: #fbd9c4; color: #8a3000; font-weight: 700; } .heat.h4 { background: #f6c3c5; color: #a4262c; font-weight: 700; }
[data-theme="dark"] .heat.h1 { background: #1d3247; } [data-theme="dark"] .heat.h2 { background: #4a3417; color: #f2c68f; }
[data-theme="dark"] .heat.h3 { background: #5a2f1a; color: #f7b08a; } [data-theme="dark"] .heat.h4 { background: #5a1f22; color: #f4a3a7; }
.heat-grid td { padding: 6px 8px; }
.pick-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--border-strong); }
.heat-grid tr.picked .pick-dot { background: var(--brand); border-color: var(--brand); }
.heat-grid tr.picked td { background: var(--brand-soft); }

/* 체크리스트 */
.ck-tabs { border-right: none; flex-wrap: wrap; }
.chip small { opacity: .7; margin-left: 2px; }
.ck-grid td { white-space: normal; vertical-align: top; }
.ck-grid td.sec { color: var(--text-2); font-weight: 600; }
code.cmd { font-family: Consolas, "D2Coding", monospace; font-size: 12px; background: var(--surface-2); padding: 1px 5px; border-radius: 3px; word-break: break-all; }
.print-only, .print-head { display: none; }

/* 가져오기 */
.imp-box { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; font-size: 13px; background: var(--surface-2); }
.imp-box.ok { border-color: var(--success); }
.imp-box ul { margin: 6px 0; padding-left: 18px; }

@media (max-width: 1000px) {
  .form-grid.g3, .form-grid.g4, .eq-cols { grid-template-columns: 1fr 1fr; }
}

/* 체크리스트 인쇄 */
@media print {
  body.print-checklist .topbar, body.print-checklist .sidenav, body.print-checklist .page-head,
  body.print-checklist .ck-tabs, body.print-checklist .no-print, body.print-checklist #toast { display: none !important; }
  body.print-checklist .page:not(#page-checklist) { display: none !important; }
  body.print-checklist .print-only { display: table-cell !important; }
  body.print-checklist .print-head { display: block !important; }
  body.print-checklist .app, body.print-checklist .body-wrap, body.print-checklist .content { height: auto; overflow: visible; padding: 0; display: block; }
  body.print-checklist .grid-wrap { max-height: none; overflow: visible; box-shadow: none; border: none; }
  body.print-checklist .grid th { position: static; }
  body.print-checklist .grid td, body.print-checklist .grid th { border: 1px solid #999; font-size: 11px; color: #000; }
}
.ib-grid td:nth-child(2) { white-space: normal; min-width: 170px; max-width: 240px; }
.ib-grid td:nth-child(3) { white-space: nowrap; }
#disk-models td, #disk-models th { white-space: nowrap; }

/* ============================================================
 * 업무 구분 트리 · 업무 건 히스토리 · 승인
 * ==========================================================*/
.nav-tree { display: flex; flex-direction: column; margin: -2px 0 4px; }
.nav-sub { display: flex; justify-content: space-between; align-items: center; background: none; border: none; cursor: pointer;
  text-align: left; font: inherit; font-size: 13px; color: var(--text-2); padding: 5px 14px 5px 30px; margin: 0 8px; border-radius: var(--radius); }
.nav-sub::before { content: ''; position: absolute; }
.nav-sub:hover { background: var(--surface-2); color: var(--text); }
.nav-sub.active { color: var(--brand); font-weight: 700; background: var(--brand-soft); }
.nav-sub .cnt { font-size: 11.5px; color: var(--text-3); font-weight: 400; }
.nav-sub .cnt b { color: var(--brand); font-weight: 700; }
.nav-badge { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 6px; border-radius: 9px; background: var(--danger);
  color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }

.view-toggle { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius); overflow: hidden; margin: 0 auto 0 14px; }
.view-toggle button { background: var(--surface); border: none; padding: 5px 12px; font: inherit; font-size: 12.5px; cursor: pointer; color: var(--text-2); }
.view-toggle button + button { border-left: 1px solid var(--border-strong); }
.view-toggle button.active { background: var(--brand); color: #fff; font-weight: 600; }

/* 구분 / 상태 표시 */
.wt { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.wt-유지보수 { background: #e8f1fb; color: #0f6cbd; }
.wt-프로젝트 { background: #efe6fa; color: #6b2fb3; }
.wt-작업 { background: #e6f4ea; color: #107c10; }
[data-theme="dark"] .wt-유지보수 { background: #1d3247; color: #8cc4f5; }
[data-theme="dark"] .wt-프로젝트 { background: #33244a; color: #c9a8f0; }
[data-theme="dark"] .wt-작업 { background: #1d3320; color: #8fd18f; }
.cs { display: inline-block; padding: 1px 7px; border-radius: 3px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.cs-계획대기 { background: #fdf0e7; color: var(--warn); }
.cs-진행중 { background: var(--brand-soft); color: var(--brand); }
.cs-완료대기 { background: #fff4ce; color: #8a6100; }
.cs-완료 { background: #e6f4e6; color: var(--success); }
[data-theme="dark"] .cs-계획대기 { background: #35261b; } [data-theme="dark"] .cs-완료대기 { background: #3a3215; color: #f2d36b; }
[data-theme="dark"] .cs-완료 { background: #1d2e1d; }
.badge.appr { background: #fff4ce; color: #8a6100; }
.badge.rej { background: var(--danger-soft); color: var(--danger); }
.case-link { text-align: left; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
.btn.btn-sm { padding: 3px 10px; font-size: 12.5px; }
.btn.danger { color: var(--danger); }

/* 업무 건 목록 */
table.grid.case-grid { table-layout: auto; min-width: 1100px; }
.case-grid td { vertical-align: top; }
.case-grid td .hint { margin: 2px 0 0; font-size: 11.5px; }
.case-grid tr.done-row td { color: var(--text-3); }

/* 상세 패널의 업무 건 안내 */
.case-box { border: 1px solid var(--border); border-left: 4px solid var(--brand); border-radius: var(--radius); padding: 10px 12px; margin: 10px 0 4px; display: grid; gap: 4px; }
.case-box .hint { margin: 0; }
.case-box .btn { justify-self: start; margin-top: 4px; }

/* 대시보드 승인 대기 */
.appr-card { border-left: 4px solid var(--warn); margin-bottom: 16px; }
.appr-card h3 { display: flex; align-items: center; gap: 8px; }

/* 히스토리 패널 */
.case-dl { margin-bottom: 8px; }
.appr-flow { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.appr-flow .step { border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 10px; display: grid; gap: 2px; position: relative; }
.appr-flow .step i { position: absolute; top: 10px; right: 10px; width: 10px; height: 10px; border-radius: 50%; background: var(--border-strong); }
.appr-flow .step b { font-size: 13px; }
.appr-flow .step span { font-size: 11.5px; color: var(--text-3); }
.appr-flow .step.ok { border-color: var(--success); } .appr-flow .step.ok i { background: var(--success); }
.appr-flow .step.wait { border-color: var(--warn); background: #fdf0e7; } .appr-flow .step.wait i { background: var(--warn); }
.appr-flow .step.bad { border-color: var(--danger); background: var(--danger-soft); } .appr-flow .step.bad i { background: var(--danger); }
.appr-flow .step.now { border-color: var(--brand); } .appr-flow .step.now i { background: var(--brand); }
[data-theme="dark"] .appr-flow .step.wait { background: #35261b; }
.reject-note { background: var(--danger-soft); color: var(--danger); border-radius: var(--radius); padding: 7px 10px; font-size: 12.5px; margin-bottom: 8px; white-space: pre-wrap; }
.reject-note b { margin-right: 6px; }
.case-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 4px; padding: 10px; background: var(--surface-2); border-radius: var(--radius); }
.timeline { border-left: 2px solid var(--border); margin-left: 6px; padding-left: 14px; }
.tl-date { font-size: 12px; font-weight: 700; color: var(--brand); margin: 12px 0 4px -22px; padding-left: 0; display: flex; align-items: center; gap: 8px; }
.tl-date::before { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); border: 2px solid var(--surface); }
.tl-item { border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 10px; margin-bottom: 8px; cursor: pointer; background: var(--surface); }
.tl-item:hover { border-color: var(--brand); }
.tl-meta { font-size: 12px; color: var(--text-2); margin-bottom: 4px; }
.tl-body { font-size: 13px; white-space: pre-wrap; word-break: break-word; line-height: 1.55; }
.tl-att { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; font-size: 12px; }
.event-log { margin-top: 14px; font-size: 12.5px; }
.event-log summary { cursor: pointer; color: var(--text-2); font-weight: 600; }
.event-log table { margin-top: 6px; }

/* 업무 등록 창: 새 업무 건 */
.case-new { border: 1px dashed var(--brand); border-radius: var(--radius); padding: 10px 12px; display: grid; gap: 8px; background: var(--brand-soft); }
.case-new .chk { font-size: 12.5px; }
.type-pill em.plain { color: var(--text-2); font-weight: 400; }


/* ============================================================
 * 모바일 (폭 760px 이하)
 *  - 좌측 메뉴는 드로어, 주요 메뉴는 하단 탭
 *  - 표는 카드, 모달·상세는 전체 화면
 * ==========================================================*/
.mobile-only, .tabbar, .fab, .filter-toggle, .nav-backdrop { display: none; }
.sidenav { overflow-y: auto; }

@media (max-width: 760px) {
  :root { --tabbar-h: 58px; }
  .mobile-only { display: revert; }
  body { -webkit-text-size-adjust: 100%; }
  /* iOS에서 입력칸을 누를 때 화면이 확대되지 않도록 16px */
  input, select, textarea { font-size: 16px !important; }
  .btn { min-height: 38px; }
  .btn.btn-sm { min-height: 32px; }

  /* 상단 바 */
  .app { height: 100dvh; }
  .topbar { padding: 0 6px 0 4px; padding-top: env(safe-area-inset-top); height: calc(var(--topbar-h) + env(safe-area-inset-top)); }
  .topbar-left { gap: 6px; }
  #btn-menu { display: inline-flex; color: #fff; padding: 8px; }
  .topbar .brand-mark.small { display: none; }
  .app-title { font-size: 15.5px; }
  .user-chip, #btn-passwd, #btn-logout { display: none; }

  /* 메뉴 드로어 */
  .sidenav {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 60; width: min(300px, 84vw);
    padding: calc(14px + env(safe-area-inset-top)) 10px calc(20px + env(safe-area-inset-bottom));
    transform: translateX(-102%); transition: transform .2s ease; box-shadow: var(--shadow-lg);
  }
  .sidenav.open { transform: none; }
  .nav-backdrop:not(.hidden) { display: block; position: fixed; inset: 0; z-index: 59; background: rgba(0,0,0,.35); }
  .nav-account { display: flex !important; flex-direction: column; gap: 8px; padding: 6px 8px 14px; margin-bottom: 6px; border-bottom: 1px solid var(--border); }
  .nav-account b { font-size: 15px; }
  .nav-account div { display: flex; gap: 6px; }
  .nav-item { padding: 11px 13px; font-size: 15px; }
  .nav-sub { padding: 9px 14px 9px 30px; font-size: 14px; }

  /* 본문 */
  .content { padding: 12px 12px calc(var(--tabbar-h) + 84px + env(safe-area-inset-bottom)); }
  .page-title { font-size: 19px; }
  .page-head { flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
  .page-head .page-title { flex: 1 0 auto; margin-bottom: 0; }
  /* 보조 버튼은 한 줄 가로 스크롤 */
  .page-actions { width: 100%; flex-wrap: nowrap; overflow-x: auto; gap: 6px; padding-bottom: 2px; scrollbar-width: none; }
  .page-actions::-webkit-scrollbar { display: none; }
  .page-actions .btn { font-size: 13px; padding: 6px 11px; }
  .fab-src { display: none !important; }
  #btn-columns { display: none; }
  .view-toggle { margin: 0; order: 3; width: 100%; }
  .view-toggle button { flex: 1; padding: 8px; font-size: 13.5px; }

  /* 하단 탭 */
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: var(--surface); border-top: 1px solid var(--border);
  }
  .tabbar button {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    border: none; background: none; color: var(--text-3); font-size: 11px; font-weight: 600; cursor: pointer; font-family: inherit;
  }
  .tabbar svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
  .tabbar button.active { color: var(--brand); }
  .tabbar button.active svg { stroke-width: 2.1; }
  .tab-badge { position: absolute; top: 5px; left: calc(50% + 6px); min-width: 17px; padding: 0 4px; border-radius: 9px;
    background: var(--danger); color: #fff; font-size: 10.5px; font-style: normal; line-height: 17px; text-align: center; }

  /* 오른쪽 아래 등록 버튼 */
  .fab:not(.hidden) {
    display: inline-flex; align-items: center; position: fixed; z-index: 44; right: 14px;
    bottom: calc(var(--tabbar-h) + 14px + env(safe-area-inset-bottom));
    background: var(--brand); color: #fff; border: none; border-radius: 26px; padding: 0 20px; height: 48px;
    font: inherit; font-size: 15px; font-weight: 700; box-shadow: 0 6px 18px rgba(15,108,189,.38); cursor: pointer;
  }
  .fab:active { background: var(--brand-press); }

  /* 검색 조건 접기 */
  .filter-toggle {
    display: flex; width: 100%; justify-content: space-between; align-items: center; margin-bottom: 8px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 13px;
    font: inherit; font-size: 14px; font-weight: 600; color: var(--text); cursor: pointer; box-shadow: var(--shadow);
  }
  .filter-toggle::after { content: ''; width: 8px; height: 8px; border-right: 2px solid var(--text-3); border-bottom: 2px solid var(--text-3);
    transform: rotate(45deg); margin: -4px 4px 0 10px; transition: transform .15s; }
  .filter-toggle.open::after { transform: rotate(-135deg); margin-top: 4px; }
  .filter-toggle b { margin-left: auto; color: var(--brand); font-size: 12.5px; }
  .filter-bar { display: none; }
  .filter-bar.open { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .filter-bar.open > * { width: 100%; min-width: 0; }
  .filter-bar .grow, .filter-bar .quick-group, .filter-bar label.chk, .filter-bar .inline-lbl { grid-column: 1 / -1; }
  .filter-bar .tilde { display: none; }
  .filter-bar .quick-group { display: flex; gap: 6px; border: none; padding: 0; }
  .filter-bar .quick-group .chip { flex: 1; }
  .filter-bar .btn { justify-content: center; }

  /* KPI · 카드 */
  .kpi-row, .kpi-row.kpi-6 { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi { padding: 11px 13px; }
  .kpi-value { font-size: 23px; }
  .dash-grid { gap: 10px; }
  .card { padding: 13px 13px; overflow-x: auto; }
  .chart-box { height: 220px; }
  .chart-box.tall { height: 260px; }
  .alert-grid { grid-template-columns: 1fr; }
  .type-strip { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .type-pill { flex-shrink: 0; }

  /* 표 → 카드 */
  .grid-wrap { max-height: none; min-height: 0; overflow: visible; background: none; border: none; box-shadow: none; }
  table.grid.m-cards { min-width: 0 !important; display: block; }
  table.grid.m-cards thead { display: none; }
  table.grid.m-cards tbody { display: flex; flex-direction: column; gap: 8px; }
  table.grid.m-cards tr {
    display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px 12px; gap: 3px;
  }
  table.grid.m-cards tr:hover { background: var(--surface); }
  table.grid.m-cards tr:active { border-color: var(--brand); }
  table.grid.m-cards td {
    display: flex; gap: 10px; align-items: baseline; border: none; padding: 1px 0; white-space: normal;
    overflow: visible; max-width: none !important; width: auto !important; font-size: 13.5px; min-height: 0;
  }
  table.grid.m-cards td::before { content: attr(data-label); flex: 0 0 78px; color: var(--text-3); font-size: 12px; }
  table.grid.m-cards td.m-nolabel::before, table.grid.m-cards td.m-title::before { content: none; }
  table.grid.m-cards td.m-title { order: -1; font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
  table.grid.m-cards td.m-title .contents-cell { color: var(--text); }
  table.grid.m-cards td.m-hide { display: none; }
  table.grid.m-cards td:empty { display: none; }
  table.grid.m-cards td.empty, table.grid.m-cards tr.empty-row td { display: block; text-align: center; }
  table.grid.m-cards td.empty::before, table.grid.m-cards tr.empty-row td::before { content: none; }
  table.grid.m-cards tr.empty-row, table.grid.m-cards tr:has(td.empty) { box-shadow: none; }
  .grid tr.flag-row td:first-child { box-shadow: none; }
  table.grid.m-cards tr.flag-row { border-left: 4px solid var(--warn); }
  .ubar { min-width: 120px; }
  table.grid.m-cards td.num { text-align: left !important; justify-content: flex-start; }
  /* 상세 패널은 하단 탭·등록 버튼보다 위 */
  .panel-backdrop { z-index: 54; }
  .detail-panel { z-index: 55; }
  /* 대시보드 승인 대기 표: 구분 · 업무 건 · 단계만 */
  .appr-card .mini-table th:nth-child(3), .appr-card .mini-table td:nth-child(3),
  .appr-card .mini-table th:nth-child(4), .appr-card .mini-table td:nth-child(4),
  .appr-card .mini-table th:nth-child(6), .appr-card .mini-table td:nth-child(6) { display: none; }
  /* 점검 등록(일괄) 표: 입력칸이 있는 카드 */
  table.grid.ib-grid.m-cards td { align-items: center; }
  table.grid.ib-grid.m-cards td:has(input:disabled) { display: none; }
  table.grid.ib-grid.m-cards td.m-nolabel { position: absolute; right: 12px; }
  table.grid.ib-grid.m-cards tr { position: relative; }
  table.grid.ib-grid.m-cards tr.off td:not(:first-child):not(.m-title) { display: none; }
  .ib-wrap { max-height: none; }
  /* 월별 히트맵 표는 가로 스크롤 */
  .grid-wrap:has(.heat-grid) { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); }
  .heat-grid th:nth-child(2), .heat-grid td:nth-child(2) { position: sticky; left: 0; background: var(--surface); z-index: 1; }
  .scroll-box, .scroll-box.tall { max-height: none; }
  .bulk-bar { position: sticky; top: 0; z-index: 5; flex-wrap: wrap; }
  .pager button { min-width: 38px; padding: 8px 10px; }

  /* 모달: 전체 화면 */
  .modal-backdrop { padding: 0; align-items: stretch; }
  .modal, .modal.narrow, .modal.wide, .modal.xwide { width: 100%; max-height: none; height: 100dvh; border-radius: 0; }
  .modal-head { padding: calc(12px + env(safe-area-inset-top)) 14px 10px; position: sticky; top: 0; background: var(--surface); z-index: 2; }
  .modal-body { padding: 14px; flex: 1; }
  .modal-foot { padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); background: var(--surface); }
  .modal-foot .btn { flex: 1; justify-content: center; min-height: 44px; }
  .modal-foot .autosave-note { flex-basis: 100%; }
  .modal-foot { flex-wrap: wrap; }
  .form-grid, .form-grid.g3, .form-grid.g4 { grid-template-columns: 1fr; gap: 10px; }
  .form-grid .span-2 { margin-top: 0; }

  /* 상세 패널: 전체 화면 */
  .detail-panel, .detail-panel.wide { width: 100vw; height: 100dvh; border-left: none; }
  .detail-head { padding: calc(10px + env(safe-area-inset-top)) 8px 10px 14px; flex-wrap: wrap; }
  .detail-head h3 { flex: 1 1 100%; order: -1; font-size: 16.5px; }
  .detail-head > div { display: flex; flex-wrap: wrap; gap: 2px; width: 100%; }
  .detail-head > div .icon-btn { margin-left: auto; }
  .detail-head .btn { padding: 6px 10px; font-size: 13px; }
  .detail-body { padding: 14px 14px calc(30px + env(safe-area-inset-bottom)); }
  .dl { grid-template-columns: 80px 1fr; }
  .eq-cols, .appr-flow { grid-template-columns: 1fr; }
  .eq-hero { flex-wrap: wrap; }
  .case-actions .btn { flex: 1; justify-content: center; min-height: 44px; }
  .timeline { margin-left: 4px; padding-left: 12px; }

  /* 체크리스트·점검 현황 등의 작은 표 */
  .mini-table { font-size: 12.5px; }
  .mini-table td, .mini-table th { padding: 5px 6px; }
  .ck-tabs { flex-wrap: nowrap; overflow-x: auto; }
  .ck-tabs .chip { flex-shrink: 0; }
  #col-menu { display: none !important; }
  .toast { bottom: calc(var(--tabbar-h) + 76px + env(safe-area-inset-bottom)); left: 12px; right: 12px; transform: none; text-align: center; }
}

/* 로그인 화면 (모바일) */
@media (max-width: 480px) {
  .login-wrap { padding: 16px; align-items: flex-start; padding-top: 12vh; }
  .login-card { width: 100%; padding: 26px 22px 22px; }
  .login-card input { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) { .sidenav { transition: none; } }

/* ============================================================
 * 사용량(GB) 표시
 * ==========================================================*/
.gb-line { font-size: 11.5px; color: var(--text-2); margin-top: 2px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.gb-line.solo { font-size: 13px; color: var(--text); margin-top: 0; }
.gb-line i { font-style: normal; font-size: 10.5px; color: var(--brand); background: var(--brand-soft); border-radius: 3px; padding: 0 4px; margin-left: 3px; }
#page-usage .page-head .view-toggle { margin-left: 14px; }

/* ============================================================
 * 캘린더
 * ==========================================================*/
.cal-nav { display: flex; align-items: center; gap: 4px; margin-left: 10px; }
.cal-nav .icon-btn { font-size: 22px; line-height: 1; padding: 2px 10px; }
.cal-nav b { font-size: 17px; margin-left: 8px; min-width: 110px; font-variant-numeric: tabular-nums; }
#page-calendar .view-toggle { margin-left: auto; }
#page-calendar .page-actions { margin-left: 8px; }
.cal-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 10px; }
.cal-chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--surface); border-radius: 16px;
  padding: 4px 11px 4px 8px; font: inherit; font-size: 13px; cursor: pointer; color: var(--text); }
.cal-chip i { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.cal-chip small { color: var(--text-3); }
.cal-chip.off { opacity: .45; text-decoration: line-through; }
.cal-dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }

.cal-month { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.cal-wd, .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-wd div { padding: 7px 8px; font-size: 12px; font-weight: 700; color: var(--text-2); background: var(--surface-2); border-bottom: 1px solid var(--border); }
.cal-wd .sun, .cal-day.sun .cal-dn, .cal-ldate .sun { color: var(--danger); }
.cal-wd .sat, .cal-day.sat .cal-dn, .cal-ldate .sat { color: var(--brand); }
.cal-day { min-height: 112px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 4px 4px 6px;
  display: flex; flex-direction: column; gap: 2px; min-width: 0; cursor: default; }
.cal-day:nth-child(7n) { border-right: none; }
.cal-day.out { background: var(--surface-2); }
.cal-day.out .cal-dn { opacity: .45; }
.cal-dn { font-size: 12.5px; font-weight: 700; padding: 1px 4px; align-self: flex-start; border-radius: 10px; font-variant-numeric: tabular-nums; }
.cal-day.today .cal-dn { background: var(--brand); color: #fff !important; }
.cal-ev { display: flex; gap: 4px; align-items: baseline; width: 100%; border: none; background: none; cursor: pointer; padding: 1px 4px;
  border-radius: 3px; font: inherit; font-size: 12px; text-align: left; color: var(--text); min-width: 0; }
.cal-ev::before { content: ''; flex: 0 0 7px; height: 7px; border-radius: 50%; background: var(--c); align-self: center; }
.cal-ev em { font-style: normal; color: var(--text-2); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.cal-ev span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-ev:hover { background: var(--surface-2); }
.cal-ev.allday { background: var(--c); color: #fff; }
.cal-ev.allday::before { display: none; }
.cal-ev.allday:hover { filter: brightness(1.08); }
.cal-more { border: none; background: none; color: var(--text-2); font: inherit; font-size: 11.5px; text-align: left; padding: 1px 4px; cursor: pointer; }
.cal-more:hover { color: var(--brand); }

.cal-list { display: flex; flex-direction: column; gap: 8px; }
.cal-lday { display: grid; grid-template-columns: 64px 1fr; gap: 10px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 12px; box-shadow: var(--shadow); }
.cal-lday.today { border-left: 4px solid var(--brand); }
.cal-ldate { display: flex; flex-direction: column; align-items: flex-start; }
.cal-ldate b { font-size: 17px; font-variant-numeric: tabular-nums; }
.cal-ldate span { font-size: 12px; color: var(--text-2); }
.cal-litems { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cal-litem { display: grid; grid-template-columns: 88px 70px 1fr; gap: 8px; align-items: baseline; border: none; background: none;
  border-left: 3px solid var(--c); padding: 4px 8px; font: inherit; font-size: 13.5px; text-align: left; cursor: pointer; color: var(--text); border-radius: 0 3px 3px 0; }
.cal-litem:hover { background: var(--surface-2); }
.cal-litem .t { color: var(--text-2); font-variant-numeric: tabular-nums; font-size: 12.5px; }
.cal-litem .who { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-litem .what { min-width: 0; overflow-wrap: anywhere; }
.cal-litem small { color: var(--text-3); }
.cal-empty { padding: 30px; text-align: center; }

.cal-help { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; font-size: 12.5px; line-height: 1.6; }
.cal-help ol { margin: 4px 0 6px; padding-left: 20px; }
.cal-help .hint { display: block; margin-top: 6px; word-break: break-all; }
.form-grid .span-4 { grid-column: 1 / -1; }
.cal-form input[type="color"] { height: 34px; padding: 2px; width: 100%; }
.cal-form-actions { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.cal-form-actions .chk { margin-right: auto; }
.cal-feed-meta { font-size: 12px; color: var(--text-3); }
table.grid.cal-feed-grid { table-layout: auto; min-width: 860px; }
.cal-feed-grid td .wrap { white-space: normal; max-width: 260px; }

@media (max-width: 760px) {
  #page-calendar .page-head { gap: 6px; }
  .cal-nav { order: 2; margin-left: 0; width: 100%; }
  .cal-nav b { margin-left: auto; text-align: right; }
  #page-calendar .view-toggle { order: 3; margin-left: 0; }
  #page-calendar .page-actions { order: 4; margin-left: 0; }
  .cal-day { min-height: 62px; padding: 2px; cursor: pointer; }
  /* 휴대폰 월 보기: 칸에는 색 점만, 누르면 그날 목록 */
  .cal-ev { padding: 0; height: 6px; }
  .cal-ev em, .cal-ev span { display: none; }
  .cal-ev::before { flex-basis: 6px; height: 6px; }
  .cal-ev.allday { height: 4px; border-radius: 2px; }
  .cal-day .cal-ev { display: inline-flex; width: auto; }
  .cal-more { font-size: 10px; padding: 0; }
  .cal-lday { grid-template-columns: 48px 1fr; padding: 9px 10px; }
  .cal-litem { grid-template-columns: 70px 1fr; }
  .cal-litem .what { grid-column: 1 / -1; }
  .cal-form-actions { flex-wrap: wrap; }
  .cal-form-actions .btn { flex: 1; justify-content: center; }
}

/* ============================================================
 * SR 관리
 * ==========================================================*/
.sr-st { display: inline-block; padding: 1px 8px; border-radius: 3px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.sr-st-Open { background: #fde7e9; color: var(--danger); }
.sr-st-진행중 { background: var(--brand-soft); color: var(--brand); }
.sr-st-Close { background: #e6f4e6; color: var(--success); }
[data-theme="dark"] .sr-st-Open { background: #3b1f22; } [data-theme="dark"] .sr-st-Close { background: #1d2e1d; }
.sr-cat { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 11.5px; font-weight: 600; white-space: nowrap; border: 1px solid currentColor; }
.sr-cat-장애 { color: var(--danger); }
.sr-cat-Part지원 { color: #8a6100; }
.sr-cat-문의사항 { color: var(--text-2); }
[data-theme="dark"] .sr-cat-Part지원 { color: #f2d36b; }
.sev { display: inline-block; font-size: 11px; font-weight: 700; color: var(--text-2); background: var(--surface-2); border-radius: 3px; padding: 0 5px; }
table.grid.sr-grid { table-layout: auto; min-width: 1250px; }
.sr-grid tr.done-row td { color: var(--text-3); }
.sr-grid tr.flag-row td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.sr-warn { background: #fff4ce; color: #6b4b00; border-radius: var(--radius); padding: 7px 10px; font-size: 12.5px; margin: 6px 0; }
.sr-warn.ok { background: var(--surface-2); color: var(--text-2); }
[data-theme="dark"] .sr-warn { background: #3a3215; color: #f2d36b; }
.sr-resolution { border-left: 4px solid var(--success); }
.sr-add { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; margin: 12px 0 4px; display: grid; gap: 8px; background: var(--surface-2); }
.sr-add textarea { width: 100%; resize: vertical; }
.sr-add-row { display: flex; gap: 8px; justify-content: flex-end; }
.sr-add-row input { max-width: 220px; }
.sr-add .hint { margin: 0; }
.sr-timeline { display: flex; flex-direction: column; gap: 6px; border-left: 2px solid var(--border); margin-left: 6px; padding-left: 12px; }
.sr-tl { position: relative; }
.sr-tl::before { content: ''; position: absolute; left: -18px; top: 9px; width: 10px; height: 10px; border-radius: 50%; background: var(--border-strong); border: 2px solid var(--surface); }
.sr-tl-status { display: flex; gap: 10px; font-size: 12px; color: var(--text-2); padding: 3px 0; }
.sr-tl-status .when { font-variant-numeric: tabular-nums; color: var(--text-3); white-space: nowrap; }
.sr-tl-status .who { margin-left: auto; color: var(--text-3); white-space: nowrap; }
.sr-tl-memo, .sr-tl-work { border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 10px; background: var(--surface); }
.sr-tl-memo::before { background: var(--brand); }
.sr-tl-work { cursor: pointer; border-left: 3px solid var(--success); }
.sr-tl-work::before { background: var(--success); }
.sr-tl-work:hover { border-color: var(--success); }
.sr-tl .tag { font-size: 10.5px; background: var(--brand-soft); color: var(--brand); border-radius: 3px; padding: 0 5px; margin-left: 4px; }
.sr-tl .tag.work { background: #e6f4e6; color: var(--success); }
.sr-box { border-left-color: var(--danger); }
@media (max-width: 760px) {
  .sr-add-row { flex-direction: column; }
  .sr-add-row input { max-width: none; }
  .sr-tl-status { flex-wrap: wrap; }
}

/* 대시보드: 오늘 일정 */
.cal-today { margin-bottom: 16px; border-left: 4px solid var(--brand); }
.cal-today-head { display: flex; justify-content: space-between; align-items: baseline; }
.cal-today-head h3 { margin-bottom: 8px; }
.cal-today-head h3 .hint { font-weight: 400; margin-left: 6px; }
.cal-today .cal-litems { gap: 2px; }
.cal-litem.past { opacity: .5; }
.cal-litem.now { background: var(--brand-soft); }
.now-dot { font-size: 10.5px; color: #fff; background: var(--brand); border-radius: 3px; padding: 0 4px; font-weight: 700; }

/* 담당자 이름 정리 */
.name-actions { display: flex; align-items: center; gap: 10px; }
table.grid.name-grid { table-layout: auto; min-width: 0; }
.name-grid td { vertical-align: middle; }
.name-grid select { min-width: 160px; margin-right: 6px; }
.name-grid tr.inactive td { color: var(--text-3); }

/* 장비 담당자 일괄 변경 */
#eq-table tr.picked td { background: var(--brand-soft); }
#eq-table .sel-cell { width: 30px; }
#eq-bulk { position: sticky; top: 0; z-index: 3; }
#eq-bulk select { min-width: 150px; }
@media (max-width: 760px) {
  #eq-bulk .inline-lbl { flex-wrap: wrap; }
  table.grid.m-cards td.sel-cell { position: absolute; right: 12px; top: 10px; }
  #eq-table.m-cards tr { position: relative; }
}

/* 장비 Excel 일괄 수정 미리보기 */
.equp-wrap { max-height: 46vh; margin-top: 10px; }
table.grid.equp-grid { table-layout: auto; min-width: 0; }
.equp-grid td { vertical-align: top; }
.equp-grid .chg { font-size: 12.5px; line-height: 1.6; }
.equp-grid .chg .f { display: inline-block; min-width: 96px; color: var(--text-2); font-weight: 600; }
.equp-grid .chg .from { color: var(--text-3); text-decoration: line-through; }
.equp-grid .chg .to { color: var(--brand); font-weight: 600; }
#equp-skip-wrap { margin-right: auto; }
