﻿:root {
  --bg: #f5efe4;
  --panel: rgba(255, 250, 243, 0.88);
  --ink: #1f2b24;
  --muted: #5c695f;
  --line: rgba(31, 43, 36, 0.12);
  --accent: #17624f;
  --shadow: 0 18px 40px rgba(49, 43, 33, 0.12);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  font-family: "Pretendard", "Noto Sans KR", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(23, 98, 79, 0.18), transparent 30%),
    radial-gradient(circle at bottom right, rgba(199, 77, 50, 0.16), transparent 28%),
    linear-gradient(180deg, #f7f1e7, #efe6d8 55%, #f8f4ed);
}

button, input, select, textarea { font: inherit; }
.shell { max-width: 1460px; margin: 0 auto; padding: 28px; }
.hero { display: grid; grid-template-columns: 1.4fr 0.8fr; gap: 24px; margin-bottom: 24px; }
.eyebrow { margin: 0 0 8px; color: var(--accent); text-transform: uppercase; letter-spacing: 0.12em; font-size: 12px; font-weight: 700; }
h1 { margin: 0; font-size: clamp(32px, 5vw, 56px); line-height: 0.96; font-weight: 800; }
.hero-copy { max-width: 760px; margin: 16px 0 0; color: var(--muted); font-size: 17px; line-height: 1.6; }
.hero-card, .panel, .law-card {
  backdrop-filter: blur(14px);
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 24px;
  box-shadow: var(--shadow);
}
.hero-card { display: grid; gap: 12px; padding: 18px; align-content: center; }
.metric { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-radius: 18px; background: rgba(255, 255, 255, 0.56); }
.metric span, .hint, #pending-count, #approved-count, #rejected-count, label span, .memo-box span, .field-label, .law-meta, .reason-text, .keyword-text { color: var(--muted); }
.metric strong { font-size: 28px; }
.matrix-board { display: grid; gap: 20px; margin-bottom: 20px; }
.planner-panel { margin-bottom: 20px; }
.planner-head { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 16px; }
.planner-head h2 { margin: 0 0 6px; font-size: 28px; }
.planner-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.planner-dropzone {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-top: 12px;
  padding: 18px;
  border-radius: 22px;
  border: 1.5px dashed rgba(23, 98, 79, 0.28);
  background: rgba(255, 255, 255, 0.56);
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.dropzone-copy strong {
  display: block;
  margin-bottom: 6px;
  font-size: 16px;
}
.planner-dropzone.dragover {
  background: rgba(23, 98, 79, 0.1);
  border-color: rgba(23, 98, 79, 0.52);
  transform: translateY(-1px);
}
#plan-file-status {
  margin: 12px 0 0;
}
.planner-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0 18px;
}
.summary-card {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(23, 98, 79, 0.1);
}
.summary-card strong { display: block; margin-top: 8px; font-size: 22px; }
.planner-results { display: grid; gap: 14px; }
.planner-package-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-top: 18px; }
.plan-report-view { display: grid; gap: 12px; margin-top: 10px; }
.report-card { padding: 18px; border-radius: 22px; background: rgba(255, 255, 255, 0.72); border: 1px solid rgba(23, 98, 79, 0.12); }
.report-card h4 { margin: 0 0 10px; font-size: 16px; }
.report-card p { margin: 0; color: var(--muted); line-height: 1.65; white-space: pre-wrap; }
.report-overview { background: linear-gradient(135deg, rgba(255,255,255,0.84), rgba(245,255,250,0.82)); }
.report-risk { border-color: rgba(183, 74, 45, 0.22); background: rgba(255, 244, 240, 0.8); }
.report-good { border-color: rgba(23, 98, 79, 0.2); background: rgba(240, 250, 246, 0.84); }
.report-action { border-color: rgba(181, 107, 37, 0.2); background: rgba(255, 248, 238, 0.84); }
.report-list { margin: 0; padding-left: 18px; color: var(--muted); }
.report-list li + li { margin-top: 8px; }
.report-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.report-pill { display: inline-flex; align-items: center; padding: 6px 10px; border-radius: 999px; background: rgba(23, 98, 79, 0.08); color: var(--accent); font-size: 12px; font-weight: 700; }
.package-card { overflow: hidden; }
.package-card.is-selected { border-color: rgba(23, 98, 79, 0.48); box-shadow: 0 14px 34px rgba(23, 98, 79, 0.12); }
.package-card:not(.is-selected) .package-body { opacity: 0.58; }
.package-toggle { list-style: none; cursor: pointer; display: flex; justify-content: space-between; gap: 16px; align-items: start; }
.package-toggle::-webkit-details-marker { display: none; }
.package-card[open] .package-toggle { margin-bottom: 12px; }
.package-body { border-top: 1px solid rgba(23, 98, 79, 0.1); padding-top: 14px; }
.pkg-body-wrap { display: flex; flex-direction: column; gap: 0; }
.pkg-select-row { display: flex; gap: 8px; margin-bottom: 14px; }
.pkg-select-row button { padding: 6px 12px; font-size: 13px; }
.pkg-sections { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
@media (max-width: 900px) { .pkg-sections { grid-template-columns: 1fr; } }
.pkg-section { background: rgba(255,255,255,0.6); border: 1px solid rgba(23,98,79,0.1); border-radius: 12px; padding: 14px; }
.pkg-section-title { margin: 0 0 10px; font-size: 13px; font-weight: 700; color: var(--accent); display: flex; align-items: center; gap: 6px; }
.pkg-law-count { font-size: 11px; font-weight: 500; background: rgba(23,98,79,0.1); color: var(--accent); padding: 1px 7px; border-radius: 999px; }
.pkg-checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; max-height: 260px; overflow-y: auto; }
.pkg-check-row { display: flex; align-items: flex-start; gap: 8px; padding: 6px 8px; border-radius: 8px; cursor: pointer; line-height: 1.4; font-size: 13px; margin-bottom: 0; }
.pkg-check-row:hover { background: rgba(23,98,79,0.05); }
.pkg-check-row input[type=checkbox] { width: auto; padding: 0; margin-top: 2px; flex-shrink: 0; }
.pkg-law-info { display: flex; flex-direction: column; gap: 2px; }
.pkg-law-meta { font-size: 11px; color: var(--muted); }
.package-select-control { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 10px; padding: 7px 10px; border-radius: 10px; background: rgba(23,98,79,0.08); color: var(--accent); font-size: 13px; font-weight: 800; cursor: pointer; }
.package-select-control input { width: auto; margin: 0; }
.pkg-authority-groups { display: grid; gap: 10px; }
.pkg-authority-group { padding-top: 7px; border-top: 1px solid rgba(23,98,79,0.08); }
.pkg-authority-group:first-child { padding-top: 0; border-top: 0; }
.pkg-authority-group h5 { margin: 0 0 6px; color: var(--ink); font-size: 12px; }
.pkg-recommended-badge { display: inline-flex; margin-left: 4px; padding: 1px 5px; border-radius: 999px; background: rgba(23,98,79,0.1); color: var(--accent); font-size: 10px; font-weight: 700; vertical-align: middle; }
.package-manual-picker { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px 18px; border: 1px dashed rgba(23,98,79,0.28); border-radius: 18px; background: rgba(255,255,255,0.48); }
.package-manual-picker p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.package-manual-controls { display: flex; gap: 8px; min-width: min(100%, 380px); }
.package-manual-controls select { min-width: 240px; }
.source-notice-card { padding: 16px 18px; border: 1px solid rgba(181,107,37,0.28); border-radius: 18px; background: rgba(255,248,238,0.78); }
.source-notice-card.uploaded { border-color: rgba(23,98,79,0.3); background: rgba(240,250,246,0.82); }
.source-notice-card summary { display: flex; justify-content: space-between; gap: 16px; align-items: center; cursor: pointer; }
.source-notice-card summary strong { font-size: 15px; }
.source-notice-card summary p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.source-notice-card summary > span { color: #8b591f; font-size: 12px; font-weight: 700; white-space: nowrap; }
.source-notice-card ul { list-style: none; margin: 14px 0 0; padding: 12px 0 0; border-top: 1px solid rgba(181,107,37,0.16); display: grid; gap: 7px; }
.source-notice-card li { display: grid; grid-template-columns: 54px minmax(0,1fr) auto; gap: 8px; align-items: start; font-size: 12px; }
.source-file-role { color: #8b591f; font-weight: 800; }
.source-file-role input { width: auto; margin: 0 3px 0 0; vertical-align: middle; }
.source-file-note { color: var(--muted); font-size: 11px; white-space: nowrap; }
@media (max-width: 700px) { .package-manual-picker, .package-manual-controls { align-items: stretch; flex-direction: column; } .package-manual-controls select { min-width: 0; } }
@media (max-width: 700px) { .source-notice-card li { grid-template-columns: 48px 1fr; } .source-file-note { grid-column: 2; white-space: normal; } }
.muted-hint { font-size: 12px; color: var(--muted); padding: 6px 8px; }
.package-toggle-side { min-width: 120px; display: grid; justify-items: end; gap: 8px; }
.package-status { font-size: 12px; color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* ── 고정 법령 패널 ─────────────────────────────────────────── */
.pinned-laws-panel { background: rgba(255,255,255,0.55); border: 1px solid rgba(23,98,79,0.15); border-radius: 14px; margin-bottom: 18px; overflow: hidden; }
.pinned-laws-header { width: 100%; display: flex; align-items: center; gap: 10px; padding: 14px 18px; background: none; border: none; cursor: pointer; text-align: left; color: var(--ink); }
.pinned-laws-header .eyebrow { font-size: 10px; font-weight: 700; letter-spacing: 0.12em; color: var(--accent); opacity: 0.8; white-space: nowrap; }
.pinned-laws-title { font-size: 14px; font-weight: 700; color: var(--ink); }
.pinned-count-badge { background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; margin-left: 4px; }
.pinned-toggle-hint { font-size: 12px; color: var(--muted); flex: 1; }
.pinned-chevron { font-size: 12px; color: var(--muted); transition: transform 0.2s; }
.pinned-laws-header[aria-expanded="true"] .pinned-chevron { transform: rotate(90deg); }
.pinned-laws-body { display: none; padding: 0 18px 16px; border-top: 1px solid rgba(23,98,79,0.08); }
.pinned-laws-body.open { display: block; }
.pinned-laws-list { display: flex; flex-wrap: wrap; gap: 7px; padding: 14px 0 10px; min-height: 38px; }
.pinned-empty { font-size: 13px; color: var(--muted); padding: 6px 0; }
.pinned-chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px 4px 10px; background: rgba(23,98,79,0.08); border: 1px solid rgba(23,98,79,0.2); border-radius: 999px; font-size: 12px; }
.pinned-chip-name { font-weight: 600; color: var(--ink); }
.pinned-chip-kind { color: var(--muted); font-size: 11px; }
.pinned-remove { background: none; border: none; cursor: pointer; color: var(--muted); font-size: 14px; padding: 0 2px; line-height: 1; border-radius: 50%; }
.pinned-remove:hover { color: #c00; background: rgba(200,0,0,0.08); }
.pinned-laws-search-wrap { margin: 4px 0 8px; }
.pinned-laws-search { width: 100%; padding: 10px 14px; font-size: 13px; border-radius: 10px; border: 1px solid rgba(23,98,79,0.2); background: rgba(255,255,255,0.8); }
.pinned-laws-results { display: flex; flex-direction: column; gap: 4px; max-height: 220px; overflow-y: auto; }
.pinned-result-row { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 9px; background: rgba(255,255,255,0.7); border: 1px solid rgba(23,98,79,0.08); font-size: 13px; }
.pinned-result-row.is-pinned { background: rgba(23,98,79,0.06); border-color: rgba(23,98,79,0.2); }
.pr-name { font-weight: 600; flex: 1; }
.pr-kind { font-size: 11px; color: var(--muted); white-space: nowrap; }
.pr-cat { font-size: 11px; color: var(--muted); white-space: nowrap; }
.pr-pin-btn { padding: 3px 9px; font-size: 12px; border-radius: 7px; border: 1px solid var(--accent); background: transparent; color: var(--accent); cursor: pointer; white-space: nowrap; }
.pr-pin-btn.unpin { background: rgba(23,98,79,0.1); }
.pr-pin-btn:hover { background: var(--accent); color: #fff; }
/* 법령 미리보기 핀 버튼 */
.lp-item { display: flex; align-items: flex-start; gap: 10px; }
.lp-pin-btn { background: none; border: none; cursor: pointer; font-size: 16px; padding: 2px 4px; border-radius: 6px; line-height: 1; flex-shrink: 0; margin-top: 1px; opacity: 0.5; }
.lp-pin-btn:hover, .lp-pin-btn.pinned { opacity: 1; }
.lp-item.is-pinned { background: rgba(23,98,79,0.05); border-radius: 10px; }
/* 패키지 카드 고정 법령 */
.pkg-check-row.is-pinned { background: rgba(23,98,79,0.04); }
.pin-badge { font-size: 12px; margin-left: 4px; }

.evidence-list, .authority-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.evidence-item, .authority-item { padding: 10px 12px; border-radius: 14px; background: rgba(255, 255, 255, 0.72); border: 1px solid rgba(23, 98, 79, 0.1); }
.evidence-item strong, .authority-item strong { display: block; margin-bottom: 4px; }
.evidence-meta, .authority-meta { color: var(--muted); font-size: 13px; line-height: 1.45; }
.package-box p { margin: 0 0 10px; color: var(--muted); }
.package-card {
  padding: 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(23, 98, 79, 0.14);
}
.package-card-top { display: flex; justify-content: space-between; gap: 16px; align-items: start; }
.package-card h3 { margin: 0; font-size: 22px; }
.package-card p { margin: 8px 0 0; color: var(--muted); line-height: 1.5; }
.package-score {
  min-width: 86px;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(23, 98, 79, 0.1);
  text-align: center;
  font-weight: 700;
  color: var(--accent);
}
.package-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.package-box {
  padding: 14px;
  border-radius: 18px;
  background: rgba(23, 98, 79, 0.05);
}
.package-box h4 { margin: 0 0 10px; font-size: 14px; }
.package-box ul { margin: 0; padding-left: 18px; color: var(--muted); }
.package-box li + li { margin-top: 6px; }
.package-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.package-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(23, 98, 79, 0.12);
  font-size: 12px;
  font-weight: 700;
}
.matrix-panel { padding: 18px 20px 20px; }
.matrix-head { display: flex; justify-content: space-between; align-items: end; gap: 12px; margin-bottom: 14px; }
.matrix-head h2 { margin: 0; font-size: 20px; }
.matrix-wrap { overflow: auto; }
.matrix-table { width: 100%; min-width: 860px; border-collapse: collapse; font-size: 14px; }
.matrix-table th, .matrix-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: center; }
.matrix-table th:first-child, .matrix-table td:first-child { position: sticky; left: 0; background: rgba(255, 250, 243, 0.96); text-align: left; z-index: 1; }
.matrix-table thead th { position: sticky; top: 0; background: rgba(247, 241, 231, 0.98); z-index: 2; }
.matrix-table thead th:first-child { z-index: 3; }
.matrix-table tbody tr:hover td { background: rgba(23, 98, 79, 0.04); }
.matrix-table .row-label { font-weight: 700; color: var(--ink); }
.matrix-table .num { font-variant-numeric: tabular-nums; font-weight: 700; }
.matrix-table .num.zero { color: rgba(92, 105, 95, 0.48); font-weight: 500; }
.matrix-table .num.hot { color: var(--accent); }
.matrix-table .total-cell { background: rgba(23, 98, 79, 0.08); }
.matrix-cell-button {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid rgba(23, 98, 79, 0.16);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  font-weight: 700;
}
.matrix-cell-button.hot {
  color: var(--accent);
  border-color: rgba(23, 98, 79, 0.28);
}
.matrix-cell-button:hover {
  transform: translateY(-1px);
  background: rgba(23, 98, 79, 0.08);
}
.layout { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 20px; }
.panel { padding: 20px; }
.controls { position: sticky; top: 18px; height: fit-content; }
.controls h2, .content h2 { margin: 0 0 14px; font-size: 18px; }
.controls label, .memo-box { display: grid; gap: 8px; margin-bottom: 14px; }
input, select, textarea, button { border-radius: 14px; border: 1px solid var(--line); }
input, select, textarea { width: 100%; padding: 12px 14px; background: rgba(255, 255, 255, 0.72); }
button { padding: 11px 14px; background: var(--accent); color: #f8fffc; cursor: pointer; }
button.ghost { background: transparent; color: var(--ink); }
#bulk-approve-high { background: #2a7d5f; color: #f0fff8; border-color: #1f6348; }
.button-row, .toolbar-actions, .decision, .chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.export-box { margin-top: 14px; padding-top: 14px; border-top: 1px solid rgba(31, 43, 36, 0.12); }
.toolbar { display: flex; justify-content: space-between; gap: 16px; align-items: flex-end; margin-bottom: 18px; }
.reviewed-toolbar { margin-top: 18px; }
.section-divider { height: 1px; margin: 24px 0; background: rgba(31, 43, 36, 0.12); }
.table-container { display: grid; gap: 14px; }
.law-card { padding: 18px; }
.law-card-top { display: flex; justify-content: space-between; gap: 14px; }
.chip { display: inline-flex; align-items: center; border-radius: 999px; padding: 6px 10px; font-size: 12px; font-weight: 700; background: rgba(255, 255, 255, 0.72); }
.chip.confidence.high, .chip.review.approved { background: #d9efe6; color: #115c4a; }
.chip.confidence.medium { background: #fff0dc; color: #9a5b16; }
.chip.review.rejected { background: #f4ddd7; color: #8f3a28; }
.law-name { margin: 0; font-size: 22px; }
.move-grid { display: grid; grid-template-columns: 1fr 36px 1fr; gap: 10px; align-items: center; margin-top: 16px; padding: 14px; border-radius: 18px; background: rgba(255, 255, 255, 0.52); }
.arrow { text-align: center; font-weight: 800; color: var(--accent); }
.reason-box { margin-top: 14px; padding: 14px; border-radius: 18px; background: rgba(23, 98, 79, 0.06); }
.law-card.pending-move { border-color: rgba(181, 107, 37, 0.34); }
.law-card.approved-card { border-color: rgba(23, 98, 79, 0.34); }
.law-card.rejected-card { border-color: rgba(199, 77, 50, 0.32); }
.empty { padding: 48px 20px; text-align: center; color: var(--muted); }
#export-status a { color: var(--accent); word-break: break-all; }

/* ── AI 종합 검토 ─────────────────────────────────────────────── */
.ai-review-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin: 20px 0 10px;
  padding: 20px 22px;
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(23, 98, 79, 0.07) 0%, rgba(255,255,255,0.42) 100%);
  border: 1.5px solid rgba(23, 98, 79, 0.22);
}
.ai-review-bar h3 { margin: 0 0 4px; font-size: 20px; }
.ai-review-bar .hint strong { color: var(--accent); }
#ai-review-btn {
  padding: 13px 22px;
  font-size: 15px;
  font-weight: 700;
  background: var(--accent);
  color: #f8fffc;
  border-radius: 16px;
  min-width: 160px;
  transition: opacity 0.15s;
}
#ai-review-btn:disabled { opacity: 0.42; cursor: not-allowed; }
.ai-loading {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 28px 20px;
  color: var(--muted);
  font-size: 15px;
}
.ai-spinner {
  display: inline-block;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border: 2.5px solid rgba(23, 98, 79, 0.18);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: ai-spin 0.75s linear infinite;
}
@keyframes ai-spin { to { transform: rotate(360deg); } }
.report-neutral {
  border-color: rgba(92, 105, 95, 0.18);
  background: rgba(248, 248, 248, 0.82);
}
.report-creative {
  border-color: rgba(99, 60, 180, 0.22);
  background: rgba(245, 240, 255, 0.82);
}
@media (max-width: 1080px) {
  .ai-review-bar { flex-direction: column; align-items: flex-start; }
}

/* ── 탭 헤더 & 탭 네비게이션 ──────────────────────────────────── */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.app-title .eyebrow { margin-bottom: 4px; }
.app-title h1 { font-size: clamp(24px, 4vw, 38px); }
.tab-nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.tab-btn {
  padding: 10px 18px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 700;
  border: 1.5px solid var(--line);
  background: rgba(255, 255, 255, 0.56);
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.tab-btn:hover { background: rgba(23, 98, 79, 0.08); color: var(--ink); }
.tab-btn.active {
  background: var(--accent);
  color: #f8fffc;
  border-color: var(--accent);
}
.tab-btn.ghost-tab {
  background: transparent;
  border-style: dashed;
  color: var(--muted);
}
.tab-btn.ghost-tab:hover { background: rgba(23, 98, 79, 0.06); color: var(--accent); }
.tab-content.hidden { display: none; }

/* ── 동기화 배지 & 버튼 ── */
.header-sync {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  padding-left: 16px;
}
.sync-badge {
  font-size: 11px;
  color: var(--muted);
  cursor: default;
  transition: color 0.3s;
}
.sync-badge.syncing { color: #f59e0b; animation: pulse 1s infinite; }
.sync-badge.ok      { color: #22c55e; }
.sync-badge.error   { color: #ef4444; }
@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:0.3; } }
.sync-btn {
  font-size: 12px;
  padding: 6px 14px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.sync-btn:hover { background: rgba(23,98,79,0.07); color: var(--ink); }
.sync-btn:disabled { opacity: 0.5; cursor: not-allowed; }

@media (max-width: 1080px) {
  .hero, .layout { grid-template-columns: 1fr; }
  .controls { position: static; }
  .matrix-head { align-items: start; flex-direction: column; }
  .planner-head, .package-card-top { align-items: start; flex-direction: column; }
  .planner-summary, .package-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .shell { padding: 16px; }
  .toolbar, .law-card-top, .move-grid { display: grid; grid-template-columns: 1fr; }
  .arrow { transform: rotate(90deg); }
}

/* ── AI 보고서 문서 레이아웃 ────────────────────────────────── */
.rdoc { border-radius: 18px; overflow: hidden; background: rgba(255,255,255,0.72); box-shadow: 0 8px 32px rgba(49,43,33,0.11); }
.rdoc-header { background: linear-gradient(135deg, #17624f 0%, #1e7a62 100%); padding: 28px 30px 24px; color: #fff; }
.rdoc-eyebrow { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.14em; opacity: 0.75; margin: 0 0 6px; }
.rdoc-title { margin: 0 0 12px; font-size: 20px; font-weight: 800; color: #fff; line-height: 1.3; }
.rdoc-header-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.rdoc-date { font-size: 12px; opacity: 0.7; }
.rdoc-overview-label { margin: 14px 0 4px; font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(255,255,255,0.55); }
.rdoc-overview { margin: 0; font-size: 15px; line-height: 1.8; color: rgba(255,255,255,0.93); }
.rdoc-meta { display: flex; flex-wrap: wrap; gap: 7px; }
.rpill { display: inline-flex; align-items: center; padding: 5px 11px; border-radius: 999px; font-size: 12px; font-weight: 700; background: rgba(255,255,255,0.18); color: #fff; }
.rdoc-body { display: grid; }
.rsec { padding: 20px 28px; border-bottom: 1px solid rgba(31,43,36,0.08); border-left: 4px solid transparent; }
.rsec:last-child { border-bottom: none; }
.rsec-good    { border-left-color: #17624f; background: rgba(23,98,79,0.03); }
.rsec-risk    { border-left-color: #b74a2d; background: rgba(183,74,45,0.03); }
.rsec-action  { border-left-color: #b56b25; background: rgba(181,107,37,0.03); }
.rsec-creative{ border-left-color: #6b3cb4; background: rgba(107,60,180,0.03); }
.rsec-neutral { border-left-color: #8e9b91; background: rgba(142,155,145,0.03); }
.rsec-head { display: flex; align-items: center; gap: 9px; margin-bottom: 13px; }
.rsec-icon { font-size: 18px; line-height: 1; }
.rsec-title { font-size: 15px; font-weight: 700; color: var(--ink); flex: 1; }
.rsec-badge { padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; background: rgba(31,43,36,0.08); color: var(--muted); }
.ri-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.ri { padding: 10px 14px; border-radius: 11px; background: rgba(255,255,255,0.7); border: 1px solid rgba(31,43,36,0.07); font-size: 14px; line-height: 1.7; color: var(--ink); }
.ri-plain { padding: 2px 0; background: none; border: none; font-size: 14px; line-height: 1.75; color: var(--ink); }
.ri-table { padding: 6px 0; background: none; border: none; overflow-x: auto; }
.report-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.report-table th { background: rgba(21,101,192,0.12); color: var(--ink); font-weight: 700; padding: 7px 12px; border: 1px solid rgba(21,101,192,0.25); text-align: left; }
.report-table td { padding: 6px 12px; border: 1px solid rgba(31,43,36,0.12); vertical-align: top; line-height: 1.6; }
.report-table tr:nth-child(even) td { background: rgba(31,43,36,0.03); }
.ri-box { padding: 0; background: none; border: none; }
.report-box { padding: 12px 16px; border-radius: 10px; background: rgba(255,193,7,0.1); border: 1.5px solid rgba(255,160,0,0.4); font-size: 14px; line-height: 1.7; color: var(--ink); font-weight: 500; }
@media (max-width: 720px) { .rdoc-header { padding: 20px; } .rsec { padding: 16px 20px; } }

/* ── 법령 확인 패널 ──────────────────────────────────────────────────────── */
mark.hl { background: rgba(255,213,0,0.45); color: inherit; border-radius: 2px; padding: 0 1px; }
.hidden { display: none !important; }
.law-preview-panel { border: 1.5px solid rgba(23,98,79,0.18); border-radius: 18px; overflow: hidden; margin: 16px 0; background: #fff; }
.law-preview-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 20px 24px 16px; border-bottom: 1px solid rgba(31,43,36,0.08); background: rgba(23,98,79,0.03); flex-wrap: wrap; }
.law-preview-head h4 { margin: 4px 0 2px; font-size: 16px; font-weight: 700; color: var(--ink); }
.law-preview-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; margin-top: 4px; flex-wrap: wrap; }
.law-select-btns { display: flex; gap: 6px; padding-right: 8px; border-right: 1px solid rgba(31,43,36,0.12); }
.law-preview-list { padding: 12px 16px; display: grid; gap: 6px; max-height: 420px; overflow-y: auto; }
.lp-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: 10px; border: 1px solid rgba(31,43,36,0.07); background: rgba(255,255,255,0.9); cursor: pointer; transition: background 0.15s; }
.lp-item:hover { background: rgba(23,98,79,0.04); }
.lp-item input[type=checkbox] { margin-top: 3px; accent-color: var(--accent); flex-shrink: 0; width: 15px; height: 15px; cursor: pointer; }
.lp-body { flex: 1; min-width: 0; }
.lp-title { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.lp-title strong { font-size: 13px; font-weight: 600; color: var(--ink); }
.lp-src { display: inline-flex; padding: 2px 7px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.lp-src-법률    { background: rgba(23,98,79,0.12); color: #17624f; }
.lp-src-시행령  { background: rgba(23,60,98,0.1); color: #173c62; }
.lp-src-시행규칙 { background: rgba(23,60,98,0.07); color: #2a4f74; }
.lp-src-조례    { background: rgba(107,60,180,0.1); color: #5a2d9a; }
.lp-src-교육청_공문,.lp-src-공문 { background: rgba(181,107,37,0.1); color: #8a5010; }
.lp-src-규정,.lp-src-etc { background: rgba(142,155,145,0.12); color: #5a6b5e; }
.lp-cat { font-size: 11px; color: var(--muted); padding: 2px 7px; border-radius: 999px; background: rgba(31,43,36,0.06); }
.lp-summary { margin: 4px 0 0; font-size: 12px; color: var(--muted); line-height: 1.55; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.law-detail-actions { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.law-detail-panel { margin-top: 14px; padding: 16px; border-radius: 16px; background: rgba(23,98,79,0.04); border: 1px solid rgba(23,98,79,0.12); display: grid; gap: 14px; }
.law-detail-meta { display: flex; gap: 8px; flex-wrap: wrap; }
.law-detail-pill { display: inline-flex; align-items: center; padding: 5px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: rgba(255,255,255,0.8); border: 1px solid rgba(23,98,79,0.12); color: var(--muted); }
.law-detail-grid { display: grid; gap: 12px; grid-template-columns: 1.2fr 1fr; }
.law-detail-block { min-width: 0; padding: 14px; border-radius: 14px; background: #fff; border: 1px solid rgba(31,43,36,0.08); }
.law-detail-block h4 { margin: 0 0 10px; font-size: 13px; letter-spacing: 0.02em; color: var(--muted); }
.law-detail-preview { margin: 0; white-space: pre-wrap; word-break: break-word; max-height: 340px; overflow: auto; font-size: 13px; line-height: 1.65; color: var(--ink); }
.law-chunk-list { display: grid; gap: 10px; }
.law-chunk-item { padding: 12px; border-radius: 12px; background: rgba(23,98,79,0.03); border: 1px solid rgba(23,98,79,0.08); }
.law-chunk-item strong { display: block; margin-bottom: 6px; font-size: 12px; color: var(--accent); }
.law-chunk-item p { margin: 0; font-size: 13px; line-height: 1.6; color: var(--ink); white-space: pre-wrap; word-break: break-word; }
.law-detail-empty { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
@media (max-width: 900px) { .law-detail-grid { grid-template-columns: 1fr; } }

/* ── 패키지 사용자 추가 항목 ───────────────────────────────────────────────── */
.pkg-custom-item { display: flex; align-items: center; gap: 4px; }
.pkg-custom-item .pkg-check-row { flex: 1; background: rgba(181,107,37,0.06); border: 1px dashed rgba(181,107,37,0.3); border-radius: 7px; }
.pkg-custom-item .pkg-check-row:hover { background: rgba(181,107,37,0.11); }
.pkg-custom-badge { font-size: 11px; padding: 1px 6px; border-radius: 999px; background: rgba(181,107,37,0.15); color: #8a5010; margin-left: 4px; white-space: nowrap; }
.pkg-custom-remove { flex-shrink: 0; width: 22px; height: 22px; border: none; background: transparent; color: var(--muted); font-size: 16px; cursor: pointer; border-radius: 50%; line-height: 1; padding: 0; display: flex; align-items: center; justify-content: center; }
.pkg-custom-remove:hover { background: rgba(200,50,50,0.12); color: #c00; }
/* 일반 법령 항목 × 제외 버튼 */
.pkg-law-item { display: flex; align-items: center; gap: 4px; }
.pkg-law-item .pkg-check-row { flex: 1; }
.pkg-law-exclude { flex-shrink: 0; width: 20px; height: 20px; border: none; background: transparent; color: transparent; font-size: 14px; cursor: pointer; border-radius: 50%; line-height: 1; padding: 0; display: flex; align-items: center; justify-content: center; }
.pkg-law-item:hover .pkg-law-exclude { color: var(--muted); }
.pkg-law-exclude:hover { background: rgba(200,50,50,0.12); color: #c00 !important; }

/* ── 패키지 추가 UI ────────────────────────────────────────────────────────── */
.pkg-add-zone { margin-top: 10px; }
.pkg-add-toggle { font-size: 12px; padding: 4px 10px; color: var(--accent); border: 1px dashed rgba(23,98,79,0.35); border-radius: 6px; }
.pkg-add-toggle:hover { background: rgba(23,98,79,0.06); }
.pkg-add-inner { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.pkg-add-input { width: 100%; padding: 7px 10px; font-size: 13px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,0.7); color: var(--ink); outline: none; }
.pkg-add-input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(23,98,79,0.1); }
.pkg-add-results { display: flex; flex-direction: column; gap: 2px; max-height: 180px; overflow-y: auto; color: var(--ink); }
.pkg-add-hit { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 8px; background: var(--panel); color: var(--ink); font-size: 13px; cursor: pointer; margin-bottom: 0; }
.pkg-add-hit:hover { background: rgba(23,98,79,0.06); }
.pkg-add-hit.already-added { opacity: 0.6; cursor: default; }
.pkg-add-hit input[type=checkbox] { flex-shrink: 0; width: auto; padding: 0; accent-color: var(--accent); }
.pkg-add-hit-text { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: 2px; }
.pkg-add-hit-name { display: block; color: var(--ink); font-weight: 600; min-width: 0; word-break: keep-all; }
.pkg-add-hit-meta { display: block; color: var(--muted); font-size: 11px; min-width: 0; }
.pkg-add-hit-text, .pkg-law-info { color: var(--ink); }
.pkg-law-info strong { display: block; color: var(--ink); }
.pkg-already-check { font-size: 13px; color: var(--accent); flex-shrink: 0; }
.pkg-already-label { font-size: 11px; color: var(--muted); padding: 3px 8px; }
.pkg-add-batch-btn { margin-top: 6px; width: 100%; padding: 6px; font-size: 13px; border-radius: 7px; border: none; background: var(--accent); color: #fff; cursor: pointer; font-weight: 600; }
.pkg-add-batch-btn:hover { opacity: 0.88; }
.pkg-add-noresult { font-size: 12px; color: var(--muted); padding: 4px 8px; }
.pkg-add-direct { font-size: 12px; background: none; border: none; color: var(--accent); cursor: pointer; text-decoration: underline; padding: 0; }


/* ── PIN 잠금 화면 ────────────────────────────────────────────────────────────
   서버가 인증을 요구할 때(Railway 배포) 앱 전체를 덮는다. 뒤 내용이 비쳐 보이면
   안 되므로 불투명 배경을 깔고, 본문 스크롤도 막는다. */
.pin-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at top left, rgba(23, 98, 79, 0.22), transparent 32%),
    radial-gradient(circle at bottom right, rgba(199, 77, 50, 0.18), transparent 30%),
    linear-gradient(180deg, #f7f1e7, #efe6d8 55%, #f8f4ed);
}
.pin-overlay[hidden] { display: none !important; }
body.pin-locked { overflow: hidden; }

.pin-card {
  width: min(420px, 100%);
  padding: 32px;
  border-radius: 24px;
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  text-align: left;
}
.pin-card h2 { margin: 0 0 10px; font-size: 26px; font-weight: 800; line-height: 1.2; }
.pin-copy { margin: 0 0 20px; color: var(--muted); font-size: 15px; line-height: 1.6; }

.pin-form { display: flex; gap: 10px; }
.pin-form input {
  flex: 1;
  min-width: 0;
  padding: 13px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
  letter-spacing: 0.3em;
}
.pin-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(23, 98, 79, 0.16);
}
.pin-form input:disabled { opacity: 0.55; cursor: not-allowed; }
.pin-form button {
  padding: 13px 22px;
  border-radius: 14px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}
.pin-form button:disabled { opacity: 0.55; cursor: not-allowed; }

.pin-status { margin: 14px 0 0; min-height: 20px; font-size: 14px; line-height: 1.5; color: var(--muted); }
.pin-status.warn { color: #b74a2d; font-weight: 600; }
.pin-status.ok { color: var(--accent); font-weight: 600; }
