/* 법제처 · 의원입법 모니터링 — refined gov digital */
:root {
  --ink: #0c1222;
  --ink-soft: #3b4a63;
  --muted: #6b7a90;
  --line: #e4e9f2;
  --paper: #f4f6fb;
  --card: #ffffff;
  --navy: #0b1f3d;
  --navy-2: #132f56;
  --moleg: #1a4d96;
  --moleg-deep: #0c2d66;
  --gold: #c9a227;
  --gold-soft: #e8c547;
  --teal: #0e6e68;
  --emerald: #0b7a56;
  --indigo: #3b3f9e;
  --violet: #5b2dbf;
  --rose: #b91c45;
  --amber: #a85a0a;
  --shadow: 0 22px 56px -24px rgba(11, 31, 61, 0.32);
  --shadow-sm: 0 10px 28px -14px rgba(11, 31, 61, 0.16);
  --shadow-glow: 0 0 0 1px rgba(255, 255, 255, 0.55) inset;
  --radius: 18px;
  --radius-sm: 12px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-soft: cubic-bezier(0.4, 0, 0.2, 1);
  --dur: 0.28s;
  --font: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
  --mono: "JetBrains Mono", "Consolas", "Malgun Gothic", ui-monospace, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body.app-body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(980px 480px at 6% -10%, rgba(26, 77, 150, 0.11), transparent 58%),
    radial-gradient(720px 380px at 96% 2%, rgba(201, 162, 39, 0.09), transparent 52%),
    radial-gradient(640px 320px at 48% 108%, rgba(14, 110, 104, 0.055), transparent 58%),
    linear-gradient(165deg, #eef2f9 0%, var(--paper) 40%, #e9eef7 100%);
  animation: pageIn 0.55s var(--ease-out) both;
}

@keyframes pageIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Header — refined glass navy */
.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  color: #fff;
  background:
    linear-gradient(128deg, rgba(8, 24, 52, 0.97) 0%, rgba(16, 48, 92, 0.96) 46%, rgba(11, 36, 72, 0.98) 100%);
  border-bottom: 1px solid rgba(232, 197, 71, 0.38);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.07) inset,
    0 14px 44px -18px rgba(5, 18, 40, 0.7);
  backdrop-filter: blur(18px) saturate(1.15);
  -webkit-backdrop-filter: blur(18px) saturate(1.15);
  transition: box-shadow var(--dur) var(--ease-soft);
}

.app-header-glow {
  pointer-events: none;
  position: absolute;
  inset: 0;
  background:
    radial-gradient(520px 130px at 14% 0%, rgba(96, 150, 230, 0.2), transparent 72%),
    radial-gradient(420px 110px at 88% 0%, rgba(232, 197, 71, 0.11), transparent 68%);
  opacity: 1;
  animation: headerGlow 8s ease-in-out infinite alternate;
}

@keyframes headerGlow {
  from { opacity: 0.85; filter: saturate(1); }
  to { opacity: 1; filter: saturate(1.12); }
}

.app-header-inner {
  position: relative;
  max-width: 74rem;
  margin: 0 auto;
  padding: 1rem 1.35rem 1.15rem;
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 0.95rem;
  min-width: 0;
}

a.brand-home {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  border-radius: 14px;
  transition: opacity var(--dur) var(--ease-soft), transform var(--dur) var(--ease-out);
}

a.brand-home:hover {
  opacity: 0.96;
  transform: translateY(-2px);
}

a.brand-home:hover .brand-org {
  color: #ffe08a;
}

a.brand-home:focus-visible {
  outline: 2px solid rgba(245, 197, 66, 0.7);
  outline-offset: 4px;
}

.brand-logo-wrap {
  flex-shrink: 0;
  width: 54px;
  height: 54px;
  border-radius: 16px;
  padding: 1px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.12) 45%, rgba(91, 141, 220, 0.25));
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.12),
    0 10px 28px -10px rgba(0, 0, 0, 0.55);
}

