:root {
  --bg: #0d1420;
  --panel: #131c2b;
  --panel-hover: #1a2536;
  --border: #223047;
  --text: #e6edf5;
  --text-dim: #8a96a8;
  --accent: #2dd4ee;
  --accent-ink: #06202a;
  --accent-dim: #17495a;
  --scan: #ff8a1f;   /* 사진분석 스캔 바(주황) — 파란 강조색과 겹치지 않게 */
  --danger: #ff6b6b;
  --input-bg: #0f1826;
  --shadow-card: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px -12px rgba(0,0,0,.5);
  --groove-shade: rgba(0,0,0,.85);
  --groove-light: rgba(255,255,255,.14);
  --alert-error-bg: #3a1a1a; --alert-error-border: #5a2a2a;
  --alert-ok-bg: #163a2a; --alert-ok-border: #245a3f; --alert-ok-text: #5ee0a0;
  --chart-grid: rgba(138,150,168,0.15);
  --chart-plan-bar: rgba(138,150,168,0.35);
  --chart-plan-line: #8a96a8;
  --chart-actual-bar: #2dd4ee;
  --chart-actual-fill: rgba(45,212,238,0.15);
  --page-glow: none;
  color-scheme: dark;
}

html[data-theme="light"] {
  --bg: #f2f4f7;
  --panel: #ffffff;
  --panel-hover: #eef1f5;
  --border: #dde3ea;
  --text: #1c2430;
  --text-dim: #6b7684;
  --accent: #0891a8;
  --accent-ink: #ffffff;
  --accent-dim: #d7edf2;
  --danger: #c23a3a;
  --input-bg: #ffffff;
  --shadow-card: 0 1px 2px rgba(20,20,20,.05), 0 10px 24px -14px rgba(20,20,20,.15);
  --groove-shade: rgba(20,32,52,.34);
  --groove-light: rgba(255,255,255,1);
  --alert-error-bg: #fbe7e7; --alert-error-border: #f0c4c4;
  --alert-ok-bg: #e3f5eb; --alert-ok-border: #bfe6d2; --alert-ok-text: #237a4e;
  --chart-grid: rgba(28,36,48,0.1);
  --chart-plan-bar: rgba(107,118,132,0.25);
  --chart-plan-line: #6b7684;
  --chart-actual-bar: #0891a8;
  --chart-actual-fill: rgba(8,145,168,0.15);
  --page-glow: none;
  color-scheme: light;
}

html[data-theme="ether"] {
  --bg: #060b16;
  --panel: #0b1730;
  --panel-hover: #101f3d;
  --border: rgba(0,242,254,0.22);
  --text: #e8fbff;
  --text-dim: #7fa7bd;
  --accent: #00f2fe;
  --accent-ink: #04121c;
  --accent-dim: #0d3d47;
  --danger: #ff5f6d;
  --input-bg: #081222;
  --shadow-card: 0 0 24px rgba(0,242,254,.08), 0 8px 24px -12px rgba(0,0,0,.6);
  --groove-shade: rgba(0,0,0,.9);
  --groove-light: rgba(0,242,254,.26);
  --alert-error-bg: #2a1420; --alert-error-border: #5a2a3a;
  --alert-ok-bg: #0d2a24; --alert-ok-border: #16493d; --alert-ok-text: #00ff9d;
  --chart-grid: rgba(0,242,254,0.14);
  --chart-plan-bar: rgba(127,167,189,0.25);
  --chart-plan-line: #7fa7bd;
  --chart-actual-bar: #00f2fe;
  --chart-actual-fill: rgba(0,242,254,0.18);
  --page-glow: radial-gradient(circle at 18% 8%, rgba(0,242,254,.09) 0%, transparent 45%),
               radial-gradient(circle at 82% 92%, rgba(0,255,135,.06) 0%, transparent 45%);
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg) var(--page-glow, none);
  background-attachment: fixed;
  color: var(--text);
  font-family: "맑은 고딕", "Segoe UI", sans-serif;
  transition: background-color .25s ease, color .25s ease;
}

html[data-theme="ether"] body { background-image: var(--page-glow); }
html[data-theme="ether"] .page-title,
html[data-theme="ether"] .brand span { text-shadow: 0 0 12px rgba(0,242,254,.5); }

.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 0;
  transition: background-color .25s ease, border-color .25s ease;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  margin-bottom: 20px;
  font-weight: 700;
  font-size: 18px;
  line-height: 1;
}
.brand .logo {
  width: 32px; height: 32px;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  flex-shrink: 0;
}

.theme-toggle {
  margin: 0 0 0 auto;
  width: 32px; height: 32px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-hover);
  color: var(--text-dim);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
}
.theme-toggle:hover { color: var(--text); border-color: var(--accent); }
.theme-toggle svg { width: 15px; height: 15px; }
.theme-toggle .icon-moon, .theme-toggle .icon-ether { display: none; }
html[data-theme="light"] .theme-toggle .icon-sun { display: none; }
html[data-theme="light"] .theme-toggle .icon-moon { display: block; }
html[data-theme="ether"] .theme-toggle .icon-sun { display: none; }
html[data-theme="ether"] .theme-toggle .icon-ether { display: block; }

