:root {
  --bg: #050816;
  --bg-2: #07111f;
  --panel: rgba(15, 23, 42, 0.78);
  --panel-strong: rgba(15, 23, 42, 0.94);
  --line: rgba(148, 163, 184, 0.18);
  --line-strong: rgba(56, 189, 248, 0.42);
  --text: #e5eefb;
  --muted: #94a3b8;
  --soft: #cbd5e1;
  --accent: #38bdf8;
  --accent-2: #8b5cf6;
  --good: #22c55e;
  --warn: #f59e0b;
  --bad: #ef4444;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", sans-serif;
  background:
    radial-gradient(circle at 18% 12%, rgba(56, 189, 248, 0.22), transparent 30%),
    radial-gradient(circle at 85% 18%, rgba(139, 92, 246, 0.20), transparent 26%),
    linear-gradient(135deg, #050816 0%, #08111f 48%, #020617 100%);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -3;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.06) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0.85), rgba(0,0,0,0.2));
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

code,
pre {
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.orb {
  position: fixed;
  z-index: -2;
  width: 420px;
  height: 420px;
  border-radius: 999px;
  filter: blur(22px);
  opacity: 0.22;
  pointer-events: none;
}

.orb-a {
  top: -160px;
  right: -120px;
  background: radial-gradient(circle, #38bdf8, transparent 68%);
}

.orb-b {
  bottom: -200px;
  left: -120px;
  background: radial-gradient(circle, #8b5cf6, transparent 70%);
}

.page-shell {
  width: min(1320px, calc(100% - 40px));
  margin: 0 auto;
  padding: 34px 0 54px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border: 1px solid rgba(56, 189, 248, 0.55);
  border-radius: 18px;
  color: #e0f2fe;
  font-weight: 900;
  letter-spacing: -0.06em;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.25), rgba(139, 92, 246, 0.18));
  box-shadow: 0 0 36px rgba(56, 189, 248, 0.18);
}

.eyebrow,
.section-kicker,
.metric-label {
  margin: 0;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: -0.04em;
}

h1 {
  font-size: clamp(28px, 3.5vw, 48px);
  line-height: 1.04;
}

h2 {
  font-size: 20px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 110px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--soft);
  background: rgba(15, 23, 42, 0.62);
  box-shadow: inset 0 0 24px rgba(148, 163, 184, 0.05);
  font-size: 13px;
  font-weight: 800;
}

.hero-badge.success {
  color: #bbf7d0;
  border-color: rgba(34, 197, 94, 0.45);
  background: rgba(22, 101, 52, 0.18);
}

.hero-badge.processing {
  color: #bae6fd;
  border-color: rgba(56, 189, 248, 0.52);
  background: rgba(14, 165, 233, 0.15);
}

.hero-badge.danger {
  color: #fecaca;
  border-color: rgba(239, 68, 68, 0.52);
  background: rgba(127, 29, 29, 0.18);
}

.mission-card,
.pipeline-card,
.card,
.metric-card {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.82), rgba(15, 23, 42, 0.62));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.mission-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 28px;
  border-radius: var(--radius-xl);
  margin-bottom: 20px;
}

.mission-card h2 {
  margin: 8px 0 10px;
  font-size: clamp(23px, 3vw, 34px);
}

