:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --ink: #1d2433;
  --ink-2: #5b6475;
  --ink-3: #8a93a3;
  --line: #e2e5ea;
  --line-2: #eef0f3;
  --navy: #1f3864;
  --navy-2: #2c4a80;
  --accent: #2f6fde;
  --accent-soft: #e8f0fd;
  --ok: #1f8a4c;      --ok-soft: #e4f4ea;
  --warn: #b86e00;    --warn-soft: #fdf1dc;
  --bad: #c62f2f;     --bad-soft: #fbe6e6;
  --mute-soft: #eef0f3;
  --t-server: #dce6f5;  --t-server-b: #6f8fc6;
  --t-storage: #e3efe0; --t-storage-b: #6ea36a;
  --t-network: #f6ead7; --t-network-b: #c6964d;
  --t-security: #f4e1e1; --t-security-b: #c47272;
  --t-ups: #ece4f3;     --t-ups-b: #8f73b0;
  --t-etc: #eeeeee;     --t-etc-b: #9aa1ab;
  --radius: 8px;
  --u-h: 17px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: "Malgun Gothic", "맑은 고딕", "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--ink); font: 13px/1.5 var(--font); -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
code { background: var(--line-2); padding: 1px 5px; border-radius: 4px; font-size: 12px; }
a { color: var(--accent); }
h1 { font-size: 20px; margin: 0; }
h4 { margin: 16px 0 6px; font-size: 13px; }
[hidden] { display: none !important; }
svg { width: 20px; height: 20px; flex: none; }
svg.ic { width: 16px; height: 16px; vertical-align: -3px; }