.nav-section-label {
  color: var(--text-dim);
  font-size: 12px;
  padding: 14px 20px 6px;
}

.nav-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
}
.nav-item:hover { background: var(--panel-hover); }
/* 메뉴와 메뉴 사이 음각(파인 홈) 구분선: 위는 어둡게, 아래는 밝게 겹쳐 입체감을 준다 */
.nav-item + .nav-item { position: relative; }
.nav-item + .nav-item::before {
  content: "";
  position: absolute;
  top: 0;
  left: 14px;
  right: 14px;
  height: 2.6px;   /* 이전(위·아래 1px씩 = 2px)의 1.3배 */
  /* 어두운 면을 조금 더 두껍게(55%) 해서 깊게 파인 느낌을 준다 */
  background: linear-gradient(to bottom,
    var(--groove-shade) 0, var(--groove-shade) 55%,
    var(--groove-light) 55%, var(--groove-light) 100%);
  pointer-events: none;
}
.nav-item.active { background: var(--accent-dim); color: var(--accent); font-weight: 600; }
.nav-item.disabled { color: var(--text-dim); pointer-events: none; cursor: default; }

.badge-dev {
  font-size: 10px;
  background: #3a3020;
  color: #e0b84a;
  padding: 2px 6px;
  border-radius: 10px;
}

.sidebar-footer {
  margin-top: auto;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  font-size: 13px;
}
.sidebar-footer .name { font-weight: 600; }
.sidebar-footer .role { color: var(--text-dim); font-size: 12px; }
.sidebar-footer a { color: var(--text-dim); text-decoration: none; font-size: 12px; }

.main { flex: 1; min-width: 0; padding: 32px 40px; }

.mobile-topbar { display: none; }
.sidebar-backdrop { display: none; }

@media (max-width: 768px) {
  .mobile-topbar {
    display: flex; align-items: center; gap: 14px;
    padding: 12px 16px; background: var(--panel); border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 40;
  }
  .mobile-topbar .brand { font-weight: 700; font-size: 16px; margin-bottom: 0; }
  .hamburger {
    margin: 0;
    padding: 0;
    width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border);
    background: var(--panel-hover); color: var(--text); display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; cursor: pointer;
  }
  .hamburger svg { width: 18px; height: 18px; }

  .layout { position: relative; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 60;
    transform: translateX(-100%); transition: transform .2s ease;
    box-shadow: var(--shadow-card);
  }
  .layout.nav-open .sidebar { transform: translateX(0); }
  .layout.nav-open .sidebar-backdrop {
    display: block; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 50;
  }

  .main { padding: 16px; }
}

.page-title { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.page-subtitle { color: var(--text-dim); font-size: 14px; margin-bottom: 24px; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow-card);
  transition: background-color .25s ease, border-color .25s ease, box-shadow .25s ease;
}
.card .num { font-size: 28px; font-weight: 700; }
.card .label { color: var(--text-dim); font-size: 13px; margin-top: 4px; }
.card.dev { opacity: 0.5; }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  box-shadow: var(--shadow-card);
  transition: background-color .25s ease, border-color .25s ease, box-shadow .25s ease;
}

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: right; white-space: nowrap; }
th { color: var(--text-dim); font-weight: 600; position: sticky; top: 0; background: var(--panel); }
td.label-col, th.label-col { text-align: left; position: sticky; left: 0; background: var(--panel); }

.table-scroll { overflow-x: auto; max-height: 70vh; }

.site-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
}
.site-tab {
  flex-shrink: 0;
  max-width: 180px;
  padding: 9px 20px;
  border-radius: 10px 10px 0 0;
  background: var(--panel-hover);
  color: var(--text-dim);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  border: 1px solid var(--border);
  border-bottom: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: grab;
  transition: background-color .2s ease, color .2s ease;
}
.site-tab.dragging { opacity: 0.4; cursor: grabbing; }
.site-tab:hover { color: var(--text); }
.site-tab.active {
  background: var(--panel);
  color: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 -6px 16px -8px var(--accent);
}

.tab-bar { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.tab-item {
  padding: 10px 18px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab-item:hover { color: var(--text); }
.tab-item.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-item.disabled { color: var(--text-dim); opacity: 0.5; cursor: default; display: inline-flex; align-items: center; gap: 6px; }

.chart-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 16px;
  margin-bottom: 24px;
}
.chart-grid .panel { flex: 1 1 360px; display: flex; flex-direction: column; }
.chart-scroll { overflow-x: auto; overflow-y: hidden; flex: 1 1 auto; min-height: 260px; }
.chart-inner { height: 100%; }

.chart-legend { display: flex; gap: 18px; margin-bottom: 10px; }
.legend-item { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-dim); }
.legend-swatch { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }
.legend-swatch.plan { background: var(--chart-plan-bar); }
.legend-swatch.actual { background: var(--chart-actual-bar); }
.legend-swatch.plan-line {
  background: none; height: 2px; width: 14px; border-radius: 0;
  border-top: 2px dashed var(--chart-plan-line);
}
.panel-title { margin: 0 0 16px; font-size: 15px; }
.unit-note { font-size: 12px; font-weight: 400; color: var(--text-dim); }
.panel + .panel { margin-top: 24px; }