.mission-card p {
  max-width: 700px;
  margin: 0;
  color: var(--muted);
  line-height: 1.72;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.metric-card {
  min-height: 112px;
  padding: 18px;
  border-radius: var(--radius-lg);
}

.metric-card strong {
  display: block;
  margin-top: 18px;
  overflow: hidden;
  color: #f8fafc;
  font-size: 20px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pipeline-card {
  padding: 22px;
  border-radius: var(--radius-xl);
  margin-bottom: 20px;
}

.pipeline-head,
.card-title-row,
.space-between,
.title-inline {
  display: flex;
  align-items: center;
}

.pipeline-head,
.space-between {
  justify-content: space-between;
}

.card-title-row,
.title-inline {
  gap: 10px;
}

.pulse-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 8px rgba(56, 189, 248, 0.1), 0 0 26px rgba(56, 189, 248, 0.65);
}

.progress-wrap {
  height: 34px;
  margin: 20px 0 16px;
  overflow: hidden;
  border: 1px solid rgba(56, 189, 248, 0.28);
  border-radius: 999px;
  background: rgba(2, 6, 23, 0.62);
}

.progress-bar {
  display: grid;
  place-items: center;
  width: 0%;
  height: 100%;
  min-width: 46px;
  border-radius: inherit;
  color: #00111a;
  font-size: 13px;
  font-weight: 900;
  background: linear-gradient(90deg, #22d3ee, #38bdf8, #818cf8);
  transition: width 0.35s ease;
}

.stage-rail {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.stage-rail span {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(2, 6, 23, 0.4);
  font-size: 12px;
  font-weight: 800;
}

.stage-rail span.done {
  color: #bbf7d0;
  border-color: rgba(34, 197, 94, 0.38);
}

.stage-rail span.active {
  color: #e0f2fe;
  border-color: rgba(56, 189, 248, 0.72);
  box-shadow: 0 0 22px rgba(56, 189, 248, 0.12);
}

.console-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
}

.card {
  padding: 22px;
  border-radius: var(--radius-xl);
}

.log-panel {
  margin-top: 18px;
}

.step-pill {
  display: inline-grid;
  place-items: center;
  min-width: 36px;
  height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(56, 189, 248, 0.45);
  border-radius: 999px;
  color: #bae6fd;
  background: rgba(14, 165, 233, 0.14);
  font-size: 12px;
  font-weight: 900;
}

label {
  display: block;
  margin: 18px 0 8px;
  color: var(--soft);
  font-size: 13px;
  font-weight: 800;
}

input,
select {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid rgba(148, 163, 184, 0.26);
  border-radius: 14px;
  color: var(--text);
  background: rgba(2, 6, 23, 0.55);
  outline: none;
}

input[type="file"] {
  padding: 11px 14px;
}

input:focus,
select:focus {
  border-color: rgba(56, 189, 248, 0.85);
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.12);
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.primary-btn,
.secondary-btn,
.ghost-btn {
  border: 0;
  border-radius: 999px;
  font-weight: 900;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.primary-btn {
  width: 100%;
  margin-top: 20px;
  padding: 14px 18px;
  color: #02111f;
  background: linear-gradient(90deg, #22d3ee, #38bdf8, #a78bfa);
  box-shadow: 0 18px 40px rgba(56, 189, 248, 0.18);
}

.primary-btn.glow {
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.18), 0 22px 50px rgba(56, 189, 248, 0.25);
}

.secondary-btn,
.ghost-btn {
  padding: 11px 14px;
  color: #dbeafe;
  border: 1px solid rgba(148, 163, 184, 0.24);
  background: rgba(15, 23, 42, 0.74);
}

.ghost-btn {
  background: transparent;
}

.primary-btn:not(:disabled):hover,
.secondary-btn:not(:disabled):hover,
.ghost-btn:not(:disabled):hover {
  transform: translateY(-1px);
}

.small-desc {
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.small-desc code,
.link-line code,
.artifact-card code {
  color: #a5f3fc;
  overflow-wrap: anywhere;
}

.info-box,
.artifact-grid,
#logBox {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: var(--radius-md);
  color: var(--soft);
  background: rgba(2, 6, 23, 0.45);
}

.info-box.muted,
.artifact-grid.muted {
  color: var(--muted);
}

.kv {
  display: grid;
  grid-template-columns: 135px minmax(0, 1fr);
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.09);
}

.kv:last-child {
  border-bottom: 0;
}

.kv span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.kv strong {
  overflow-wrap: anywhere;
  color: #f8fafc;
  font-size: 13px;
}

.link-line {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.warning-details {
  margin-top: 16px;
  border: 1px solid rgba(245, 158, 11, 0.24);
  border-radius: 14px;
  background: rgba(120, 53, 15, 0.15);
}

.warning-details summary {
  padding: 12px 14px;
  color: #fde68a;
  cursor: pointer;
  font-weight: 900;
}

.warning-details ul {
  margin: 0;
  padding: 0 18px 14px 34px;
  color: #fed7aa;
  line-height: 1.65;
}

.success-note {
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid rgba(34, 197, 94, 0.25);
  border-radius: 14px;
  color: #bbf7d0;
  background: rgba(22, 101, 52, 0.14);
}

.artifact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.artifact-card {
  display: grid;
  gap: 8px;
  min-height: 136px;
  padding: 16px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 18px;
  background: rgba(15, 23, 42, 0.58);
}

.artifact-card.primary-artifact {
  border-color: rgba(56, 189, 248, 0.9);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.25), 0 20px 50px rgba(14, 165, 233, 0.12);
}

.artifact-type {
  color: #93c5fd;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.artifact-card.primary-artifact .artifact-type {
  color: #67e8f9;
}

.artifact-card strong {
  color: #f8fafc;
  overflow-wrap: anywhere;
}

.artifact-card small {
  color: var(--muted);
}

.artifact-card code {
  display: block;
  font-size: 11px;
  line-height: 1.45;
}

#logBox {
  min-height: 260px;
  max-height: 460px;
  overflow: auto;
  color: #bfdbfe;
  white-space: pre-wrap;
}

@media (max-width: 980px) {
  .page-shell {
    width: min(100% - 28px, 900px);
  }

  .topbar,
  .mission-card {
    align-items: flex-start;
    flex-direction: column;
  }

  .metric-grid,
  .console-grid,
  .field-grid {
    grid-template-columns: 1fr;
  }

  .metric-card {
    min-height: 92px;
  }
}

@media (max-width: 560px) {
  .page-shell {
    width: min(100% - 20px, 900px);
    padding: 22px 0 38px;
  }

  .brand-mark {
    width: 48px;
    height: 48px;
  }

  .mission-card,
  .pipeline-card,
  .card {
    padding: 18px;
    border-radius: 22px;
  }

  .kv {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}


/* Overlay Viewer */
.overlay-panel {
  margin-top: 18px;
}

.overlay-viewer {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: var(--radius-md);
  color: var(--soft);
  background: rgba(2, 6, 23, 0.45);
}

.overlay-viewer.muted {
  color: var(--muted);
}

.overlay-summary-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px;
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: 18px;
  background: rgba(15, 23, 42, 0.72);
}

.overlay-summary-bar strong {
  display: block;
  margin-top: 4px;
  color: #f8fafc;
}

.overlay-summary-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.overlay-summary-metrics span {
  padding: 8px 10px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(2, 6, 23, 0.38);
  font-size: 12px;
  font-weight: 800;
}

.overlay-summary-metrics strong {
  display: inline;
  margin: 0;
  color: #e0f2fe;
}

.overlay-page-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}