/* ── 상단바 ───────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 24px;
  height: 52px; padding: 0 20px;
  background: var(--navy); color: #fff;
}
.brand { display: flex; align-items: center; gap: 10px; white-space: nowrap; color: #fff; text-decoration: none; }
.logo { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 6px;
  background: #fff; color: var(--navy); font-weight: 800; font-size: 12px; letter-spacing: -.5px; }
.name { font-weight: 700; font-size: 15px; }
.badge { font-size: 11px; padding: 1px 7px; border-radius: 10px; background: rgba(255,255,255,.15); }
.tabs { display: flex; gap: 2px; height: 100%; }
.tabs a {
  display: flex; align-items: center; height: 100%; padding: 0 14px; text-decoration: none;
  color: rgba(255,255,255,.7); font-weight: 600; border-bottom: 3px solid transparent; white-space: nowrap;
}
.tabs a:hover { color: #fff; background: rgba(255,255,255,.06); }
.tabs a.active { color: #fff; border-bottom-color: #fff; }
.conn { margin-left: auto; display: flex; align-items: center; gap: 6px; font-size: 12px; color: rgba(255,255,255,.75); white-space: nowrap; }
.conn i { width: 8px; height: 8px; border-radius: 50%; background: #aaa; }
.conn.ok i { background: #4ade80; }
.conn.bad i { background: #f87171; }

main { padding: 16px 20px 40px; max-width: 1680px; margin: 0 auto; }
.view { display: none; }
.view.active { display: block; }
.m-head, .m-only, .bottomnav, .fab, .cards-list, #view-more, .detail-head .back.m-only { display: none; }

/* ── 공통 입력 ───────────────────────────── */
input, select, textarea {
  height: 32px; padding: 0 8px; border: 1px solid var(--line); border-radius: 6px; background: #fff; min-width: 0;
}
textarea { height: auto; padding: 6px 8px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
input[type=checkbox] { height: auto; width: 16px; height: 16px; accent-color: var(--accent); }
button {
  height: 32px; padding: 0 14px; border-radius: 6px; cursor: pointer; white-space: nowrap;
  border: 1px solid var(--navy); background: var(--navy); color: #fff; font-weight: 600;
}
button:hover { background: var(--navy-2); }
button.primary { background: var(--accent); border-color: var(--accent); }
button.primary:hover { filter: brightness(.95); }
button.ghost { background: #fff; color: var(--ink); border-color: var(--line); }
button.ghost:hover { background: var(--line-2); }
button.danger { color: var(--bad); }
button.link, a.link { background: none; border: 0; color: var(--accent); padding: 0 4px; height: auto; font-weight: 600; text-decoration: none; cursor: pointer; }
button:disabled { opacity: .5; cursor: default; }
.icon-btn { width: 36px; height: 36px; padding: 0; display: grid; place-items: center; background: #fff; color: var(--ink); border-color: var(--line); }
.actions { display: flex; gap: 6px; align-items: center; }
.actions.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--ink-3); }
.small { font-size: 12px; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; background: #fff; }
.seg button { border: 0; border-radius: 0; background: #fff; color: var(--ink-2); font-weight: 600; height: 30px; padding: 0 12px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--navy); color: #fff; }
.seg.big button { height: 36px; flex: 1; }
.seg.big { display: flex; }

/* ── 필터 ───────────────────────────── */
.filters {
  display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: flex-end;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px;
}
.filters label { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--ink-2); font-weight: 600; }
.filters label select { min-width: 110px; }
.filters label.grow { flex: 1; min-width: 200px; }
.filters label.chk { flex-direction: row; align-items: center; gap: 5px; height: 32px; font-size: 12px; color: var(--ink); }
.filters .actions { margin-left: auto; }
.range { display: flex; align-items: center; gap: 4px; min-width: 0; }
.range input { min-width: 0; flex: 1 1 0; width: 100%; }   /* 휴대폰 날짜 칸이 카드 밖으로 넘치지 않게 */
.range em { font-style: normal; color: var(--ink-3); }
.quick { display: flex; gap: 4px; }
.quick button { background: #fff; color: var(--ink-2); border-color: var(--line); font-weight: 500; }
.quick button:hover { background: var(--line-2); }
.host-filter { margin-top: 8px; padding: 6px 12px; background: var(--accent-soft); border-radius: 6px; font-size: 12px; }

.toolbar { display: flex; align-items: center; justify-content: space-between; margin: 14px 0 8px; gap: 10px; flex-wrap: wrap; }
.toolbar.tight { margin: 0 0 10px; justify-content: flex-start; }
.summary { color: var(--ink-2); }
.summary b { color: var(--ink); }

/* ── 작업기록 표 ───────────────────────────── */
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; }
.grid { width: 100%; border-collapse: collapse; }
.grid th {
  position: sticky; top: 0; background: #f8f9fb; text-align: left; font-size: 12px; color: var(--ink-2);
  padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; user-select: none;
}
.grid th[data-sort] { cursor: pointer; }
.grid th[data-sort]:hover { color: var(--ink); }
.grid th.sorted::after { content: " ▾"; }
.grid th.sorted.asc::after { content: " ▴"; }
.grid td { padding: 8px 10px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.grid tbody tr { cursor: pointer; }
.grid tbody tr:hover { background: #f7f9fd; }
.grid td small, .sub-t { display: block; color: var(--ink-3); font-size: 11px; }
.grid td.date { white-space: nowrap; font-variant-numeric: tabular-nums; }
.grid td.cust, .grid td.host, .grid td.nowrap { white-space: nowrap; }
.mono, .grid td.host a { font-family: Consolas, "D2Coding", monospace; font-size: 12px; }
.grid td.host a { text-decoration: none; }
.grid td.host a:hover { text-decoration: underline; }
.grid td.body { min-width: 320px; }
.sym { font-weight: 600; }
.det { color: var(--ink-2); font-size: 12px; margin-top: 2px; }
.part { margin-top: 3px; font-size: 11px; color: var(--ink-3); }
.empty, .placeholder { padding: 40px; text-align: center; color: var(--ink-3); }

.chip { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11px; font-weight: 700; white-space: nowrap; line-height: 18px; }
.chip.s-완료, .chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.s-진행중, .chip.info { background: var(--accent-soft); color: var(--accent); }
.chip.s-부품대기, .chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.s-보류, .chip.mute { background: var(--mute-soft); color: var(--ink-2); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.p-긴급 { background: var(--bad); color: #fff; }
.chip.p-일반 { background: var(--warn-soft); color: var(--warn); }
.chip.p-단순 { background: var(--line); color: var(--ink-2); }
.chip.r-일치 { background: var(--ok-soft); color: var(--ok); }
.chip.r-불일치 { background: var(--warn-soft); color: var(--warn); }
.chip.r-미발견 { background: var(--bad-soft); color: var(--bad); }
.chip.r-신규 { background: var(--accent-soft); color: var(--accent); }
.chip.r-미확인 { background: var(--mute-soft); color: var(--ink-2); }
.chip.um { background: #fff; color: var(--ink-2); border: 1px dashed var(--ink-3); }

.pager { display: flex; justify-content: center; gap: 4px; margin-top: 12px; flex-wrap: wrap; }
.pager button { min-width: 32px; padding: 0 8px; background: #fff; color: var(--ink); border-color: var(--line); font-weight: 500; }
.pager button.cur { background: var(--navy); color: #fff; border-color: var(--navy); }
.pager span { padding: 6px 4px; color: var(--ink-3); }

/* ── 고객사 ───────────────────────────── */
.split { display: grid; grid-template-columns: 310px minmax(0, 1fr); gap: 14px; align-items: start; }
.cust-side { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); position: sticky; top: 68px; max-height: calc(100vh - 84px); display: flex; flex-direction: column; }
.side-head { display: flex; gap: 6px; padding: 10px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.side-head input { flex: 1; }
.cust-list { list-style: none; margin: 0; padding: 0; overflow: auto; }
.cust-list li a { display: block; padding: 10px 12px; border-bottom: 1px solid var(--line-2); color: var(--ink); text-decoration: none; }
.cust-list li a:hover { background: #f7f9fd; }
.cust-list li a.active { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.cust-list .cn { font-weight: 700; display: flex; gap: 6px; align-items: center; }
.cust-list .cm { color: var(--ink-3); font-size: 11px; margin-top: 2px; display: flex; gap: 8px; flex-wrap: wrap; }
.cust-main { min-width: 0; }
.cust-main > .placeholder { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }

.detail-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.detail-head .back { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; color: var(--ink); background: #fff; border: 1px solid var(--line); }
.dh-title { flex: 1; min-width: 200px; }
.dh-title h2 { margin: 0; font-size: 20px; }
.dh-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.dh-sub { color: var(--ink-2); font-size: 12px; margin-top: 2px; }
.subtabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 12px; overflow-x: auto; }
.subtabs button { background: none; border: 0; border-radius: 0; color: var(--ink-2); border-bottom: 2px solid transparent; height: 38px; }
.subtabs button:hover { background: none; color: var(--ink); }
.subtabs button.active { color: var(--navy); border-bottom-color: var(--navy); }

.ov-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin-bottom: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.stat .k { font-size: 11px; color: var(--ink-2); font-weight: 600; }
.stat .v { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat .v small { font-size: 12px; color: var(--ink-3); margin-left: 2px; font-weight: 600; }
.memo { white-space: pre-wrap; color: var(--ink-2); }

/* 랙 실장도 */
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 11px; color: var(--ink-2); margin-bottom: 8px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 2px; vertical-align: -2px; margin-right: 4px; border: 1px solid; }
.rack-row { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 10px; align-items: flex-start; }
.rack {
  flex: none; width: 250px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.rack-h { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-bottom: 1px solid var(--line); background: #f8f9fb; }
.rack-h b { font-size: 14px; }
.rack-h .sub-t { flex: 1; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rack-h button { height: 24px; padding: 0 8px; font-size: 11px; }
.rack-body { display: grid; grid-template-columns: 24px 1fr 24px; padding: 6px 4px; background: #2b2f36; }
.rack-u { display: grid; grid-auto-rows: var(--u-h); font-size: 9px; color: #9aa3b0; text-align: center; line-height: var(--u-h); font-variant-numeric: tabular-nums; }
.rack-slots { display: grid; grid-auto-rows: var(--u-h); background: #3a3f48; border-left: 2px solid #565c66; border-right: 2px solid #565c66; position: relative; }
.slot { border-bottom: 1px dashed #4a505a; cursor: pointer; }
.slot:hover { background: rgba(255,255,255,.08); }
.slot:hover::after { content: "+"; color: #cfd5de; font-size: 12px; display: block; text-align: center; line-height: calc(var(--u-h) - 1px); }
.dev {
  margin: 1px 2px; border-radius: 3px; padding: 0 6px; font-size: 11px; line-height: 1.25; overflow: hidden; cursor: pointer;
  display: flex; align-items: center; gap: 4px; border: 1px solid; white-space: nowrap; min-width: 0;
}
.dev .dn { font-weight: 700; overflow: hidden; text-overflow: ellipsis; flex: 0 1 auto; min-width: 0; max-width: 100%; }
.dev:not(.tall) .dn { flex-shrink: 0; max-width: 72%; }
.dev .dm { color: rgba(0,0,0,.55); overflow: hidden; text-overflow: ellipsis; font-size: 10px; flex: 1 1 auto; min-width: 0; }
.dev.tall .dm, .dev.tall .dn { max-width: 100%; }
.dev.tall { flex-direction: column; align-items: flex-start; justify-content: center; }
.dev:hover { filter: brightness(.96); box-shadow: 0 0 0 2px #fff inset; }
.dev.t-서버 { background: var(--t-server); border-color: var(--t-server-b); }
.dev.t-스토리지 { background: var(--t-storage); border-color: var(--t-storage-b); }
.dev.t-네트워크 { background: var(--t-network); border-color: var(--t-network-b); }
.dev.t-보안 { background: var(--t-security); border-color: var(--t-security-b); }
.dev.t-UPS { background: var(--t-ups); border-color: var(--t-ups-b); }
.dev.t-기타 { background: var(--t-etc); border-color: var(--t-etc-b); }
.dev.um { background-image: repeating-linear-gradient(135deg, rgba(255,255,255,.55) 0 5px, transparent 5px 10px); border-style: dashed; color: #4b5260; }
.dev.st-고장 { box-shadow: inset 4px 0 0 var(--bad); }
.dev.st-예비 { opacity: .7; }
.dev.r-일치 { outline: 2px solid var(--ok); outline-offset: -2px; }
.dev.r-불일치 { outline: 2px solid #e09a2a; outline-offset: -2px; }
.dev.r-미발견 { outline: 2px solid var(--bad); outline-offset: -2px; opacity: .6; }
.dev.r-신규 { outline: 2px solid var(--accent); outline-offset: -2px; }
.dev.sel { box-shadow: 0 0 0 3px #ffd34d; }
.rack-f { padding: 6px 10px; font-size: 11px; color: var(--ink-2); border-top: 1px solid var(--line); display: flex; justify-content: space-between; }
.unracked { margin-top: 12px; }
.unracked h4 { margin: 0 0 6px; }
.eq-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.eq-chips .dev { margin: 0; height: 30px; }

.eq-table { width: 100%; border-collapse: collapse; background: var(--surface); }
.eq-table th { text-align: left; font-size: 12px; color: var(--ink-2); background: #f8f9fb; padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; }
.eq-table td { padding: 7px 8px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.eq-table tr { cursor: pointer; }
.eq-table tr:hover td { background: #f7f9fd; }
.eq-table tr.um td { color: var(--ink-2); }

.rec-mini { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.rec-mini .ri { display: grid; grid-template-columns: 92px 1fr auto; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--line-2); cursor: pointer; }
.rec-mini .ri:hover { background: #f7f9fd; }
.rec-mini .ri:last-child { border-bottom: 0; }

/* 실사 목록 */
.audit-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.audit-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; color: var(--ink); text-decoration: none; display: block; }
.audit-card:hover { border-color: var(--accent); }
.audit-card .t { font-weight: 700; display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.audit-card .m { color: var(--ink-2); font-size: 12px; margin: 4px 0 8px; }
.progress { height: 8px; background: var(--line-2); border-radius: 4px; overflow: hidden; flex: 1; }
.progress span { display: block; height: 100%; background: var(--ok); border-radius: 4px; transition: width .2s; }
.progress-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.chips button { height: 28px; padding: 0 10px; border-radius: 14px; background: #fff; color: var(--ink-2); border-color: var(--line); font-weight: 600; font-size: 12px; }
.chips button.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.chips button .n { margin-left: 4px; opacity: .8; font-variant-numeric: tabular-nums; }
.chips.racks button.done { border-color: var(--ok); }

.audit-body { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 14px; align-items: start; margin-top: 6px; }
.audit-rack { position: sticky; top: 68px; }
.audit-rack .rack { width: 100%; }
.check-list { display: flex; flex-direction: column; gap: 8px; }
.ci { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; display: grid; grid-template-columns: 56px 1fr auto; gap: 4px 12px; align-items: center; }
.ci.sel { border-color: #f0c33c; box-shadow: 0 0 0 2px #fff3c4; }
.ci .u { font-weight: 800; font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: 12px; }
.ci .nm { font-weight: 700; min-width: 0; }
.ci .nm .sub-t { font-weight: 400; }
.ci .res { display: flex; gap: 4px; }
.ci .res button { height: 34px; padding: 0 10px; background: #fff; color: var(--ink-2); border-color: var(--line); font-weight: 700; }
.ci .res button.on.r-일치 { background: var(--ok); border-color: var(--ok); color: #fff; }
.ci .res button.on.r-불일치 { background: #e09a2a; border-color: #e09a2a; color: #fff; }
.ci .res button.on.r-미발견 { background: var(--bad); border-color: var(--bad); color: #fff; }
.ci .extra { grid-column: 2 / -1; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ci .extra input { flex: 1; min-width: 160px; height: 30px; }
.ci .extra button { height: 30px; padding: 0 10px; }
.ci .chg { grid-column: 2 / -1; font-size: 12px; color: var(--warn); }
.ci.r-일치 { border-left: 4px solid var(--ok); }
.ci.r-불일치 { border-left: 4px solid #e09a2a; }
.ci.r-미발견 { border-left: 4px solid var(--bad); }
.ci.r-신규 { border-left: 4px solid var(--accent); }
.ci .nm .chip { margin-left: 6px; vertical-align: 1px; }
.closed-banner { background: var(--ok-soft); color: var(--ok); padding: 8px 12px; border-radius: 6px; margin-bottom: 8px; font-weight: 600; display: flex; justify-content: space-between; align-items: center; }

/* ── 대시보드 ───────────────────────────── */
.filters.compact { margin-bottom: 14px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.card .k { font-size: 12px; color: var(--ink-2); font-weight: 600; }
.card .v { font-size: 26px; font-weight: 800; margin-top: 2px; font-variant-numeric: tabular-nums; }
.card .v small { font-size: 13px; font-weight: 600; color: var(--ink-3); margin-left: 3px; }
.card.alert .v { color: var(--bad); }
.card.warn .v { color: var(--warn); }
.panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 12px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; min-width: 0; }
.panel.wide { grid-column: 1 / -1; }
.panel h3 { margin: 0 0 10px; font-size: 14px; }
.bars .row { display: grid; grid-template-columns: 130px 1fr 44px; align-items: center; gap: 8px; margin: 5px 0; font-size: 12px; }
.bars .row .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.bars .row .track { display: block; height: 14px; background: var(--line-2); border-radius: 3px; overflow: hidden; }
.bars .row .fill { display: block; height: 100%; background: var(--navy-2); border-radius: 3px; }
.bars .row .n { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.cols { display: flex; align-items: flex-end; gap: 10px; height: 180px; padding-top: 18px; }
.cols .col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.cols .bar { width: 100%; max-width: 46px; background: var(--accent); border-radius: 4px 4px 0 0; position: relative; }
.cols .bar span { position: absolute; top: -17px; left: 50%; transform: translateX(-50%); font-size: 11px; font-weight: 700; }
.cols .col small { margin-top: 5px; font-size: 11px; color: var(--ink-3); }
.alert-row { display: flex; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line-2); }
.alert-row:last-child { border-bottom: 0; }
.alert-row a { font-weight: 700; text-decoration: none; }

/* ── 보고서/설정 ───────────────────────────── */
.stack { display: flex; flex-direction: column; gap: 10px; }
.stack label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; font-weight: 600; color: var(--ink-2); max-width: 360px; }
.hint { color: var(--ink-2); margin: 0 0 12px; }
.hint.small { font-size: 12px; margin-top: 10px; }
.week-label { font-weight: 700; color: var(--navy); min-height: 20px; }
.saved { margin: 0; padding-left: 18px; }
.saved li { margin: 4px 0; word-break: break-all; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 10px; margin: 0; font-size: 12px; }
.kv dt { color: var(--ink-2); font-weight: 600; }
.kv dd { margin: 0; word-break: break-all; }
.notes { margin: 0; padding-left: 18px; color: var(--ink-2); }
.notes li { margin: 4px 0; }
.ok-t { color: var(--ok); font-weight: 700; }
.bad-t { color: var(--bad); font-weight: 700; }
.qr-wrap { display: flex; gap: 14px; align-items: center; margin-bottom: 10px; }
.qr svg { width: 150px; height: 150px; display: block; }
.steps { margin: 0; padding-left: 18px; color: var(--ink-2); }
.steps li { margin: 4px 0; }
.mail-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 12px; }
.mail-grid label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.mail-grid label.chk { flex-direction: row; align-items: center; gap: 6px; color: var(--ink); }
.mail-grid .span2 { grid-column: span 2; }
.mail-grid .span-all { grid-column: 1 / -1; }
.mail-grid fieldset { border: 1px solid var(--line); border-radius: var(--radius); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 12px; padding: 8px 12px 12px; margin: 0; }
.mail-grid legend { font-size: 12px; font-weight: 700; color: var(--navy); padding: 0 4px; }
details.hint summary { cursor: pointer; font-weight: 600; color: var(--accent); margin: 10px 0 4px; }
.mail-log-item { display: flex; gap: 8px; }

/* ── 대화상자 ───────────────────────────── */
dialog { border: 0; border-radius: 10px; padding: 0; width: min(920px, 96vw); max-height: 92vh; box-shadow: 0 20px 60px rgba(15,25,45,.35); }
dialog.small { width: min(480px, 96vw); }
dialog::backdrop { background: rgba(15,25,45,.45); }
dialog form { display: flex; flex-direction: column; max-height: 92vh; }
dialog header { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
dialog header h2 { margin: 0; font-size: 16px; }
dialog .wno { font-family: Consolas, monospace; color: var(--ink-3); font-size: 12px; }
dialog .x { margin-left: auto; background: none; border: 0; color: var(--ink-2); font-size: 22px; padding: 0 6px; }
dialog .x:hover { background: var(--line-2); }
.form-grid { padding: 14px 18px; overflow: auto; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid.one { grid-template-columns: 1fr; }
.form-grid fieldset { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px 12px; margin: 0;
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; align-content: start; }
.form-grid.one fieldset { border: 0; padding: 0; }
.form-grid fieldset.full, .form-grid > .full { grid-column: 1 / -1; }
.form-grid legend { font-size: 12px; font-weight: 700; color: var(--navy); padding: 0 4px; }
.form-grid label { display: flex; flex-direction: column; gap: 3px; font-size: 11px; font-weight: 600; color: var(--ink-2); min-width: 0; }
.form-grid label.chk { flex-direction: row; align-items: center; gap: 6px; font-size: 12px; color: var(--ink); }
.form-grid .full { grid-column: 1 / -1; }
.form-grid input, .form-grid select, .form-grid textarea { width: 100%; }
.form-grid input[type=checkbox] { width: 16px; }
dialog footer { display: flex; gap: 6px; padding: 12px 18px; border-top: 1px solid var(--line); background: #fafbfc; }
.eq-history:empty { display: none; }
.eq-history { border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px; max-height: 220px; overflow: auto; }
.eq-history h4 { margin: 0 0 6px; }
.eq-history .hi { display: grid; grid-template-columns: 84px 90px 1fr auto; gap: 8px; font-size: 12px; padding: 4px 0; border-bottom: 1px solid var(--line-2); }
#dlg-eq:not(.managed-off) .owner-row { display: none; }
#dlg-eq:not(.audit-mode) .audit-only { display: none; }
#dlg-audit:not(.is-new) .new-only, #dlg-audit:not(.is-new) .cust-pick { display: none; }
#dlg-mail:not(.weekly) .weekly-only { display: none; }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 13px;
  opacity: 0; pointer-events: none; transition: .2s; max-width: 90vw; z-index: 400;
}
.toast.show { opacity: 1; transform: translateX(-50%); }
.toast.err { background: var(--bad); }

/* ═════════ 태블릿 ═════════ */
@media (max-width: 1100px) {
  .tabs a { padding: 0 9px; }
  .conn span, .badge { display: none; }
  .split { grid-template-columns: 260px minmax(0, 1fr); }
  .mail-grid, .mail-grid fieldset { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ═════════ 휴대폰 ═════════ */
@media (max-width: 760px) {
  body { font-size: 14px; }
  .topbar { display: none; }
  main { padding: 10px 12px calc(84px + var(--safe-b)); }
  .m-head { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 10px; min-height: 36px; }
  .m-only { display: revert; }
  .detail-head .back.m-only { display: grid; }
  .desk { display: none !important; }
  input, select, textarea { height: 40px; font-size: 16px; }   /* iOS 확대 방지 */
  textarea { height: auto; }
  button { height: 40px; }

  .bottomnav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: #fff; border-top: 1px solid var(--line); padding-bottom: var(--safe-b);
  }
  .bottomnav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 0 6px;
    color: var(--ink-3); text-decoration: none; font-size: 10.5px; font-weight: 600; }
  .bottomnav a.active { color: var(--navy); }
  .bottomnav svg { width: 22px; height: 22px; }
  .fab { display: grid; place-items: center; position: fixed; right: 16px; bottom: calc(74px + var(--safe-b)); z-index: 25;
    width: 54px; height: 54px; border-radius: 50%; padding: 0; background: var(--accent); border-color: var(--accent);
    box-shadow: 0 6px 18px rgba(47,111,222,.4); }
  .fab svg { width: 26px; height: 26px; }
  .fab.hide { display: none; }
  #view-more.active { display: block; }
  .more-list { display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
  .more-list a { display: flex; gap: 12px; align-items: center; padding: 16px; color: var(--ink); text-decoration: none; font-weight: 600; border-bottom: 1px solid var(--line-2); }

  .filters.collapsible { display: none; }
  .filters.collapsible.open { display: flex; }
  .filters label, .filters label.grow { flex: 1 1 100%; }
  .filters label select { width: 100%; }
  .range input { flex: 1 1 0; min-width: 0; font-size: 14px; padding-left: 8px; padding-right: 4px; }
  #dash-filters .actions { display: none; }   /* 휴대폰: 날짜·빠른 버튼을 바꾸면 바로 적용 */
  #dash-filters .quick { display: flex; gap: 6px; } #dash-filters .quick button { flex: 1; }
  .filters .actions { margin-left: 0; width: 100%; justify-content: flex-end; }
  .toolbar { margin: 10px 0 8px; }

  .table-wrap { background: none; border: 0; overflow: visible; }
  .grid { display: none; }
  .cards-list { display: flex; flex-direction: column; gap: 8px; }
  .rc { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
  .rc .top { display: flex; gap: 6px; align-items: center; justify-content: space-between; }
  .rc .top b { font-size: 14px; }
  .rc .mid { margin: 4px 0; }
  .rc .bot { display: flex; gap: 8px; flex-wrap: wrap; color: var(--ink-3); font-size: 12px; }

  .split { display: block; }
  .cust-side { position: static; max-height: none; border: 0; background: none; }
  .side-head { padding: 0 0 10px; border: 0; }
  .side-head h1 { width: 100%; margin-bottom: 6px; }
  .cust-list { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
  .cust-list li a.active { background: none; box-shadow: none; }
  body.cust-open .cust-side { display: none; }
  body:not(.cust-open) .cust-main { display: none; }
  .detail-head .actions { width: 100%; }
  .detail-head .actions button { flex: 1; }
  .dh-title { min-width: 0; }

  .rack { width: 220px; }
  .audit-body { display: block; }
  .audit-rack { display: none; }
  .audit-body.show-rack .audit-rack { display: block; position: static; margin-bottom: 10px; }
  .ci { grid-template-columns: 44px 1fr; }
  .ci .res { grid-column: 1 / -1; }
  .ci .res button { flex: 1; height: 42px; }
  .ci .extra { grid-column: 1 / -1; }
  .audit-list { grid-template-columns: 1fr; }
  .detail-head .actions.wrap button { flex: 1 1 30%; }

  .panels { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr 1fr; }
  .card .v { font-size: 22px; }
  .bars .row { grid-template-columns: 90px 1fr 36px; }
  .mail-grid, .mail-grid fieldset { grid-template-columns: 1fr; }
  .mail-grid .span2 { grid-column: auto; }
  .qr-wrap { flex-direction: column; align-items: flex-start; }

  dialog, dialog.small { width: 100vw; max-width: 100vw; height: 100%; max-height: 100%; margin: 0; border-radius: 0; }
  dialog form { max-height: 100%; height: 100%; }
  dialog footer { padding-bottom: calc(12px + var(--safe-b)); flex-wrap: wrap; }
  .form-grid, .form-grid.two { grid-template-columns: 1fr; flex: 1; padding: 12px; }
  .form-grid fieldset { grid-template-columns: 1fr 1fr; }
  .eq-history .hi { grid-template-columns: 76px 1fr; }
}
@media (display-mode: standalone) and (min-width: 761px) {
  .topbar { padding-top: env(titlebar-area-height, 0); }
}

/* ═════════ 0.3: 로그인 · 권한 · 스캔 ═════════ */
body[data-role="viewer"] [data-min-role="engineer"],
body:not([data-role="admin"]) [data-min-role="admin"] { display: none !important; }
body.locked { overflow: hidden; }
body.locked .bottomnav, body.locked .fab { display: none !important; }

.login-screen { position: fixed; inset: 0; z-index: 200; background: linear-gradient(160deg, #1f3864, #2c4a80 55%, #f4f5f7 55.1%); display: grid; place-items: center; padding: 16px; overflow: auto; }
.login-box { width: min(400px, 100%); background: #fff; border-radius: 14px; padding: 26px 24px; box-shadow: 0 20px 60px rgba(15,25,45,.25); }
.login-brand { display: flex; gap: 12px; align-items: center; margin-bottom: 18px; }
.login-brand img { width: 46px; height: 46px; border-radius: 10px; }
.login-brand b { display: block; font-size: 18px; color: var(--navy); }
.login-brand span { color: var(--ink-2); font-size: 12px; }
.login-box h2 { font-size: 16px; margin: 0 0 4px; }
.login-box .stack label { max-width: none; }
.login-box .stack input { height: 40px; }
.login-box .stack button { height: 42px; }
.sso-note { background: var(--accent-soft); color: var(--navy); border-radius: 8px; padding: 10px 12px; font-size: 12px; }

.user-menu { position: relative; margin-left: 8px; }
.user-chip { display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px; background: rgba(255,255,255,.1); border-color: transparent; font-weight: 600; }
.user-chip:hover { background: rgba(255,255,255,.18); }
.user-chip svg { width: 16px; height: 16px; }
.user-chip em { font-style: normal; font-size: 10px; padding: 0 6px; border-radius: 8px; background: rgba(255,255,255,.2); }
.user-pop { position: absolute; right: 0; top: 42px; width: 230px; background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 30px rgba(15,25,45,.18); padding: 6px; z-index: 30; }
.user-pop .up-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line-2); margin-bottom: 4px; }
.user-pop .up-head b { display: block; }
.user-pop .up-head span { font-size: 11px; color: var(--ink-3); word-break: break-all; }
.user-pop button { display: block; width: 100%; text-align: left; background: none; border: 0; color: var(--ink); font-weight: 500; height: 36px; border-radius: 6px; }
.user-pop button:hover { background: var(--line-2); }

.with-btn { display: flex; gap: 6px; }
.with-btn input { flex: 1; min-width: 0; }
.with-btn .icon-btn { width: 34px; height: 32px; flex: none; }
.with-btn .icon-btn svg { width: 18px; height: 18px; }
.form-grid fieldset.spec { grid-template-columns: 1fr 1fr; }
.scan-preview { width: 100%; max-height: 260px; object-fit: contain; background: #111; border-radius: 8px; }
.cands { display: flex; flex-wrap: wrap; gap: 6px; }
.cand { height: auto; padding: 6px 10px; background: #fff; color: var(--ink); border: 1px solid var(--accent); border-radius: 8px; display: flex; flex-direction: column; align-items: flex-start; gap: 0; }
.cand:hover { background: var(--accent-soft); }
.cand .mono { font-size: 14px; font-weight: 700; }
.cand small { color: var(--ink-3); font-size: 10px; font-weight: 500; }
.pair-qr { display: grid; place-items: center; }
.pair-qr svg { width: 220px; height: 220px; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.inline-form input, .inline-form select { flex: 1 1 160px; }
pre.raw { background: #0f1729; color: #d6e2ff; padding: 10px; border-radius: 8px; font-size: 11px; max-height: 260px; overflow: auto; white-space: pre-wrap; }
pre.raw:empty { display: none; }
#users-table select { height: 28px; }

@media (max-width: 760px) {
  .user-menu { display: none; }
  .with-btn .icon-btn { width: 44px; height: 40px; }
  .form-grid fieldset.spec { grid-template-columns: 1fr; }
  .login-screen { background: linear-gradient(170deg, #1f3864, #2c4a80 40%, #f4f5f7 40.1%); }
}
/* 0.3.1 접수일지 */
.with-btn button.sm { flex: none; padding: 0 10px; height: 32px; font-size: 12px; }
@media (max-width: 760px) { .with-btn button.sm { height: 40px; } }
.chip.itd { background: #fff1e0; color: #a55a00; }
.cls-row { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; align-items: center; }
.cls-row label { flex-direction: row !important; align-items: center; gap: 5px !important; font-weight: 500 !important; color: var(--ink) !important; }
.cls-row input.etc { width: 180px !important; }
.dlv table { width: 100%; border-collapse: collapse; font-size: 12px; }
.dlv th { text-align: left; font-weight: 600; color: var(--ink-2); padding: 2px 4px; }
.dlv td { padding: 2px; }
#dlv-rows td:nth-child(1) { width: 18%; } #dlv-rows td:nth-child(3) { width: 18%; } #dlv-rows td:nth-child(4) { width: 9%; } #dlv-rows td:nth-child(5) { width: 30px; }
#trip-rows td:nth-child(1) { width: 17%; } #trip-rows td:nth-child(2) { width: 12%; } #trip-rows td:nth-child(4), #trip-rows td:nth-child(5), #trip-rows td:nth-child(6) { width: 12%; } #trip-rows td:nth-child(7), #part-rows td:nth-child(4) { width: 30px; }
#part-rows td:nth-child(2) { width: 18%; }
.dlv input { width: 100%; }
.dlv .x { border: 0; background: none; color: var(--ink-2); cursor: pointer; font-size: 16px; }
.rpt-fault[hidden], .rpt-install[hidden] { display: none; }
@media (max-width: 760px) { .dlv thead { display: none; } .dlv tr { display: grid; grid-template-columns: 1fr 1fr 60px 30px; gap: 2px; margin-bottom: 6px; } #dlv-rows td:nth-child(2) { grid-column: 1 / -1; grid-row: 1; } .dlv td { width: auto !important; }
  #trip-rows tr { grid-template-columns: 1fr 1fr 1fr 30px; } #trip-rows td:nth-child(3) { grid-column: 1 / -1; grid-row: 2; }
  .trip-head { grid-template-columns: 1fr 1fr !important; } }
.bundle-recs { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; max-height: 180px; overflow: auto; font-size: 12px; }
.bundle-recs label { flex-direction: row !important; align-items: center; gap: 6px !important; font-weight: 500 !important; color: var(--ink) !important; }
.bundle-files { margin: 0; padding-left: 18px; color: var(--ink-2); font-size: 12px; }
.trip-head { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
.sum-t { width: 100%; border-collapse: collapse; font-size: 13px; }
.sum-t td { padding: 4px 6px; border-bottom: 1px solid var(--line); }
.sum-t .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sum-t .tot td { font-weight: 700; border-bottom: 0; }
input.warn-in { border-color: var(--warn) !important; background: var(--warn-soft); }
/* 일정 */
.agenda-bar { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; padding: 0 0 10px; }
.agenda { display: flex; flex-direction: column; gap: 10px; max-width: 820px; padding-bottom: 90px; }
.ag-day { background: var(--card, #fff); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; scroll-margin-top: 70px; }
.ag-day > header { display: flex; align-items: center; gap: 6px; padding: 8px 12px; background: var(--bg-2, #f6f7f9); border-bottom: 1px solid var(--line); }
.ag-date { font-weight: 700; font-size: 15px; } .ag-date em { font-style: normal; font-weight: 500; color: var(--ink-2); margin-left: 2px; }
.ag-day.sun .ag-date, .ag-day.sun .ag-date em { color: var(--bad); } .ag-day.sat .ag-date em { color: var(--accent); }
.ag-day.today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.ag-day.past { opacity: .82; }
.ag-add { border: 0; background: none; font-size: 20px; line-height: 1; color: var(--accent); cursor: pointer; padding: 0 4px; }
.ag-item { padding: 9px 12px 9px 14px; border-top: 1px solid var(--line); border-left: 4px solid var(--accent); cursor: pointer; }
.ag-item:first-of-type { border-top: 0; }
.ag-item.st-완료 { border-left-color: var(--ok); } .ag-item.st-예정 { border-left-color: var(--accent); background: var(--accent-soft); }
.ag-item.st-부품대기 { border-left-color: var(--warn); } .ag-item.st-보류 { border-left-color: var(--mute, #9aa3b2); }
.ag-item.k-insp { border-left-color: #7b5cd6; } .ag-item.k-contract { border-left-color: var(--bad); }
.ag-main { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 14px; }
.ag-chips { margin-left: auto; display: inline-flex; gap: 4px; }
.ag-sub { font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.ag-who { font-size: 12px; color: var(--ink-2); margin-top: 2px; }
.ag-none { padding: 8px 14px; font-size: 12px; color: var(--ink-2); }
.chip.trip { background: #efe9fb; color: #6741c7; } .chip.hol { background: var(--bad-soft); color: var(--bad); }
.chip.s-예정 { background: var(--accent-soft); color: var(--accent); border: 1px dashed var(--accent); }
@media (max-width: 760px) { .agenda-bar .seg button { padding: 6px 10px; } .ag-chips { margin-left: 0; } }
.form-err { margin: 0; padding: 8px 10px; border-radius: 6px; background: var(--bad-soft); color: var(--bad); font-size: 13px; }
@media (max-width: 760px) { .table-wrap.x-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; } .panel { min-width: 0; } }
.mail-sig { border-top: 2px solid var(--ink); padding-top: 6px; font-size: 12px; line-height: 1.6; color: var(--ink-2); white-space: pre-line; }
.mail-sig:empty { display: none; }