tr.row-subtotal td { font-weight: 700; background: var(--panel-hover); }

form.login-form, form.upload-form {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
  max-width: 360px;
  box-shadow: var(--shadow-card);
}

.login-wrap {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
}

label { display: block; font-size: 13px; color: var(--text-dim); margin: 12px 0 6px; }
input[type=text], input[type=tel], input[type=password], input[type=file], select {
  width: 100%;
  padding: 10px 12px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
}

button, .btn {
  margin-top: 18px;
  width: 100%;
  padding: 11px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}
button:hover { opacity: 0.9; }

.alert { padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; }
.alert-error { background: var(--alert-error-bg); color: var(--danger); border: 1px solid var(--alert-error-border); }
.alert-ok { background: var(--alert-ok-bg); color: var(--alert-ok-text); border: 1px solid var(--alert-ok-border); }

.upload-block { margin-bottom: 32px; }
.upload-block h3 { font-size: 15px; margin-bottom: 4px; }
.hint { color: var(--text-dim); font-size: 12px; }
.upload-block p.hint { margin: 0 0 12px; }

.upload-history { margin-top: 20px; max-width: 640px; }
.upload-history h4 { font-size: 13px; color: var(--text-dim); margin: 0 0 8px; font-weight: 600; }
.upload-history table { font-size: 12.5px; }
.upload-history th, .upload-history td { text-align: left; white-space: normal; padding: 6px 10px; }
.upload-history a.download-link { color: var(--accent); text-decoration: none; }
.upload-history a.download-link:hover { text-decoration: underline; }
.upload-history .muted { color: var(--text-dim); }

/* 품질점검 체크리스트 검색 화면 */
.quality-searchbar {
  display: flex; align-items: center; gap: 8px;
  background: var(--input-bg); border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px; max-width: 640px;
}
.quality-searchbar svg { flex-shrink: 0; color: var(--text-dim); }
.quality-searchbar input { border: none; background: transparent; outline: none; flex: 1; color: var(--text); font-size: 14px; font-family: inherit; }
.quality-searchbar input::placeholder { color: var(--text-dim); }

.quality-filters { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0; max-width: 640px; }
.quality-filters .field { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 140px; }
.quality-filters label { font-size: 12px; color: var(--text-dim); font-weight: 600; }
.quality-filters select {
  background: var(--input-bg); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 9px 10px; font-size: 13.5px; font-family: inherit;
}

.quality-result-count { color: var(--text-dim); font-size: 13px; margin-bottom: 10px; }

.quality-list { display: flex; flex-direction: column; gap: 10px; max-width: 640px; }
.quality-item { padding: 14px 16px; }
.quality-item .tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.quality-item .detail { font-size: 14px; line-height: 1.55; }
.quality-item .law { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 12px; color: var(--text-dim); }

.qtag { display: inline-flex; align-items: center; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 100px; white-space: nowrap; }
.qtag-field { background: var(--accent-dim); color: var(--accent); }
.qtag-large { background: var(--panel-hover); color: var(--text-dim); border: 1px solid var(--border); }
.qtag-medium { background: var(--panel-hover); color: var(--text); border: 1px solid var(--border); }

@media (max-width: 640px) {
  .main { padding: 20px 16px; }
  .quality-filters { flex-direction: column; }
  .quality-filters .field { min-width: 0; }
}