.overlay-tab,
.mini-btn {
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 999px;
  color: #dbeafe;
  background: rgba(15, 23, 42, 0.74);
  font-size: 12px;
  font-weight: 900;
}

.overlay-tab {
  padding: 9px 12px;
}

.overlay-tab.active {
  color: #04111f;
  border-color: rgba(103, 232, 249, 0.9);
  background: linear-gradient(90deg, #67e8f9, #a5b4fc);
}

.mini-btn {
  justify-self: start;
  padding: 8px 10px;
}


.overlay-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 14px;
  padding: 12px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 18px;
  background: rgba(15, 23, 42, 0.42);
}

.overlay-filter-group,
.overlay-zoom-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.overlay-filter {
  padding: 8px 10px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 999px;
  color: #dbeafe;
  background: rgba(15, 23, 42, 0.74);
  font-size: 12px;
  font-weight: 900;
}

.overlay-filter.active {
  color: #04111f;
  border-color: rgba(103, 232, 249, 0.9);
  background: linear-gradient(90deg, #67e8f9, #a5b4fc);
}

.overlay-zoom-group strong {
  min-width: 48px;
  color: #f8fafc;
  text-align: center;
  font-size: 12px;
}

.overlay-scale-stage {
  position: relative;
  min-width: 100%;
  transform-origin: top left;
}

.overlay-selected-detail {
  margin: 4px 0 12px;
  padding: 12px;
  border: 1px solid rgba(251, 146, 60, 0.72);
  border-radius: 16px;
  color: #1f2937;
  background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
  box-shadow: 0 10px 24px rgba(124, 45, 18, 0.16);
  font-size: 12px;
  line-height: 1.5;
}

.overlay-detail-card {
  display: grid;
  gap: 10px;
}

.overlay-detail-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.overlay-detail-head span {
  padding: 4px 7px;
  border-radius: 999px;
  color: #04111f;
  background: #a5b4fc;
  font-weight: 900;
}

.overlay-detail-head strong {
  color: #f8fafc;
  overflow-wrap: anywhere;
}

.overlay-detail-grid {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  gap: 6px 10px;
}

.overlay-detail-grid span {
  color: var(--muted);
}

.overlay-detail-grid strong {
  color: #dbeafe;
  overflow-wrap: anywhere;
}

.overlay-detail-card p,
.overlay-detail-card small {
  margin: 0;
  overflow-wrap: anywhere;
}

.overlay-selected-detail .overlay-detail-head strong,
.overlay-selected-detail .overlay-detail-grid strong {
  color: #111827;
}

.overlay-selected-detail .overlay-detail-grid span,
.overlay-selected-detail .overlay-detail-card small,
.overlay-selected-detail .overlay-detail-card p {
  color: #374151;
}

.overlay-selected-detail code {
  color: #7c2d12;
  font-weight: 900;
}


.overlay-empty.compact {
  margin: 0;
  padding: 12px;
}

.overlay-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 0.9fr);
  gap: 16px;
}