/* 법제처 공식 CI (흰 배경용 컬러 로고 — 헤더 다크 배경에서는 흰 패치 위 표시) */
.brand-logo-wrap--moleg {
  width: auto;
  height: auto;
  min-width: 0;
  padding: 0.4rem 0.7rem;
  border-radius: 12px;
  background: #ffffff;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.45),
    0 8px 22px -10px rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-logo {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 15px;
  background: #0a2f6b;
}

.brand-logo--moleg {
  display: block;
  width: auto;
  height: 44px;
  max-width: min(220px, 48vw);
  border-radius: 0;
  background: transparent !important;
  object-fit: contain;
  object-position: left center;
}

.brand-logo-wrap--gov {
  background: linear-gradient(145deg, #fff 0%, #f1f5f9 50%, #e2e8f0 100%);
  padding: 3px;
  border-radius: 50%;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.25),
    0 8px 22px -8px rgba(0, 0, 0, 0.5);
}

.brand-logo--gov {
  border-radius: 50%;
  background: #fff;
  object-fit: contain;
}

.brand-text { min-width: 0; }

.brand-kicker {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin-bottom: 0.2rem;
}

.brand-org {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #f5c542;
  text-transform: none;
}

.brand-dot {
  width: 3px;
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.35);
}

.brand-product {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: rgba(186, 210, 245, 0.85);
  text-transform: uppercase;
}

.brand-title {
  margin: 0;
  font-size: clamp(1.2rem, 2.2vw, 1.55rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
  background: linear-gradient(90deg, #ffffff 0%, #dbeafe 55%, #fef3c7 120%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand-sub {
  margin: 0.4rem 0 0;
  color: #a8c0e0;
  font-size: 0.8rem;
  line-height: 1.5;
  max-width: 36rem;
  font-weight: 500;
}

.header-aside {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.55rem;
}

.header-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: flex-end;
}

.header-link {
  font-size: 0.72rem;
  font-weight: 700;
  color: #93c5fd;
  text-decoration: none;
  opacity: 0.9;
  transition: color 0.15s, opacity 0.15s;
}

.header-link:hover {
  color: #fde68a;
  opacity: 1;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.32rem 0.7rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
  white-space: nowrap;
  backdrop-filter: blur(8px);
}

.chip-gold {
  background: rgba(245, 197, 66, 0.14);
  color: #fde68a;
  border-color: rgba(245, 197, 66, 0.38);
}

.chip-teal {
  background: rgba(45, 212, 191, 0.12);
  color: #99f6e4;
  border-color: rgba(45, 212, 191, 0.28);
}

.chip-slate {
  background: rgba(147, 197, 253, 0.12);
  color: #bfdbfe;
  border-color: rgba(147, 197, 253, 0.28);
}

/* Layout */
.app-main {
  max-width: 74rem;
  margin: 0 auto;
  padding: 1.5rem 1.35rem 3.5rem;
}

.panel {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm), var(--shadow-glow);
  padding: 1.3rem 1.4rem;
  margin-bottom: 1.15rem;
  transition:
    box-shadow var(--dur) var(--ease-soft),
    transform var(--dur) var(--ease-out),
    border-color var(--dur) var(--ease-soft),
    background var(--dur) var(--ease-soft);
  backdrop-filter: blur(10px);
  animation: riseIn 0.5s var(--ease-out) both;
}

.panel:hover {
  box-shadow: var(--shadow), var(--shadow-glow);
  border-color: #c5d2e8;
  transform: translateY(-2px);
}

.panel-hero {
  background:
    linear-gradient(155deg, rgba(255, 255, 255, 0.99) 0%, rgba(247, 250, 255, 0.98) 48%, rgba(255, 252, 246, 0.97) 100%);
  border: 1px solid #d0dceb;
  position: relative;
  overflow: hidden;
  box-shadow:
    var(--shadow-sm),
    0 0 0 1px rgba(255, 255, 255, 0.85) inset;
  animation: riseIn 0.55s var(--ease-out) both;
}

.panel-hero::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #1a4d96 0%, #e8c547 40%, #0e6e68 72%, #3b3f9e 100%);
  background-size: 200% 100%;
  animation: barShift 7s ease-in-out infinite alternate;
}

@keyframes barShift {
  from { background-position: 0% 50%; }
  to { background-position: 100% 50%; }
}

@keyframes riseIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.panel-hero::after {
  content: "";
  pointer-events: none;
  position: absolute;
  right: -40px;
  top: -50px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(27, 79, 156, 0.07), transparent 70%);
}

.panel-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.panel-title i { color: var(--indigo); }