/* ===== 품질 > 사진분석 ===== */
.badge-ai {
  font-size: 10px; font-weight: 800; letter-spacing: .04em; padding: 2px 6px; margin-left: 4px; border-radius: 6px;
  background: linear-gradient(135deg, var(--accent), #7c9cff); color: var(--accent-ink); vertical-align: 1px;
}
.qp-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 18px; max-width: 1060px; }
.qp-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 18px;
  box-shadow: var(--shadow-card);
}
.qp-upload { display: flex; flex-direction: column; gap: 14px; }
.qp-drop {
  display: flex; align-items: center; justify-content: center; min-height: 260px; cursor: pointer; overflow: hidden;
  border: 2px dashed var(--border); border-radius: 14px; background: var(--input-bg); color: var(--text-dim);
  transition: border-color .2s ease, background-color .2s ease, box-shadow .2s ease;
}
.qp-drop:hover, .qp-drop.drag { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-dim); }
.qp-drop.has-file { border-style: solid; border-color: var(--accent); }
.qp-drop-empty { text-align: center; padding: 24px; }
.qp-drop-empty svg { color: var(--accent); margin-bottom: 10px; }
.qp-drop-title { font-size: 17px; font-weight: 700; color: var(--text); }
.qp-drop-sub { font-size: 12.5px; margin-top: 6px; line-height: 1.5; }
.qp-preview { display: block; width: 100%; max-height: 420px; object-fit: contain; background: #000; }
/* hidden 속성이 위 display 지정에 덮여 빈 미리보기가 공간을 차지하며 안내문을 왼쪽으로 밀던 문제 방지 */
.qp-preview[hidden], .qp-drop-empty[hidden] { display: none; }
.qp-form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.qp-field { display: flex; flex-direction: column; gap: 6px; min-width: 130px; }
.qp-grow { flex: 1; }
.qp-field label { font-size: 12px; font-weight: 600; color: var(--text-dim); }
.qp-field select, .qp-field input[type=text] {
  background: var(--input-bg); border: 1px solid var(--border); color: var(--text); border-radius: 8px;
  padding: 10px 12px; font-size: 14px; font-family: inherit; width: 100%;
}
.qp-go {
  display: flex; align-items: center; justify-content: center; gap: 8px; border: none; border-radius: 12px;
  padding: 15px 18px; font-size: 16px; font-weight: 800; cursor: pointer;
  background: linear-gradient(135deg, var(--accent), #7c9cff); color: var(--accent-ink);
  box-shadow: 0 8px 24px -10px var(--accent); transition: transform .15s ease, opacity .2s ease;
}
.qp-go:hover:not(:disabled) { transform: translateY(-1px); }
.qp-go:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.qp-go.busy { animation: qpPulse 1.1s ease-in-out infinite; }
@keyframes qpPulse { 50% { opacity: .6; } }

.qp-side { display: flex; flex-direction: column; gap: 14px; }
.qp-side-title { font-size: 14px; font-weight: 800; margin-bottom: 10px; }
.qp-steps-info { list-style: none; margin: 0; padding: 0; counter-reset: s; display: flex; flex-direction: column; gap: 12px; }
.qp-steps-info li { counter-increment: s; display: flex; flex-direction: column; gap: 2px; padding-left: 34px; position: relative; font-size: 13px; }
.qp-steps-info li::before {
  content: counter(s); position: absolute; left: 0; top: 0; width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent-dim); color: var(--accent); font-weight: 800; font-size: 12px;
  display: flex; align-items: center; justify-content: center;
}
.qp-steps-info li span { color: var(--text-dim); font-size: 12px; line-height: 1.45; }
.qp-badges, .qp-meta { display: flex; flex-wrap: wrap; gap: 8px; }
.qp-pill {
  display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text);
  background: var(--panel); border: 1px solid var(--border); border-radius: 100px; padding: 6px 12px;
}
.qp-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--alert-ok-text); box-shadow: 0 0 8px var(--alert-ok-text); }