.overlay-canvas-card,
.overlay-list-card {
  min-width: 0;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 20px;
  background: rgba(15, 23, 42, 0.48);
}

.overlay-canvas-card {
  overflow: hidden;
}

.overlay-canvas-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.overlay-canvas-head h3,
.overlay-list-card h3 {
  margin: 0;
  color: #f8fafc;
  font-size: 15px;
}

.overlay-canvas-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.overlay-canvas-head span {
  padding: 7px 9px;
  border: 1px solid rgba(56, 189, 248, 0.22);
  border-radius: 999px;
  color: #bae6fd;
  background: rgba(14, 165, 233, 0.1);
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.overlay-canvas-wrap {
  position: relative;
  width: 100%;
  min-height: 320px;
  overflow: auto;
  background: rgba(2, 6, 23, 0.75);
}

.overlay-image {
  display: block;
  width: 100%;
  height: auto;
}

.overlay-box-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.overlay-box {
  position: absolute;
  z-index: 2;
  min-width: 8px;
  min-height: 8px;
  padding: 0;
  border: 2px solid rgba(103, 232, 249, 0.95);
  border-radius: 4px;
  background: rgba(8, 145, 178, 0.13);
  box-shadow: 0 0 0 1px rgba(2, 6, 23, 0.8), 0 0 22px rgba(34, 211, 238, 0.18);
  pointer-events: auto;
}

.overlay-box.keyword-candidate {
  border-color: rgba(251, 191, 36, 0.95);
  background: rgba(245, 158, 11, 0.13);
  box-shadow: 0 0 0 1px rgba(2, 6, 23, 0.8), 0 0 22px rgba(245, 158, 11, 0.18);
}

.overlay-box.selected {
  border: 3px solid #ff3b30;
  background: rgba(255, 59, 48, 0.08);
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.96),
    0 0 0 5px rgba(255, 59, 48, 0.22),
    0 0 18px rgba(255, 59, 48, 0.9),
    0 0 32px rgba(255, 59, 48, 0.55);
  animation: overlayPulseRed 1.45s ease-in-out infinite;
}

.overlay-box span {
  position: absolute;
  left: 0;
  bottom: calc(100% + 3px);
  max-width: 260px;
  padding: 4px 7px;
  border-radius: 8px;
  color: #04111f;
  background: #67e8f9;
  font-size: 10px;
  font-weight: 900;
  line-height: 1.25;
  white-space: nowrap;
  pointer-events: none;
}

.overlay-box.keyword-candidate span {
  background: #fbbf24;
}

.overlay-list-card {
  display: flex;
  flex-direction: column;
  max-height: 720px;
  padding: 14px;
  overflow: hidden;
}

.overlay-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 12px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.overlay-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.overlay-legend i {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.legend-table {
  background: #67e8f9;
}

.legend-keyword {
  background: #fbbf24;
}

.overlay-item-list {
  display: grid;
  gap: 10px;
  overflow: auto;
  padding-right: 4px;
}

.overlay-list-item {
  display: grid;
  gap: 6px;
  width: 100%;
  padding: 12px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 16px;
  color: var(--soft);
  text-align: left;
  background: rgba(2, 6, 23, 0.38);
}

.overlay-list-item.selected {
  border-color: rgba(255, 59, 48, 0.92);
  background: rgba(255, 59, 48, 0.12);
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.12),
    0 0 0 4px rgba(255, 59, 48, 0.12),
    0 0 18px rgba(255, 59, 48, 0.32);
}

