/* 홈 화면 (home.js · notices.js) + 흡착분해제 D-day 배지 · 상세 "제품 정보"·"흡착분해제" 칸 (adsorbent.js) */
@keyframes home-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* 홈은 내용 폭을 줄여 가운데로 — 양옆 여백 */
#home-view { max-width: 1440px; margin: 0 auto; padding-top: 30px; } /* 헤더와 띄움 */

/* 맨 위 홍보 영상 — 박스를 영상과 같은 16:9 로 (안 잘리게, 폭에 맞춰 커짐), 누르거나 고를 수 없게 */
.home-hero { position: relative; aspect-ratio: 16 / 9; margin-bottom: 40px; overflow: hidden; border-radius: var(--radius); background: #0f1a24; box-shadow: var(--raised); animation: home-rise 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.home-hero video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }

/* 전광판 (ticker.js) — 테마와 상관없이 검은 판에 LED 글씨: 설비이상·네트워크 이상 빨강 · 정상 초록 */
.ticker { position: relative; display: flex; align-items: center; height: 54px; margin-bottom: 20px; overflow: hidden; border-radius: 14px; background: #06080b; box-shadow: var(--raised), inset 0 0 0 1px rgba(255, 255, 255, 0.05), inset 0 0 20px rgba(0, 0, 0, 0.9); animation: home-rise 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.ticker::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(circle, transparent 1px, rgba(6, 8, 11, 0.28) 1.4px) 0 0 / 3px 3px; } /* 글씨 위 옅은 점 격자 = LED 알 (진하면 글씨가 안 읽혀서 옅게) */
.ticker-track { display: flex; flex: none; width: max-content; will-change: transform; }
.ticker-group { display: flex; flex: none; align-items: center; }
.ticker-item { --glow: 255, 77, 66; color: rgb(var(--glow)); font-size: 21px; font-weight: 700; letter-spacing: 0.12em; word-spacing: 0.25em; white-space: nowrap; text-decoration: none; text-shadow: 0 0 4px rgba(var(--glow), 0.9), 0 0 14px rgba(var(--glow), 0.45); }
.ticker-item.ok { --glow: 60, 255, 122; }
.ticker-item .msg { min-height: 0; color: inherit; font-weight: inherit; } /* 공용 .msg(폼 안내 글: 얇은 빨강)를 안 따라가게 — 이상 내용도 LED 빨강 굵은 글씨 */
.ticker-item .name { color: #f2f4f7; text-shadow: 0 0 4px rgba(255, 255, 255, 0.55), 0 0 12px rgba(255, 255, 255, 0.2); } /* 에러 때 현장 이름은 흰 글씨 */
.ticker-sep { flex: none; width: 6px; height: 6px; margin: 0 80px; border-radius: 50%; background: #555b63; }

.home-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 40px; }
.home-card { display: flex; flex-direction: column; min-width: 0; padding: 22px 26px; animation: home-rise 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both; animation-delay: calc(var(--i, 0) * 70ms + 100ms); }
.home-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.home-head h2 { margin: 0; font-size: 18px; font-weight: 800; letter-spacing: -0.01em; }
.home-head .sub { color: var(--muted); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.home-head .right { display: flex; align-items: center; gap: 10px; }
.home-head .btn.mini { text-decoration: none; }

/* 작은 지도 */
.mini-map { position: relative; flex: 1; min-height: 520px; overflow: hidden; border-radius: 18px; box-shadow: var(--inset); }
.mini-map-canvas { position: absolute; inset: 0; }
.mini-map-canvas img[src*="/tile/"] { filter: grayscale(0.55) brightness(1.03); }
/* 작은 지도 검색 — 왼쪽 위 한 줄 [시/도][검색어] */
.mini-search { position: absolute; top: 14px; left: 14px; z-index: 3; display: flex; gap: 8px; width: min(440px, calc(100% - 80px)); padding: 8px; border-radius: 16px; background: var(--bg); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.14); }
.mini-search select { flex: none; width: 130px; padding: 9px 30px 9px 12px; font-size: 13px; background-position: right 10px center; }
.mini-search input { flex: 1; min-width: 0; padding: 9px 14px; font-size: 13px; }
.mini-chips { position: absolute; right: 14px; bottom: 14px; left: 14px; z-index: 2; display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 10px 16px; border-radius: 14px; background: var(--bg); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.14); font-size: 13px; font-weight: 700; pointer-events: none; }
.mini-chips span { display: inline-flex; align-items: center; gap: 6px; }
.mini-chips i { width: 9px; height: 9px; border-radius: 50%; }
.mini-chips b { font-variant-numeric: tabular-nums; }
.chip-run i { background: var(--c-h2s); }
.chip-done i { background: var(--ok); }
.chip-error i, .chip-stale i { background: var(--bad); }

/* D-day 배지 — 지남 빨강 / 30일 이내 주황 / 그 밖 회색 (홈 목록·상세 흡착분해제 칸 공용) */
.dday-badge { display: inline-block; min-width: 66px; padding: 6px 10px; border-radius: 10px; background: var(--faint); color: #fff; font-size: 14px; font-weight: 800; text-align: center; font-variant-numeric: tabular-nums; }
.dday-badge.late { background: var(--bad); }
.dday-badge.soon { background: var(--c-h2s); }

/* 홈 D-day 목록 */
.dday-sum { display: flex; gap: 8px; }
.dday-sum span { padding: 4px 10px; border-radius: 999px; box-shadow: var(--inset); font-size: 12px; font-weight: 800; }
.dday-sum .late { color: var(--bad); }
.dday-sum .soon { color: var(--c-h2s); }
/* 목록은 카드 아래 끝까지 채움 — contain: size 로 목록 길이가 카드(옆 지도 카드와 같은 줄) 높이를 늘리지 않게, 넘치면 스크롤 */
.dday-list { flex: 1; min-height: 240px; margin: 0; padding: 0; overflow-y: auto; list-style: none; contain: size; }
.dday-list li + li { border-top: 1px solid var(--line); }
#home-dday-msg:empty { display: none; } /* 안내가 없을 땐 목록이 카드 아래 끝까지 */
.dday-list.is-empty { display: flex; align-items: center; justify-content: center; max-height: none; min-height: 200px; }
.dday-list li.empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 18px 4px; color: var(--faint); font-size: 13px; text-align: center; }
.dday-list li.empty b { color: var(--muted); font-size: 15px; }
.dday-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 14px; padding: 11px 6px; border-radius: 10px; color: inherit; text-decoration: none; transition: background 0.15s ease; }
.dday-row:hover { background: var(--hover); }
.dday-row .name { overflow: hidden; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.dday-row .when { grid-column: 1; overflow: hidden; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; } /* 한 줄 — 현장명과 두 줄 */
.dday-row .dday-badge { grid-column: 2; grid-row: 1 / span 2; }

/* 공지사항 */
.notice-list { margin: 0; padding: 0; list-style: none; }
.notice-list li + li { border-top: 1px solid var(--line); }
.notice-list li.empty { padding: 18px 4px; color: var(--faint); }
.notice-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; padding: 12px 6px; border: 0; border-radius: 10px; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; transition: background 0.15s ease; }
.notice-row:hover { background: var(--hover); }
.notice-row:focus-visible { outline: 2px solid var(--on); outline-offset: 2px; }
.notice-row .t { overflow: hidden; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.notice-row .d { flex: none; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.notice-dialog { width: min(1200px, calc(100vw - 32px)); }
/* 공지 글 보기 페이지 (#/notices/{id}) — 큰 제목 · 정보 표 · 본문 칸 · 아래 버튼 (목록 왼쪽, 수정 · 삭제 오른쪽) */
.np-post { padding-top: var(--s3); }
.np-post-title { margin: 0 0 var(--s3); font-size: 28px; font-weight: 700; line-height: 1.35; letter-spacing: -0.02em; word-break: keep-all; }
.np-post-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: var(--s3); }
.np-post-actions > a.btn { margin-right: auto; }
.nv-download { padding: 0; border: 0; background: none; color: var(--on); font: inherit; text-align: left; text-decoration: underline; text-underline-offset: 3px; overflow-wrap: anywhere; cursor: pointer; }
.nv-download:focus-visible { outline: 2px solid var(--on); outline-offset: 2px; border-radius: 2px; }
/* 본문 칸은 위 표에 붙여 한 판처럼 (표 아래 줄이 본문 칸 위 줄) */
.notice-content { min-height: 45vh; padding: 24px var(--s2); border: 1px solid var(--border); border-top: 0; font-size: 17px; line-height: 1.8; white-space: pre-wrap; word-break: keep-all; overflow-wrap: anywhere; }
.notice-dialog textarea { width: 100%; padding: 12px 16px; border: 0; border-radius: 14px; background: var(--bg); color: var(--text); font: inherit; resize: vertical; box-shadow: var(--inset); }
.notice-dialog textarea:focus-visible { outline: 2px solid var(--on); outline-offset: 3px; }

/* 바로가기 */
.links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.link-card { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; min-height: 150px; padding: 18px; border-radius: 18px; background: var(--bg); color: var(--text); text-align: center; text-decoration: none; box-shadow: var(--raised-sm); transition: box-shadow 0.15s ease, transform 0.15s ease, color 0.15s ease; }
.link-card:hover { color: var(--on); transform: translateY(-2px); }
.link-card:active { box-shadow: var(--inset); transform: none; }
.link-card svg { width: 40px; height: 40px; fill: none; stroke: var(--on); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.link-card b { font-size: 16px; }
.link-card small { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }

/* 상세 "제품 정보" */
.info-panel, .ad-panel { margin-top: 24px; padding: 22px 26px 24px; }
.info-panel h3, .ad-panel h3 { margin: 0 0 14px; font-size: 15px; font-weight: 800; }
.info-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.info-table th, .info-table td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.info-table tr:last-child th, .info-table tr:last-child td { border-bottom: 0; }
.info-table th { width: 15%; color: var(--muted); font-size: 13px; font-weight: 700; }
.info-table th .sub { display: block; color: var(--faint); font-size: 11px; font-weight: 600; }
.info-table td { font-weight: 600; font-variant-numeric: tabular-nums; }
.info-table td.empty { color: var(--faint); font-weight: 500; }

/* 상세 "흡착분해제" */
.ad-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.ad-head h3 { margin: 0; }
.ad-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; padding: 16px 20px; border-radius: 16px; box-shadow: var(--inset); }
.ad-summary > div { display: flex; flex-direction: column; justify-content: center; gap: 6px; min-width: 0; }
.ad-summary .label { color: var(--muted); font-size: 12px; font-weight: 600; }
.ad-summary b { font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; }
.ad-summary b.empty { color: var(--faint); font-weight: 600; }
.ad-summary .dday-badge { align-self: flex-start; }
.ad-form { margin-bottom: 8px; }

/* 홈 맨 아래 회사 정보 — 주소·전화·팩스 한 줄, 선 아래 저작권 */
.home-foot { margin-top: 64px; padding: 0 4px; font-size: 13px; }
.foot-logo { display: inline-block; margin-bottom: 18px; }
.foot-logo img { display: block; width: 258px; max-width: 100%; height: auto; }
.foot-logo .dark, :root[data-theme="dark"] .foot-logo .light { display: none; } /* 다크면 글씨 흰 로고 */
:root[data-theme="dark"] .foot-logo .dark { display: block; }
.foot-info { display: flex; flex-wrap: wrap; align-items: center; margin: 0; row-gap: 6px; }
.foot-info .item { display: inline-flex; align-items: baseline; gap: 8px; }
.foot-info .item + .item::before { content: ''; align-self: center; width: 1px; height: 10px; margin: 0 14px; background: var(--faint); opacity: 0.6; }
.foot-info .k { flex: none; color: var(--faint); font-size: 12px; font-weight: 600; white-space: nowrap; }
.foot-info b, .foot-info a { color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; text-decoration: none; }
.foot-copy { margin: 20px 0 0; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }

@media (max-width: 1100px) {
  .home-grid { grid-template-columns: minmax(0, 1fr); }
  .dday-list { min-height: 0; max-height: 360px; contain: none; } /* 한 줄로 쌓이면 옆 카드가 없어 목록 길이대로 (360 까지) */
}
@media (max-width: 860px) {
  #home-view { padding-top: 12px; }
  .home-hero { margin-bottom: 20px; }
  .ticker { height: 44px; margin-bottom: 14px; }
  .ticker-item { font-size: 17px; }
  .ticker-sep { margin: 0 48px; }
  .home-foot { margin-top: 40px; }
  .foot-info { flex-direction: column; align-items: flex-start; } /* 폰: 주소·전화·팩스 한 줄씩, 사이 막대 없이 */
  .foot-info .item + .item::before { display: none; }
  .home-grid { gap: 20px; }
  .home-card { padding: 18px; }
  .mini-map { min-height: 260px; }
  .mini-chips { gap: 4px 10px; padding: 8px 12px; font-size: 12px; }
  .link-card { min-height: 120px; }
  .info-panel, .ad-panel { padding: 18px; }
  .info-table, .info-table tbody, .info-table tr { display: block; }
  .info-table tr { display: grid; grid-template-columns: 110px minmax(0, 1fr); border-bottom: 1px solid var(--line); }
  .info-table tr:last-child { border-bottom: 0; }
  .info-table th, .info-table td { display: block; width: auto; padding: 10px 8px; border-bottom: 0; }
  .ad-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 14px 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .home-hero, .home-card, .ticker { animation: none; }
}
.ad-panel .msg:empty { min-height: 0; } /* 안내 문구가 없을 땐 요약과 이력 표 사이를 띄우지 않음 */
.ops-table .dday-badge { min-width: 0; margin-top: 4px; padding: 2px 8px; border-radius: 8px; font-size: 12px; } /* 운영 통계 흡착분해제 칸 */
@media screen and (max-width: 860px) {
  .ops-table .ad-val { display: inline-flex; align-items: center; gap: 8px; }
  .ops-table .ad-val .line { display: inline; }
  .ops-table .ad-val .dday-badge { margin-top: 0; }
}

/* 헤더 "공지사항" (폰은 헤더가 좁아 홈 공지 칸 "전체 보기"로) */
.top-link { padding: 8px 14px; border-radius: 12px; color: var(--text); font-weight: 700; text-decoration: none; transition: color 0.15s ease, box-shadow 0.15s ease; }
.top-link:hover { color: var(--on); }
.top-link.active { color: var(--on); box-shadow: var(--inset); }
@media (max-width: 860px) { .top-link { display: none; } }

/* 공지 태그 — 상단 고정 */
.tag-pin { margin-right: 8px; padding: 1px 8px; border: 1.5px solid var(--text); border-radius: 999px; font-size: 11px; font-weight: 800; vertical-align: 1px; }

/* 공지사항 페이지 */
#notices-view { max-width: 1440px; margin: 0 auto; padding-top: 30px; }
.np-panel { padding: 26px 30px 24px; }
.np-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 18px; border-bottom: 2px solid var(--text); }
.np-head h2 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.np-search { display: flex; gap: 10px; margin: 22px 0 8px; }
.np-search select { width: 120px; flex: none; }
.np-search input { width: 320px; max-width: 100%; }
.np-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.np-table th, .np-table td { padding: 13px 10px; border-bottom: 1px solid var(--line); text-align: center; }
.np-table thead th { color: var(--faint); font-size: 13px; font-weight: 700; border-bottom-width: 2px; }
.np-table th.no, .np-table td.no { width: 72px; }
.np-table td.title { text-align: left; }
.np-table th.file, .np-table td.file { width: 22%; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.np-table th.author, .np-table td.author { width: 120px; }
.np-table th.date, .np-table td.date { width: 150px; color: var(--muted); font-size: 13px; }
.np-table th.views, .np-table td.views { width: 72px; color: var(--muted); }
.np-table tr.pinned td { background: var(--hover); }
.np-table tr.empty td { padding: 30px; color: var(--faint); }
.np-title { padding: 0; border: 0; background: none; color: var(--text); font: inherit; font-weight: 600; text-align: left; cursor: pointer; }
.np-title:hover { color: var(--on); }
.np-title:focus-visible { outline: 2px solid var(--on); outline-offset: 3px; border-radius: 4px; }
.np-title .tag-new, .notice-row .tag-new { margin-right: 8px; padding: 1px 7px; border-radius: 999px; background: var(--on); color: #fff; font-size: 11px; font-weight: 800; vertical-align: 1px; }
.notice-dialog label.switch { flex-direction: row; align-items: center; gap: 12px; color: var(--text); font-size: 14px; cursor: pointer; }
.notice-dialog input[type="file"] { padding: 10px 12px; font-size: 13px; }
/* 공지 첨부 여러 개 — 쓰기 창 목록(줄마다 ×) · 글 보기(줄마다 내려받기) · 목록 "외 N개" */
.ne-files { margin: 8px 0 0; padding: 0; border: 1px solid var(--border); border-radius: 6px; list-style: none; }
.ne-files li { display: flex; align-items: center; gap: 8px; padding: 4px 4px 4px 12px; font-size: 14px; }
.ne-files li + li { border-top: 1px solid var(--border); }
.ne-files .nf-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.ne-files .nf-new { flex: none; padding: 0 6px; border-radius: 4px; background: var(--sub-soft); color: var(--muted); font-size: 12px; line-height: 20px; }
.ne-file-x { flex: none; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 6px; background: none; color: var(--muted); font: inherit; font-size: 22px; line-height: 1; cursor: pointer; }
.ne-file-x:hover { background: var(--hover); color: var(--text); }
.ne-file-x:focus-visible { outline: 2px solid var(--on); outline-offset: 0; }
.nv-files .nv-download { display: block; }
.nv-files .nv-download + .nv-download { margin-top: 6px; }
.nf-more { color: var(--muted); font-size: 13px; white-space: nowrap; }
/* 계정 관리 (users.js, 관리자만) — 공지사항 표 모양 그대로 */
/* 칸 폭은 전부 비율로 (남는 폭이 한 칸에 몰리지 않게) — 이메일 · 전화번호 같은 폭 */
.us-table th.uid, .us-table td.uid { width: 15%; }
.us-table th.name, .us-table td.name { width: 10%; }
.us-table th.email, .us-table td.email { width: 20%; }
.us-table th.phone, .us-table td.phone { width: 20%; }
.us-table th.role, .us-table td.role { width: 8%; }
.us-table th.active, .us-table td.active { width: 8%; }
.us-table th.date, .us-table td.date { width: 10%; }
.us-table th.act, .us-table td.act { width: 9%; min-width: 140px; }
.us-table td.act .btn + .btn { margin-left: 6px; }
.us-table th .sort { justify-content: center; }
.us-table th.sorted { color: var(--text); }
.us-table tr.off td { color: var(--faint); } /* 비활성 계정 */
/* 알람 이력 (alarms.js) — 공지사항 표 모양 그대로, 칸 폭·색만 */
.al-sum { color: var(--muted); font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.al-sum.bad { color: var(--bad); }
.al-search select { width: 130px; flex: none; }
@media (min-width: 861px) { .al-search #al-dur { width: 156px; } } /* "전체 지속 시간"이 안 잘리게 */
.al-table th.state, .al-table td.state { width: 96px; }
.al-table th.site, .al-table td.site { text-align: left; }
.al-table th.kind, .al-table td.kind { width: 170px; } /* "LED 리시빙카드 이상" 한 줄 */
.al-table td.kind { font-weight: 700; }
.al-table th.date, .al-table td.date { width: 160px; }
.al-table th.dur, .al-table td.dur { width: 120px; color: var(--muted); font-size: 13px; }
.al-table th .sort { justify-content: center; } /* 머리글 정렬 단추 (style.css .sort) */
.al-table th.sorted { color: var(--text); }
.badge.done { background: var(--faint); } /* 해제 = 회색 */
@media (max-width: 860px) {
  #notices-view, #alarms-view { padding-top: 12px; }
  .al-search select { flex: 1 1 30%; width: auto; }
  .al-table td.state, .al-table td.kind { display: inline; margin-right: 8px; }
  .al-table td.dur { display: inline; font-size: 12px; }
  .al-table td.date::before, .al-table td.dur::before { content: attr(data-label) ' '; color: var(--faint); }
  .np-panel { padding: 18px; }
  .np-search { flex-wrap: wrap; }
  .np-search input { flex: 1; width: auto; min-width: 0; }
  .np-table thead { display: none; }
  .np-table, .np-table tbody, .np-table tr, .np-table td { display: block; width: auto !important; }
  .np-table tr { padding: 12px 4px; border-bottom: 1px solid var(--line); }
  .np-table td { padding: 2px 0; border: 0; text-align: left; }
  .np-table td.no:not(:has(.tag-pin)), .np-table td.file:empty, .np-table td.views { display: none; }
  .np-table td.author, .np-table td.date { display: inline; margin-right: 10px; color: var(--muted); font-size: 12px; }
}

/* 헤더 아래 옅은 구분선 (헤더가 위에 붙을 때도 경계가 보이게) */
.top { border-bottom: 1px solid var(--line); }