.qp-section-title { font-size: 14px; font-weight: 800; margin: 26px 0 12px; }
.qp-recent { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; max-width: 1060px; }
.qp-recent-item { display: block; text-decoration: none; color: inherit; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.qp-recent-item:hover { border-color: var(--accent); }
.qp-recent-item img { display: block; width: 100%; height: 96px; object-fit: cover; }
.qp-recent-meta { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; font-size: 11.5px; }
.qp-recent-time { color: var(--text-dim); }
.qp-status { font-weight: 800; padding: 2px 8px; border-radius: 100px; }
.qp-s-done { background: var(--alert-ok-bg); color: var(--alert-ok-text); }
.qp-s-error { background: var(--alert-error-bg); color: var(--danger); }
.qp-s-pending, .qp-s-running { background: var(--accent-dim); color: var(--accent); }

.qp-result-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 20px; align-items: start; max-width: 1180px; }
.qp-left { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 16px; }
.qp-photo { position: relative; border-radius: 14px; overflow: hidden; border: 1px solid var(--border); background: #000; }
.qp-photo img { display: block; width: 100%; height: auto; }
/* 분석 중 스캔 바: 주황색 레이저 + 번지는 빛 + 사진 테두리 깜박임(눈에 잘 띄게) */
.qp-scan { box-shadow: 0 0 0 2px rgba(255,138,31,.55), 0 0 26px 2px rgba(255,138,31,.35); animation: qpScanFrame 1.2s ease-in-out infinite alternate; }
.qp-scan::after {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 6px; z-index: 2;
  background: linear-gradient(90deg, transparent 0%, var(--scan) 18%, #ffe2b3 50%, var(--scan) 82%, transparent 100%);
  box-shadow: 0 0 18px 5px rgba(255,138,31,.95), 0 0 46px 14px rgba(255,138,31,.45);
  animation: qpScan 2.4s ease-in-out infinite;
}
.qp-scan::before {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(255,138,31,.08) 0 2px, transparent 2px 6px);
}
@keyframes qpScan { 0% { top: 0; } 50% { top: calc(100% - 6px); } 100% { top: 0; } }
@keyframes qpScanFrame { from { box-shadow: 0 0 0 2px rgba(255,138,31,.35), 0 0 14px 0 rgba(255,138,31,.2); } to { box-shadow: 0 0 0 2px rgba(255,138,31,.85), 0 0 30px 4px rgba(255,138,31,.5); } }
/* 효과음 켜기/끄기 버튼 (전역 button 규칙의 100% 너비·여백을 덮어씀) */
.qp-snd { margin: 0; width: auto; padding: 3px 10px; font-size: 12px; font-weight: 700; border-radius: 999px; background: transparent; color: var(--scan); border: 1px solid var(--scan); cursor: pointer; white-space: nowrap; }
.qp-snd:hover { background: var(--scan); color: #1b1000; opacity: 1; }
.qp-snd.off { color: var(--text-dim); border-color: var(--border); }
.qp-snd.need-tap { animation: qpPulse 1s ease-in-out infinite; }
.qp-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.qp-actions .qp-btn { margin: 0; width: auto; }  /* "같은 사진 다시 분석"이 공통 여백 때문에 아래로 처지던 것 정렬 */
.qp-btn {
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent); border-radius: 10px;
  padding: 9px 14px; font-size: 13px; font-weight: 700; font-family: inherit;
}
.qp-btn-ghost { background: var(--panel-hover); color: var(--text); border-color: var(--border); }

.qp-prog-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.qp-stage { font-size: 15px; font-weight: 800; }
.qp-elapsed { font-size: 12px; color: var(--text-dim); white-space: nowrap; }
.qp-bar { height: 10px; border-radius: 100px; background: var(--panel-hover); overflow: hidden; }
.qp-bar i {
  display: block; height: 100%; border-radius: 100px; transition: width .6s ease;
  background: linear-gradient(90deg, var(--accent), #7c9cff, var(--accent)); background-size: 200% 100%;
  animation: qpFlow 1.6s linear infinite;
}
@keyframes qpFlow { to { background-position: -200% 0; } }
.qp-stepper { list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 16px 0 14px; padding: 0; }
.qp-stepper li { display: flex; flex-direction: column; align-items: center; gap: 7px; text-align: center; font-size: 11.5px; color: var(--text-dim); }
.qp-stepper li span { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--border); background: var(--panel); }
.qp-stepper li.done { color: var(--text); }
.qp-stepper li.done span { background: var(--accent); border-color: var(--accent); }
.qp-stepper li.active { color: var(--accent); font-weight: 800; }
.qp-stepper li.active span { border-color: var(--accent); animation: qpRing 1.2s ease-out infinite; }
@keyframes qpRing { 0% { box-shadow: 0 0 0 0 var(--accent); } 100% { box-shadow: 0 0 0 10px transparent; } }
.qp-live-label { font-size: 11.5px; color: var(--text-dim); margin-bottom: 6px; }
.qp-live {
  margin: 0; max-height: 170px; overflow: auto; white-space: pre-wrap; word-break: break-all;
  font: 12px/1.5 ui-monospace, Consolas, "Courier New", monospace; color: var(--text-dim);
  background: var(--input-bg); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px;
}
.qp-live::after { content: "|"; color: var(--accent); animation: qpBlink 1s steps(2) infinite; margin-left: 2px; }
@keyframes qpBlink { 50% { opacity: 0; } }
.qp-error { border-color: var(--alert-error-border); background: var(--alert-error-bg); color: var(--text); }
.qp-error p { margin: 6px 0 0; font-size: 13.5px; line-height: 1.55; }
.qp-hint { color: var(--text-dim); font-size: 12px; }

.qp-summary-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.qp-summary-head .qp-side-title { margin: 0; }
/* 음성으로 듣기: 공통 button 규칙(위쪽 여백 18px, 가로 100%)을 끄고 제목과 같은 줄 높이에 맞춤 */
.qp-summary-head { margin-bottom: 10px; }
.qp-summary-head .qp-btn { margin: 0; width: auto; flex: 0 0 auto; padding: 8px 16px; font-size: 13px; line-height: 1.2; }
.qp-speak { gap: 6px; }
.qp-speak .qp-speak-ico { flex: 0 0 auto; color: var(--accent); }
.qp-speak.playing .qp-speak-ico { animation: qpSpeakPulse 1s ease-in-out infinite; }
@keyframes qpSpeakPulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.qp-summary-text { margin: 10px 0 12px; font-size: 14.5px; line-height: 1.65; }
.qp-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.qp-chip-o { background: var(--accent-dim); color: var(--accent); border-radius: 100px; padding: 4px 11px; font-size: 12px; font-weight: 700; }
.qp-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.qp-kpi { background: var(--input-bg); border: 1px solid var(--border); border-radius: 10px; padding: 10px 8px; text-align: center; display: flex; flex-direction: column; gap: 3px; }
.qp-kpi b { font-size: 20px; }
.qp-kpi span { font-size: 11px; color: var(--text-dim); }
.qp-k-suspect b { color: var(--danger); }
.qp-k-ok b { color: var(--alert-ok-text); }

.qp-cand {
  background: var(--panel); border: 1px solid var(--border); border-left-width: 4px; border-radius: 12px;
  padding: 14px 16px; margin-bottom: 10px; animation: qpIn .45s ease both;
}
@keyframes qpIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.qp-c-suspect { border-left-color: var(--danger); }
.qp-c-ok { border-left-color: var(--alert-ok-text); }
.qp-c-unknown { border-left-color: var(--text-dim); }
.qp-cand-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 8px; }
.qp-rel { margin-left: auto; font-size: 11px; color: var(--text-dim); }
.qp-chip { font-size: 11.5px; font-weight: 800; padding: 3px 10px; border-radius: 100px; }
.qp-v-suspect { background: var(--alert-error-bg); color: var(--danger); border: 1px solid var(--alert-error-border); }
.qp-v-ok { background: var(--alert-ok-bg); color: var(--alert-ok-text); border: 1px solid var(--alert-ok-border); }
.qp-v-unknown { background: var(--panel-hover); color: var(--text-dim); border: 1px solid var(--border); }
.qp-cand-detail { font-size: 14px; line-height: 1.55; }
.qp-cand-reason { margin-top: 8px; font-size: 13px; line-height: 1.55; color: var(--text); background: var(--input-bg); border-radius: 8px; padding: 8px 10px; }
.qp-cand-reason b { color: var(--accent); margin-right: 8px; font-size: 11.5px; }
.qp-cand-law { margin-top: 6px; font-size: 12px; color: var(--text-dim); }
/* 참고 기준(법령·발행처) 카드 */
.qp-ref { margin-bottom: 10px; }
.qp-ref-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.qp-ref-badge { font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 100px; background: var(--panel-hover); color: var(--text-dim); border: 1px solid var(--border); }
.qp-ref-desc { font-size: 13px; line-height: 1.6; color: var(--text-dim); margin: 0; }
.qp-ref-pending { border-style: dashed; }
/* 관계법령 조항 */
.qp-law { padding: 12px 0; border-top: 1px solid var(--border); }
.qp-law:first-of-type { border-top: 0; padding-top: 4px; }
.qp-law-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 6px; }
/* 발행처 카드의 점검 후보 칩은 문장 길이라 카드 폭 안에서 줄바꿈한다(법령 카드의 짧은 분류명은 그대로 한 줄) */
.qp-law-top .qtag { white-space: normal; max-width: 100%; border-radius: 12px; line-height: 1.4; text-align: left; }
.qp-law-name { font-size: 14px; }
.qp-law-name small { font-weight: 600; color: var(--text-dim); margin-left: 2px; }
.qp-law-no { font-size: 12px; font-weight: 800; color: var(--accent); background: var(--accent-dim); padding: 2px 8px; border-radius: 100px; }
.qp-law-by { margin-left: auto; font-size: 11px; color: var(--text-dim); }
.qp-law-by-search { color: var(--danger); }
.qp-law-by-item { color: var(--accent); font-weight: 700; }
.qp-law-heading { font-size: 12px; color: var(--text-dim); margin-bottom: 4px; }
.qp-law-text { font-size: 13.5px; line-height: 1.65; white-space: pre-wrap; }
.qp-law-text.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.qp-law-more { font-size: 12px; color: var(--accent); }
.qp-law-meta { margin-top: 6px; font-size: 12px; color: var(--text-dim); }
.qp-law-meta a { color: var(--accent); }
/* 환경설정 > 관계법령 */
.law-status { width: auto; border-collapse: collapse; margin: 10px 0 4px; font-size: 13px; }
.law-status th { text-align: left; color: var(--text-dim); font-weight: 600; padding: 4px 16px 4px 0; white-space: nowrap; vertical-align: top; }
.law-status td { padding: 4px 0; }
.law-warn { color: var(--danger); }
.law-docs { margin-top: 18px; font-size: 13px; }
.law-docs summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.law-btn-ghost { background: var(--panel-hover); color: var(--text); border: 1px solid var(--border); margin-top: 8px; }
.qp-relbar { height: 3px; background: var(--panel-hover); border-radius: 3px; margin-top: 10px; overflow: hidden; }
.qp-relbar i { display: block; height: 100%; background: var(--accent); }
.qp-empty, .qp-disclaimer { color: var(--text-dim); font-size: 12.5px; line-height: 1.6; margin-top: 10px; }