.overlay-list-type {
  justify-self: start;
  padding: 4px 7px;
  border-radius: 999px;
  color: #04111f;
  background: #67e8f9;
  font-size: 10px;
  font-weight: 900;
}

.overlay-list-type.keyword {
  background: #fbbf24;
}

.overlay-list-item strong {
  color: #f8fafc;
  overflow-wrap: anywhere;
}

.overlay-list-item small {
  color: var(--muted);
}

.overlay-list-item p {
  margin: 0;
  color: var(--soft);
  font-size: 12px;
  line-height: 1.5;
}

.overlay-list-item code {
  color: #a5f3fc;
  font-size: 11px;
  overflow-wrap: anywhere;
}

.overlay-warning,
.overlay-empty {
  margin-top: 14px;
  padding: 13px 14px;
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: 16px;
  color: #fde68a;
  background: rgba(120, 53, 15, 0.16);
  line-height: 1.6;
}

.overlay-empty code {
  color: #a5f3fc;
  overflow-wrap: anywhere;
}

@media (max-width: 980px) {
  .overlay-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .overlay-layout {
    grid-template-columns: 1fr;
  }

  .overlay-list-card {
    max-height: 460px;
  }
}


@keyframes overlayPulseRed {
  0%,
  100% {
    box-shadow:
      0 0 0 2px rgba(255, 255, 255, 0.96),
      0 0 0 5px rgba(255, 59, 48, 0.18),
      0 0 14px rgba(255, 59, 48, 0.75),
      0 0 28px rgba(255, 59, 48, 0.42);
  }

  50% {
    box-shadow:
      0 0 0 2px rgba(255, 255, 255, 0.98),
      0 0 0 6px rgba(255, 59, 48, 0.24),
      0 0 22px rgba(255, 59, 48, 0.98),
      0 0 40px rgba(255, 59, 48, 0.62);
  }
}

/* Final Delivery Package v6.53 */
.final-delivery-panel {
  margin-top: 18px;
}

.final-delivery-box {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: var(--radius-md);
  color: var(--soft);
  background: rgba(2, 6, 23, 0.45);
}

.final-delivery-box.muted {
  color: var(--muted);
}

.final-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  border: 1px solid rgba(56, 189, 248, 0.24);
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.16), rgba(139, 92, 246, 0.14));
}

.final-hero.ready {
  border-color: rgba(34, 197, 94, 0.34);
  background: linear-gradient(135deg, rgba(22, 101, 52, 0.20), rgba(14, 165, 233, 0.12));
}

.final-hero h3 {
  margin: 6px 0 4px;
  color: #f8fafc;
  font-size: clamp(20px, 2vw, 28px);
  letter-spacing: -0.04em;
}

.final-hero p {
  margin: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.final-hero-actions,
.final-downloads {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.download-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 9px 12px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 999px;
  color: #dbeafe;
  background: rgba(15, 23, 42, 0.78);
  text-decoration: none;
  font-size: 12px;
  font-weight: 900;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.download-chip:hover {
  transform: translateY(-1px);
  border-color: rgba(103, 232, 249, 0.74);
  background: rgba(14, 165, 233, 0.18);
}

.download-chip small {
  color: var(--muted);
  font-weight: 800;
}

.download-chip.primary-download {
  min-height: 46px;
  padding: 12px 18px;
  color: #02111f;
  border-color: rgba(103, 232, 249, 0.95);
  background: linear-gradient(90deg, #22d3ee, #38bdf8, #a78bfa);
  box-shadow: 0 18px 40px rgba(56, 189, 248, 0.18);
}

.download-chip.primary-download small {
  color: rgba(2, 17, 31, 0.72);
}

.download-chip.dwg-download {
  border-color: rgba(34, 197, 94, 0.46);
  color: #bbf7d0;
  background: rgba(22, 101, 52, 0.18);
}

.download-chip.disabled {
  opacity: 0.42;
  pointer-events: none;
}

.final-summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.final-summary-grid div {
  padding: 13px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.48);
}

.final-summary-grid span,
.final-page-meta span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.final-summary-grid strong {
  display: block;
  margin-top: 6px;
  color: #f8fafc;
  font-size: 20px;
}

.final-page-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.final-page-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 20px;
  background: rgba(15, 23, 42, 0.56);
}

.final-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.final-page-head strong {
  display: block;
  margin-top: 4px;
  color: #f8fafc;
  overflow-wrap: anywhere;
}

.final-page-head small {
  max-width: 150px;
  color: #bbf7d0;
  text-align: right;
  overflow-wrap: anywhere;
}

.final-page-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.final-page-meta span {
  padding: 6px 8px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 999px;
  background: rgba(2, 6, 23, 0.35);
}

@media (max-width: 980px) {
  .final-hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .final-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

  .download-chip {
    width: 100%;
  }
}


/* v6.53.1: Final delivery buttons use Reports label instead of Quality. */



/* AI-DAR v8.21.4.2 structured law evidence detail */

.overlay-law-detail-card {
  display: grid;
  gap: 14px;
}

.overlay-law-detail-head {
  padding-bottom: 2px;
}

.overlay-law-sections {
  display: grid;
  gap: 0;
  overflow: hidden;
  border: 1px solid rgba(136, 90, 44, 0.22);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.54);
}