.panel-hint {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.5;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
}

/* Bill inputs */
.bill-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin: 0.85rem 0 1rem;
}

@media (max-width: 720px) {
  .bill-grid { grid-template-columns: 1fr; }
}

.bill-field {
  position: relative;
  background: linear-gradient(180deg, #f8fafc, #fff);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.8rem 0.65rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.bill-field:focus-within {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.bill-field.primary {
  border-color: #a5b4fc;
  background: linear-gradient(180deg, #eef2ff, #fff);
}

.bill-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.02em;
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.bill-label .slot {
  display: inline-grid;
  place-items: center;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 999px;
  background: var(--navy);
  color: #fff;
  font-size: 0.65rem;
}

.bill-no-input {
  width: 100%;
  border: none !important;
  outline: none !important;
  background: transparent !important;
  font-family: var(--mono);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--ink);
  padding: 0.2rem 0 !important;
  box-shadow: none !important;
}

.bill-no-input::placeholder {
  color: #cbd5e1;
  font-weight: 500;
  letter-spacing: 0.04em;
}

/* Action buttons */
.action-row {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 0.65rem;
}

@media (max-width: 640px) {
  .action-row { grid-template-columns: 1fr; }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border: none;
  border-radius: 12px;
  font-family: var(--font);
  font-weight: 700;
  font-size: 0.92rem;
  padding: 0.85rem 1.1rem;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition:
    transform var(--dur) var(--ease-out),
    box-shadow var(--dur) var(--ease-soft),
    filter var(--dur) var(--ease-soft);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.05);
}

.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 20%, rgba(255, 255, 255, 0.18) 48%, transparent 72%);
  transform: translateX(-120%);
  transition: transform 0.55s var(--ease-out);
  pointer-events: none;
}

.btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.04);
}

.btn:hover::after {
  transform: translateX(120%);
}

.btn:active {
  transform: translateY(0);
  filter: brightness(0.98);
}