@media (max-width: 860px) {
  .qp-grid, .qp-result-grid { grid-template-columns: minmax(0, 1fr); }
  .qp-left { position: static; }
  .qp-kpis { grid-template-columns: repeat(2, 1fr); }
  .qp-drop { min-height: 200px; }
}

/* ===== 품질 > 부적합(NCR/CAR) ===== */
.nc-filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 16px; }
.nc-filter { text-decoration: none; font-size: 13px; font-weight: 700; color: var(--text-dim); background: var(--panel); border: 1px solid var(--border); border-radius: 100px; padding: 6px 14px; }
.nc-filter.active { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.nc-list { display: flex; flex-direction: column; gap: 10px; max-width: 900px; }
.nc-item { display: flex; gap: 14px; text-decoration: none; color: inherit; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 12px; }
.nc-item:hover { border-color: var(--accent); }
.nc-thumb { width: 92px; height: 92px; border-radius: 8px; object-fit: cover; flex-shrink: 0; background: var(--input-bg); border: 1px solid var(--border); }
.nc-thumb-empty { display: flex; align-items: center; justify-content: center; color: var(--text-dim); font-size: 11px; }
.nc-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1; }
.nc-top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.nc-no { font-size: 12px; font-weight: 800; color: var(--text-dim); }
.nc-title { font-size: 14.5px; font-weight: 700; line-height: 1.45; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.nc-meta { font-size: 12px; color: var(--text-dim); display: flex; gap: 4px 12px; flex-wrap: wrap; }
.nc-late { color: var(--danger); font-weight: 800; font-size: 12px; }
.nc-st { font-size: 11.5px; font-weight: 800; padding: 3px 10px; border-radius: 100px; white-space: nowrap; }
.nc-st-draft { background: var(--panel-hover); color: var(--text-dim); border: 1px solid var(--border); }
.nc-st-issued { background: var(--alert-error-bg); color: var(--danger); border: 1px solid var(--alert-error-border); }
.nc-st-done { background: var(--accent-dim); color: var(--accent); border: 1px solid var(--accent); }
.nc-st-closed { background: var(--alert-ok-bg); color: var(--alert-ok-text); border: 1px solid var(--alert-ok-border); }

.nc-flow { max-width: 1180px; margin-bottom: 18px; padding: 14px 18px; }
.nc-doc-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 20px; align-items: start; max-width: 1180px; }
.nc-left { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 16px; }
.nc-right { display: flex; flex-direction: column; gap: 14px; }
.nc-photo { border-radius: 14px; overflow: hidden; border: 1px solid var(--border); background: #000; }
.nc-photo img { display: block; width: 100%; height: auto; }
.nc-nophoto { padding: 40px 10px; text-align: center; color: var(--text-dim); font-size: 13px; background: var(--input-bg); border-radius: 14px; border: 1px dashed var(--border); }
.nc-section { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; box-shadow: var(--shadow-card); }
.nc-section h3 { margin: 0 0 8px; font-size: 13.5px; color: var(--text-dim); }
.nc-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.nc-head h2 { margin: 0; font-size: 16px; }
.nc-form { display: flex; flex-direction: column; gap: 14px; }
.nc-form textarea {
  background: var(--input-bg); border: 1px solid var(--border); color: var(--text); border-radius: 8px;
  padding: 10px 12px; font-size: 14px; font-family: inherit; line-height: 1.55; resize: vertical; width: 100%;
}
.nc-form input[type=date], .nc-form input[type=file] {
  background: var(--input-bg); border: 1px solid var(--border); color: var(--text); border-radius: 8px;
  padding: 9px 12px; font-size: 14px; font-family: inherit; width: 100%;
}
.nc-kv { display: grid; grid-template-columns: 92px 1fr; gap: 8px 12px; font-size: 13.5px; margin: 0; }
.nc-kv dt { color: var(--text-dim); }
.nc-kv dd { margin: 0; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.nc-text { white-space: pre-wrap; word-break: break-word; line-height: 1.65; font-size: 14px; }
.nc-std { font-size: 13px; color: var(--text); background: var(--input-bg); border-radius: 8px; padding: 10px 12px; }
.nc-btnrow { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.nc-btn-issue { background: linear-gradient(135deg, var(--accent), #7c9cff); border-color: transparent; padding: 10px 22px; }
.nc-btn-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.nc-note { color: var(--text-dim); font-size: 12px; line-height: 1.55; }
.nc-rejected { border-color: var(--alert-error-border); background: var(--alert-error-bg); }
.qp-cand-actions { margin-top: 10px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.qp-cand-actions form { margin: 0; }
.qp-ncr-btn { background: var(--panel-hover); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 6px 12px; font-size: 12px; font-weight: 700; cursor: pointer; font-family: inherit; text-decoration: none; display: inline-block; }
.qp-ncr-btn.hot { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.qp-ncr-done { font-size: 12px; font-weight: 700; color: var(--accent); text-decoration: none; }
@media (max-width: 860px) {
  .nc-doc-grid { grid-template-columns: minmax(0, 1fr); }
  .nc-left { position: static; }
  .nc-thumb { width: 72px; height: 72px; }
  .nc-kv { grid-template-columns: 78px 1fr; }
}

@media (max-width: 860px) {
  .nc-photo img { max-height: 260px; object-fit: contain; background: #000; }
}

/* ---- 사진분석: AI가 사진에서 본 이상 징후(체크리스트와 별개의 참고 메모) ---- */
.qp-issues { border-left: 3px solid var(--accent); }
.qp-issues ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.qp-issues li { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.5; }
.qp-issues li::before { content: "!"; flex: 0 0 20px; height: 20px; margin-top: 1px; border-radius: 50%; background: var(--accent-dim); color: var(--accent); font-weight: 800; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; }
.qp-issues .qp-hint { margin: 10px 0 0; }
.qp-v-ok-ref { opacity: .85; }

/* 참고 기준 선택 칩(사진분석 입력·결과) — 전역 button 스타일(폭 100%·파란 배경)을 덮어쓴다 */
.qp-refbar { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.qp-refbar .qp-refchip { width: auto; margin: 0; padding: 6px 14px; border-radius: 100px; border: 1px solid var(--border); background: var(--panel); color: var(--text-dim); font-size: 13px; font-weight: 700; cursor: pointer; transition: background .15s, color .15s, border-color .15s; }
.qp-refbar .qp-refchip:hover:not(:disabled) { background: var(--panel-hover); opacity: 1; }
.qp-refbar .qp-refchip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.qp-refbar .qp-refchip.off, .qp-refbar .qp-refchip:disabled { opacity: .5; cursor: not-allowed; }
.qp-refchip small { font-weight: 600; opacity: .8; }
.qp-ref-title { font-size: 14px; font-weight: 800; margin: 14px 0 6px; }
.qp-ref-title small { font-weight: 600; color: var(--text-dim); margin-left: 6px; }
.qp-refblock[hidden] { display: none; }
.qp-more { margin: 4px 0 12px; width: auto; padding: 8px 16px; }
.qp-refpick { margin-top: 12px; }

/* 현장집행관리 > 인허가/심의/계약 체크리스트 */
.cl-kpis { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin-bottom: 14px; }
.cl-kpis .card { padding: 14px 16px; }
.cl-kpis .card .num { font-size: 24px; }
.cl-n-ok { color: var(--alert-ok-text); }
.cl-n-ng { color: var(--danger); }
.cl-meta { font-size: 12px; color: var(--text-dim); margin: 0 0 10px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.cl-ro { padding: 2px 10px; border-radius: 100px; background: var(--panel-hover); border: 1px solid var(--border); }
.cl-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.cl-chips .cl-chip { width: auto; margin: 0; padding: 7px 12px 9px; border-radius: 10px; border: 1px solid var(--border); background: var(--panel); color: var(--text); font-size: 13px; font-weight: 600; cursor: pointer; display: grid; gap: 3px; text-align: left; position: relative; min-width: 96px; }
.cl-chips .cl-chip:hover { background: var(--panel-hover); opacity: 1; }
.cl-chips .cl-chip.on { border-color: var(--accent); background: var(--accent-dim); }
.cl-chip-num { font-size: 11px; font-weight: 600; color: var(--text-dim); }
.cl-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--danger); margin-left: 4px; vertical-align: middle; }
.cl-bar { display: block; height: 3px; border-radius: 3px; background: var(--border); overflow: hidden; }
.cl-bar i { display: block; height: 100%; background: var(--accent); }
.cl-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 12px; }
.cl-tools select, .cl-tools input[type=text] { width: auto; margin: 0; padding: 8px 10px; background: var(--input-bg); color: var(--text); border: 1px solid var(--border); border-radius: 8px; font-size: 13px; }
.cl-tools input[type=text] { flex: 1 1 220px; min-width: 160px; }
.cl-count { font-size: 12px; color: var(--text-dim); margin-left: auto; }
.cl-tools .cl-ghost { width: auto; margin: 0; padding: 7px 12px; background: transparent; color: var(--text); border: 1px solid var(--border); font-weight: 600; font-size: 12px; }
.cl-sec { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; margin-bottom: 12px; overflow: hidden; }
.cl-sec-h { display: flex; align-items: baseline; gap: 8px; padding: 12px 16px; background: var(--panel-hover); cursor: pointer; user-select: none; }
.cl-sec-h small { color: var(--text-dim); font-size: 12px; }
.cl-sec-n { margin-left: auto; font-size: 12px; color: var(--text-dim); font-weight: 700; }
.cl-caret { color: var(--text-dim); transition: transform .15s; }
.cl-sec.folded .cl-caret { transform: rotate(-90deg); }
.cl-sec.folded .cl-sec-b { display: none; }
.cl-row { display: grid; grid-template-columns: 34px 1fr minmax(260px, 340px); gap: 12px; padding: 12px 16px; border-top: 1px solid var(--border); align-items: start; border-left: 3px solid transparent; }
.cl-row.j-ok { border-left-color: var(--alert-ok-text); }
.cl-row.j-ng { border-left-color: var(--danger); background: color-mix(in srgb, var(--alert-error-bg) 40%, var(--panel)); }
.cl-row.j-na { border-left-color: var(--text-dim); opacity: .8; }
.cl-row.saving { opacity: .6; }
.cl-no { font-size: 12px; color: var(--text-dim); font-weight: 700; padding-top: 2px; }
.cl-text { font-size: 14px; line-height: 1.5; }
.cl-sub { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; font-size: 12px; }
.cl-std { color: var(--text-dim); white-space: pre-line; }
.cl-clause { padding: 1px 8px; border-radius: 100px; background: var(--panel-hover); border: 1px solid var(--border); color: var(--text-dim); font-weight: 600; }
.cl-vs { display: flex; gap: 6px; }
.cl-vs .cl-v { width: auto; margin: 0; flex: 1; padding: 7px 4px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel); color: var(--text-dim); font-size: 13px; font-weight: 700; cursor: pointer; }
.cl-vs .cl-v:disabled { cursor: default; opacity: .55; }
.cl-vs .cl-v:hover:not(:disabled) { background: var(--panel-hover); opacity: 1; }
.cl-vs .cl-v-ok.on { background: var(--alert-ok-bg); border-color: var(--alert-ok-border); color: var(--alert-ok-text); }
.cl-vs .cl-v-ng.on { background: var(--alert-error-bg); border-color: var(--alert-error-border); color: var(--danger); }
.cl-vs .cl-v-na.on { background: var(--panel-hover); border-color: var(--text-dim); color: var(--text); }
.cl-vs .cl-v.on:disabled { opacity: 1; }
.cl-note { width: 100%; margin: 8px 0 0; padding: 7px 9px; background: var(--input-bg); color: var(--text); border: 1px solid var(--border); border-radius: 8px; font-size: 13px; font-family: inherit; resize: none; box-sizing: border-box; overflow: hidden; }
.cl-note-ro { margin-top: 8px; font-size: 13px; white-space: pre-line; }
.cl-by { margin-top: 4px; font-size: 11px; color: var(--text-dim); min-height: 14px; }
@media (max-width: 860px) {
  .cl-row { grid-template-columns: 28px 1fr; }
  .cl-judge { grid-column: 1 / -1; }
  .cl-chips .cl-chip { min-width: 0; }
}