.overlay-law-section {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(136, 90, 44, 0.14);
}

.overlay-law-section:last-child {
  border-bottom: 0;
}

.overlay-law-label {
  color: #6b7280;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
}

.overlay-law-section strong {
  min-width: 0;
  color: #111827;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.overlay-law-status {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  align-items: center;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.25;
  letter-spacing: 0.01em;
}

.overlay-law-status.confirmed {
  color: #065f46;
  background: #d1fae5;
  border: 1px solid #6ee7b7;
}

.overlay-law-status.review {
  color: #92400e;
  background: #fef3c7;
  border: 1px solid #fcd34d;
}

.overlay-law-status.unsupported,
.overlay-law-status.neutral {
  color: #4b5563;
  background: #f3f4f6;
  border: 1px solid #d1d5db;
}

.overlay-law-note {
  padding: 11px 12px;
  border: 1px solid rgba(251, 146, 60, 0.28);
  border-radius: 12px;
  background: rgba(255, 247, 237, 0.82);
}

.overlay-law-note strong {
  display: block;
  margin-bottom: 5px;
  color: #9a3412;
  font-size: 12px;
}

.overlay-law-note p {
  margin: 0;
  color: #7c2d12;
  line-height: 1.55;
}

.overlay-law-source,
.overlay-technical-detail {
  overflow: hidden;
  border: 1px solid rgba(136, 90, 44, 0.18);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.48);
}

.overlay-law-source summary,
.overlay-technical-detail summary {
  cursor: pointer;
  padding: 10px 12px;
  color: #7c2d12;
  font-size: 12px;
  font-weight: 900;
  user-select: none;
}

.overlay-law-source[open] summary,
.overlay-technical-detail[open] summary {
  border-bottom: 1px solid rgba(136, 90, 44, 0.14);
}

.overlay-law-source p {
  max-height: 240px;
  margin: 0;
  padding: 11px 12px;
  overflow: auto;
  color: #374151;
  line-height: 1.65;
  white-space: normal;
}

.overlay-technical-detail .overlay-detail-grid {
  padding: 11px 12px;
}

.overlay-technical-detail > p {
  margin: 0;
  padding: 0 12px 12px;
  color: #4b5563;
  line-height: 1.55;
}

@media (max-width: 700px) {
  .overlay-law-section {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}




/* AI-DAR v8.21.4.3 overlay selected detail vertical scroll */

#overlaySelectedDetail {
  max-height: 46vh;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding-right: 4px;
}

#overlaySelectedDetail {
  scrollbar-width: thin;
  scrollbar-color:
    rgba(148, 163, 184, 0.78)
    rgba(15, 23, 42, 0.22);
}

#overlaySelectedDetail::-webkit-scrollbar {
  width: 9px;
}

#overlaySelectedDetail::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.22);
  border-radius: 999px;
}

#overlaySelectedDetail::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.78);
  border: 2px solid rgba(15, 23, 42, 0.22);
  border-radius: 999px;
}

#overlaySelectedDetail::-webkit-scrollbar-thumb:hover {
  background: rgba(203, 213, 225, 0.92);
}

@media (max-height: 800px) {
  #overlaySelectedDetail {
    max-height: 40vh;
  }
}

@media (max-width: 700px) {
  #overlaySelectedDetail {
    max-height: 44vh;
  }
}