.btn-navy {
  background: linear-gradient(165deg, #234a78 0%, var(--navy) 55%, #08182f 100%);
  color: #fff;
  box-shadow: 0 10px 24px -10px rgba(11, 31, 58, 0.58);
}

.btn-emerald {
  background: linear-gradient(165deg, #10b981 0%, #047857 52%, #064e3b 100%);
  color: #fff;
  box-shadow: 0 10px 24px -10px rgba(4, 120, 87, 0.52);
}

.btn-emerald .btn-sub {
  font-weight: 500;
  font-size: 0.72rem;
  opacity: 0.85;
  margin-left: 0.15rem;
}

.btn-teal {
  background: linear-gradient(180deg, #0d9488, #0f766e);
  color: #fff;
}

.btn-indigo {
  background: linear-gradient(180deg, #4f46e5, #3730a3);
  color: #fff;
}

.btn-amber {
  background: linear-gradient(180deg, #d97706, #b45309);
  color: #fff;
}

.btn-violet {
  background: linear-gradient(180deg, #7c3aed, #6d28d9);
  color: #fff;
}

.btn-ghost {
  background: #f1f5f9;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  box-shadow: none;
  font-size: 0.8rem;
  padding: 0.45rem 0.75rem;
}

.btn-ghost:hover { background: #e2e8f0; }

.checklist-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px dashed var(--line);
}

@media (max-width: 640px) {
  .checklist-row { grid-template-columns: 1fr; }
}

/* Token mode pills */
.mode-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.9rem;
  padding: 0.55rem 0.7rem;
  background: #f8fafc;
  border-radius: 12px;
  border: 1px solid var(--line);
}

.mode-bar > span {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-soft);
  margin-right: 0.25rem;
}

.mode-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.12s;
}

.mode-pill:hover { background: #fff; border-color: #cbd5e1; }

.mode-pill:has(input:checked) {
  background: #ecfdf5;
  color: #065f46;
  border-color: #6ee7b7;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.12);
}

.mode-pill input { accent-color: #059669; }

/* Loading */
#loading {
  text-align: center;
  padding: 2.5rem 1rem;
}

.loader-ring {
  width: 52px;
  height: 52px;
  margin: 0 auto;
  border-radius: 50%;
  border: 3px solid #e2e8f0;
  border-top-color: var(--navy);
  border-right-color: var(--gold);
  animation: spin 0.85s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

#loading-msg {
  margin-top: 0.9rem;
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-weight: 600;
}

/* Error */
#error-box {
  border-radius: var(--radius-sm);
  border: 1px solid #fecaca;
  background: linear-gradient(180deg, #fff1f2, #fef2f2);
  color: #9f1239;
  padding: 0.9rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  box-shadow: var(--shadow-sm);
}

/* Result cards */
.stat-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.5rem 0 0.75rem;
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  background: #f1f5f9;
  color: var(--ink-soft);
  border: 1px solid var(--line);
}

.stat-pill.warn {
  background: #fff7ed;
  color: #c2410c;
  border-color: #fed7aa;
}

.stat-pill.ok {
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
}

.stat-pill.danger {
  background: #fff1f2;
  color: #be123c;
  border-color: #fecdd3;
}

.stat-pill.info {
  background: #eef2ff;
  color: #3730a3;
  border-color: #c7d2fe;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem 1rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

@media (max-width: 560px) {
  .meta-grid { grid-template-columns: 1fr; }
}

.meta-grid .k {
  font-weight: 700;
  color: var(--ink);
  margin-right: 0.25rem;
}

/* Ministry / checklist items */
.item-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem 0.85rem;
  background: #fff;
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  transition: border-color 0.12s, background 0.12s;
}

.item-card:hover {
  border-color: #c7d2fe;
  background: #fafbff;
}

.item-card.hit {
  border-color: #86efac;
  background: linear-gradient(180deg, #f0fdf4, #fff);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.12rem 0.45rem;
  border-radius: 6px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.badge-main { background: #1d4ed8; color: #fff; }
.badge-rel { background: #64748b; color: #fff; }
.badge-ministry { background: #0f766e; color: #fff; }

/* Review cards */
.review-card {
  background: var(--card);
  border: 1px solid #d7e0ef;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm), var(--shadow-glow);
  padding: 1.15rem 1.25rem;
  position: relative;
  overflow: hidden;
  animation: riseIn 0.45s var(--ease-out) both;
  transition: box-shadow var(--dur) var(--ease-soft), transform var(--dur) var(--ease-out), border-color var(--dur) var(--ease-soft);
}

.review-card:hover {
  box-shadow: var(--shadow), var(--shadow-glow);
  border-color: #c4d2e8;
}

.review-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, #10b981, var(--teal));
}

.review-card.is-loading {
  background:
    linear-gradient(100deg, #f8fafc 30%, #eef3fb 50%, #f8fafc 70%);
  background-size: 200% 100%;
  animation: riseIn 0.4s var(--ease-out) both, shimmer 1.4s ease-in-out infinite;
}

.review-card.is-loading::before {
  background: linear-gradient(180deg, #94a3b8, #64748b);
  animation: pulseBar 1.2s ease-in-out infinite;
}

.review-card.is-error::before {
  background: linear-gradient(180deg, #f43f5e, #be123c);
}

.review-card.is-error {
  background: #fffafa;
  border-color: #fecdd3;
}

@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

@keyframes pulseBar {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.review-card + .review-card { margin-top: 0.85rem; }

.report-section-label {
  margin: 0.85rem 0 0.4rem;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.report-box {
  background: linear-gradient(180deg, #f8fafc, #f1f5f9);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  font-size: 0.88rem;
  line-height: 1.7;
  max-height: 36rem;
  overflow: auto;
  font-family: "Malgun Gothic", var(--font);
  color: var(--ink);
}

.report-box.report-doc {
  white-space: normal;
}

.report-box .report-h {
  margin: 1rem 0 0.45rem;
  padding-bottom: 0.3rem;
  font-size: 0.95rem;
  font-weight: 800;
  color: #0f172a;
  border-bottom: 1px solid #e2e8f0;
}

.report-box .report-h:first-child { margin-top: 0; }

.report-box .report-p {
  margin: 0.35rem 0 0.55rem;
  color: var(--ink-soft);
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.report-box .report-li {
  margin: 0.2rem 0 0.2rem 0.15rem;
  padding-left: 0.15rem;
  color: var(--ink-soft);
  word-break: keep-all;
}

.report-box .report-empty {
  margin: 0;
  color: var(--muted);
}

/* 사후협의 의견서 — 공문서형 여백 */
.opinion-doc {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 1.75rem 1.85rem 2rem;
  font-size: 0.95rem;
  line-height: 1.85;
  max-height: 48rem;
  color: #1e293b;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset;
}

.opinion-doc .op-title {
  margin: 0 0 1.35rem;
  padding-bottom: 0.85rem;
  font-size: 1.2rem;
  font-weight: 800;
  line-height: 1.45;
  color: #0f172a;
  text-align: center;
  border-bottom: 2px solid #c7d2fe;
  letter-spacing: -0.02em;
}

.opinion-doc .op-disclaimer {
  margin: 0 0 1.5rem;
  padding: 0.9rem 1.05rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-left: 4px solid #818cf8;
  border-radius: 10px;
  font-size: 0.88rem;
  line-height: 1.75;
  color: #475569;
}

.opinion-doc .op-section {
  margin: 1.75rem 0 0.85rem;
  padding: 0.45rem 0 0.5rem;
  font-size: 1.05rem;
  font-weight: 800;
  color: #1e1b4b;
  border-bottom: 1px solid #e0e7ff;
  letter-spacing: -0.01em;
}

.opinion-doc .op-section:first-of-type {
  margin-top: 0.5rem;
}

.opinion-doc .op-issue {
  margin: 1.35rem 0 0.7rem;
  padding: 0.55rem 0.85rem;
  font-size: 0.95rem;
  font-weight: 750;
  color: #5b21b6;
  background: linear-gradient(90deg, #f5f3ff 0%, #faf5ff 60%, transparent 100%);
  border-left: 3px solid #8b5cf6;
  border-radius: 0 8px 8px 0;
  line-height: 1.5;
}

.opinion-doc .op-p {
  margin: 0 0 1rem;
  color: #334155;
  word-break: keep-all;
  overflow-wrap: anywhere;
  line-height: 1.9;
}

.opinion-doc .op-p + .op-p {
  margin-top: 0.15rem;
}

.opinion-doc .op-bullet {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin: 0 0 0.75rem;
  line-height: 1.85;
  color: #334155;
  word-break: keep-all;
}

.opinion-doc .op-bullet-main {
  margin-top: 0.35rem;
  margin-bottom: 0.85rem;
}

.opinion-doc .op-bullet-sub {
  margin-left: 1.15rem;
  margin-bottom: 0.55rem;
  color: #475569;
  font-size: 0.92rem;
}

.opinion-doc .op-mark {
  flex-shrink: 0;
  font-weight: 800;
  color: #6d28d9;
  width: 1.1rem;
  text-align: center;
  line-height: 1.85;
}

.opinion-doc .op-bullet-text {
  flex: 1;
  min-width: 0;
}

.opinion-doc .op-sublabel {
  margin: 0.85rem 0 0.45rem;
  font-size: 0.86rem;
  font-weight: 750;
  color: #64748b;
}

.opinion-doc .op-empty {
  margin: 0;
  color: var(--muted);
}

.opinion-doc a {
  color: #2563eb;
  text-decoration: none;
  border-bottom: 1px solid rgba(37, 99, 235, 0.25);
}

.opinion-doc a:hover {
  color: #1d4ed8;
  border-bottom-color: #1d4ed8;
}

/* 의무협의 표 */
.consult-panel {
  margin: 0.75rem 0 0.35rem;
  border: 1px solid #a7f3d0;
  border-radius: 14px;
  background: linear-gradient(165deg, #ecfdf5 0%, #f7fffb 40%, #fff 100%);
  overflow: hidden;
  animation: riseIn 0.45s var(--ease-out) 0.08s both;
  box-shadow: 0 8px 22px -16px rgba(4, 120, 87, 0.35);
  transition: box-shadow var(--dur) var(--ease-soft), border-color var(--dur) var(--ease-soft);
}

.consult-panel:hover {
  border-color: #6ee7b7;
  box-shadow: 0 12px 28px -14px rgba(4, 120, 87, 0.4);
}

.consult-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid #d1fae5;
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.06), transparent);
}

.consult-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.consult-table {
  min-width: 560px;
  margin: 0;
  border: none;
  border-radius: 0;
}

.consult-table th {
  white-space: nowrap;
}

.consult-table td {
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.consult-table .consult-no {
  color: var(--muted);
  font-weight: 700;
  text-align: center;
}

.consult-table .consult-min {
  font-weight: 700;
  color: #0f766e;
  white-space: nowrap;
}

.consult-table .consult-art {
  white-space: nowrap;
}

.consult-empty {
  margin: 0.65rem 0;
}

.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;
}

/* Tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
}

.data-table th {
  text-align: left;
  padding: 0.55rem 0.65rem;
  background: #f1f5f9;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.75rem;
  border-bottom: 1px solid var(--line);
}

.data-table td {
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: top;
  color: var(--ink-soft);
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #fafbff; }

.mono { font-family: var(--mono); font-weight: 600; color: #1e3a8a; }

/* Recent list */
.recent-table-wrap {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.recent-table-wrap table { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
.recent-table-wrap th {
  background: #f8fafc;
  text-align: left;
  padding: 0.6rem 0.75rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  border-bottom: 1px solid var(--line);
}
.recent-table-wrap td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
.recent-table-wrap tr:hover td { background: #f8fafc; }
.recent-table-wrap tr:last-child td { border-bottom: none; }

/* Law section accent */
.panel-law::before {
  content: "";
  display: block;
  height: 3px;
  margin: -1.25rem -1.35rem 1rem;
  border-radius: var(--radius) var(--radius) 0 0;
  background: linear-gradient(90deg, #d97706, #fbbf24);
}

/* Opinion dashed */
.panel-opinion {
  border: 2px dashed #c4b5fd;
  background: linear-gradient(180deg, #faf5ff, #fff);
}

/* Footer */
.app-footer {
  text-align: center;
  color: #94a3b8;
  font-size: 0.72rem;
  line-height: 1.6;
  padding: 0.5rem 1.25rem 2rem;
  max-width: 48rem;
  margin: 0 auto;
}

/* Utilities used by JS-rendered HTML */
.hidden { display: none !important; }

.space-y-2 > * + * { margin-top: 0.5rem; }
.space-y-3 > * + * { margin-top: 0.75rem; }
.space-y-4 > * + * { margin-top: 1rem; }

/* Signal lights for consult count */
.signal {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
}
.signal-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 999px;
  box-shadow: 0 0 0 3px rgba(0,0,0,0.04);
}
.signal-green { background: #ecfdf5; color: #047857; }
.signal-green .signal-dot { background: #10b981; }
.signal-amber { background: #fffbeb; color: #b45309; }
.signal-amber .signal-dot { background: #f59e0b; }
.signal-red { background: #fff1f2; color: #be123c; }
.signal-red .signal-dot { background: #f43f5e; }

/* Textareas / selects */
.app-select, .app-textarea, .app-input {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 0.55rem 0.75rem;
  font-family: var(--font);
  font-size: 0.88rem;
  color: var(--ink);
  background: #fff;
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
}

.app-select:focus, .app-textarea:focus, .app-input:focus {
  border-color: #818cf8;
  box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.18);
}

.app-textarea { resize: vertical; min-height: 4.5rem; }

.flow-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.75rem;
}

.flow-step {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted);
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.25rem 0.6rem;
}

.flow-step i { color: var(--gold); font-size: 0.65rem; }

.divider-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.85rem 0 0.5rem;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0.02em;
}

.divider-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* 의안번호 검색 → 해당 페이지 행 강조 */
.recent-table-wrap tr.recent-row-hl td {
  background: #eef2ff !important;
  box-shadow: inset 3px 0 0 #4f46e5;
}
.recent-table-wrap tr.recent-row-hl:hover td {
  background: #e0e7ff !important;
}

/* Recent list search */
.recent-search-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: flex-end;
  margin: 0 0 0.9rem;
  padding: 0.75rem 0.85rem;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.recent-search-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 7.5rem;
}

.recent-search-field label {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--muted);
}

.recent-search-field .app-input {
  min-width: 8.5rem;
  padding: 0.5rem 0.65rem;
  font-size: 0.88rem;
}

.recent-search-name {
  flex: 1;
  min-width: 12rem;
}

.recent-search-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

/* Recent list pagination */
.recent-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
}

.recent-pager .pg-info {
  width: 100%;
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.recent-pager .pg-btn {
  min-width: 2.1rem;
  height: 2.1rem;
  padding: 0 0.55rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-soft);
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.12s;
}

.recent-pager .pg-btn:hover:not(:disabled) {
  border-color: #6366f1;
  color: #3730a3;
  background: #eef2ff;
}

.recent-pager .pg-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.recent-pager .pg-btn.is-active {
  background: linear-gradient(180deg, #1e3a5f, #0b1f3a);
  color: #fff;
  border-color: #0b1f3a;
  box-shadow: 0 4px 12px -4px rgba(11, 31, 58, 0.5);
}

.recent-pager .pg-ellipsis {
  color: var(--muted);
  font-weight: 700;
  padding: 0 0.2rem;
  user-select: none;
}

.doc-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.1rem 0.4rem;
  border-radius: 6px;
  vertical-align: middle;
  margin-left: 0.25rem;
}

.doc-badge.yes {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.doc-badge.no {
  background: #f1f5f9;
  color: #94a3b8;
  border: 1px solid #e2e8f0;
}

/* Google Gemini API 키 입력 바 */
.gemini-bar {
  margin-top: 0.9rem;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  border: 1px solid #c7d2fe;
  background:
    linear-gradient(135deg, rgba(66, 133, 244, 0.08), rgba(52, 168, 83, 0.06) 40%, rgba(251, 188, 5, 0.07) 70%, rgba(234, 67, 53, 0.06)),
    #f8faff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.gemini-bar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.65rem;
}

.gemini-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.gemini-logo {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  font-weight: 800;
  color: #1a73e8;
  background: linear-gradient(145deg, #e8f0fe, #fff);
  border: 1px solid #aecbfa;
  flex-shrink: 0;
}

.gemini-title {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.gemini-sub {
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.4;
  margin-top: 0.1rem;
}

.gemini-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
  color: #174ea6;
  background: linear-gradient(180deg, #fff, #e8f0fe);
  border: 1px solid #aecbfa;
  box-shadow: 0 2px 8px -2px rgba(26, 115, 232, 0.35);
  transition: transform 0.12s, box-shadow 0.12s, filter 0.12s;
  white-space: nowrap;
}

.gemini-link:hover {
  transform: translateY(-1px);
  filter: brightness(1.03);
  box-shadow: 0 6px 16px -4px rgba(26, 115, 232, 0.4);
  color: #0b57d0;
}

.gemini-link-ext {
  font-size: 0.65rem;
  opacity: 0.75;
}

.gemini-input-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.gemini-input-wrap {
  flex: 1;
  min-width: 14rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: #fff;
  border: 1.5px solid #c5d4f5;
  border-radius: 11px;
  padding: 0.15rem 0.35rem 0.15rem 0.7rem;
  transition: border-color 0.12s, box-shadow 0.12s;
}

.gemini-input-wrap:focus-within {
  border-color: #4285f4;
  box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.18);
}

.gemini-input-icon {
  color: #5f6368;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.gemini-input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink);
  padding: 0.55rem 0.25rem;
}

.gemini-input::placeholder {
  color: #9aa0a6;
  font-weight: 500;
  letter-spacing: 0;
}

.gemini-icon-btn {
  border: none;
  background: transparent;
  color: #5f6368;
  cursor: pointer;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  font-size: 0.85rem;
}

.gemini-icon-btn:hover {
  background: #e8f0fe;
  color: #174ea6;
}

.gemini-save-btn {
  background: linear-gradient(180deg, #4285f4, #1a73e8) !important;
  color: #fff !important;
  box-shadow: 0 6px 16px -6px rgba(26, 115, 232, 0.55) !important;
  padding: 0.65rem 1rem !important;
  font-size: 0.82rem !important;
}

.gemini-clear-btn {
  padding: 0.65rem 0.75rem !important;
}

.gemini-status {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.gemini-status.is-ok {
  color: #137333;
}

.gemini-status.is-warn {
  color: #b06000;
}

.gemini-status.is-err {
  color: #c5221f;
}

/* 최근 의안 → 번호 입력 (①→②→③ 자동 배정) */
.slot-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 4.2rem;
  height: 1.9rem;
  padding: 0 0.55rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-soft);
  font-family: var(--font);
  font-size: 0.72rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.12s;
  line-height: 1;
  margin-left: 0.2rem;
  vertical-align: middle;
  white-space: nowrap;
}

.slot-btn:hover {
  border-color: #1e3a5f;
  color: #fff;
  background: linear-gradient(180deg, #1e3a5f, #0b1f3a);
  transform: translateY(-1px);
}

.slot-btn.is-assigned {
  border-color: #059669;
  background: #ecfdf5;
  color: #047857;
}

/* 칸에 넣을 때 잠깐 하이라이트 */
.bill-no-input.slot-flash,
.bill-field:has(.bill-no-input.slot-flash) {
  animation: slotFlash 0.55s ease;
}

.bill-field:has(.bill-no-input.slot-flash) {
  border-color: #6366f1 !important;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

@keyframes slotFlash {
  0% { background-color: #eef2ff; }
  100% { background-color: transparent; }
}

/* Cards / chips / loader polish */
.item-card {
  transition:
    transform var(--dur) var(--ease-out),
    box-shadow var(--dur) var(--ease-soft),
    border-color var(--dur) var(--ease-soft),
    background var(--dur) var(--ease-soft);
}

.item-card:hover {
  transform: translateY(-1px);
}

.chip {
  transition: transform var(--dur) var(--ease-out), background var(--dur) var(--ease-soft), border-color var(--dur) var(--ease-soft);
}

.chip:hover {
  transform: translateY(-1px);
}

.stat-pill {
  transition: transform 0.2s var(--ease-out), box-shadow 0.2s var(--ease-soft);
}

.stat-pill:hover {
  transform: translateY(-1px);
}

.loader-ring {
  box-shadow: 0 0 0 4px rgba(15, 52, 96, 0.05);
}

#loading {
  animation: riseIn 0.35s var(--ease-out) both;
}

.report-box.report-doc .report-h {
  transition: color 0.2s var(--ease-soft);
}

.consult-table tbody tr {
  transition: background 0.18s var(--ease-soft);
}

.header-link {
  transition: color var(--dur) var(--ease-soft), opacity var(--dur) var(--ease-soft), transform var(--dur) var(--ease-out);
}

.header-link:hover {
  transform: translateY(-1px);
}

/* 검토 이력 */
.panel-history {
  border-color: #d8dee9;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 16rem;
  overflow: auto;
}

.history-empty {
  font-size: 0.84rem;
  color: var(--muted);
  padding: 0.65rem 0.2rem;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, #fff, #f8fafc);
  transition: border-color var(--dur) var(--ease-soft), box-shadow var(--dur) var(--ease-soft), transform var(--dur) var(--ease-out);
}

.history-item:hover {
  border-color: #c5d2e8;
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.history-item-title {
  font-weight: 750;
  font-size: 0.9rem;
  line-height: 1.35;
}

.history-item-meta {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

.history-item-actions {
  display: flex;
  gap: 0.3rem;
  flex-shrink: 0;
}

/* 의무협의 편집 표 */
.consult-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  padding: 0.55rem 0.85rem;
  border-bottom: 1px solid #d1fae5;
  background: rgba(255, 255, 255, 0.65);
}

.consult-table-edit {
  min-width: 720px;
}

.consult-check {
  text-align: center;
  vertical-align: middle;
}

.consult-check input {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: #059669;
  cursor: pointer;
}

.consult-row.is-excluded {
  opacity: 0.45;
  background: #f8fafc;
}

.consult-row.is-excluded .consult-cat,
.consult-row.is-excluded .consult-min {
  text-decoration: line-through;
}

.consult-note-input {
  width: 100%;
  min-width: 6rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.35rem 0.45rem;
  font-size: 0.75rem;
  font-family: var(--font);
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.consult-note-input:focus {
  outline: none;
  border-color: #34d399;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.consult-confirm-badge:not(.hidden) {
  display: inline-flex;
}

/* 접근성: 모션 최소화 */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  body.app-body,
  .panel,
  .panel-hero,
  .review-card,
  .consult-panel,
  .app-header-glow,
  .panel-hero::before,
  .btn::after,
  #loading {
    animation: none !important;
  }
  .panel:hover,
  .btn:hover,
  a.brand-home:hover,
  .review-card:hover,
  .item-card:hover,
  .chip:hover,
  .stat-pill:hover {
    transform: none;
  }
  .btn,
  .panel,
  .review-card,
  a.brand-home {
    transition: none;
  }
}
