/* saaskr.com 디자인 시스템 기반 라이트 테마 */
@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable-dynamic-subset.min.css');

:root {
  --bg:      #ffffff;
  --panel:   #f8fafc;
  --panel2:  #f1f5f9;
  --line:    #e2e8f0;
  --txt:     #0f172a;
  --muted:   #64748b;
  --accent:  #0f172a;
  --accent-fg: #ffffff;
  --accent-light: #f1f5f9;
  --ok:      #16a34a;
  --ok-bg:   #dcfce7;
  --run:     #d97706;
  --run-bg:  #fef9c3;
  --err:     #dc2626;
  --err-bg:  #fee2e2;
  --idle:    #94a3b8;
  --idle-bg: #f1f5f9;
  --radius:  0.5rem;
  --shadow:  0 1px 3px rgba(15,23,42,0.08), 0 1px 2px rgba(15,23,42,0.06);
  --shadow-md: 0 4px 6px rgba(15,23,42,0.07), 0 2px 4px rgba(15,23,42,0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--txt);
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── 상단 네비게이션 ── */
.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 24px;
  height: 60px;
  background: rgba(255,255,255,0.85);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 100;
}
.brand { display: flex; align-items: baseline; gap: 7px; }
.brand:hover { text-decoration: none; }
.brand-logo { font-size: 17px; }
.brand-name { font-size: 17px; font-weight: 800; color: var(--txt); letter-spacing: -0.03em; }
.brand-sub { font-size: 12px; color: var(--muted); font-weight: 500; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.topsearch {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--txt);
  padding: 8px 13px;
  border-radius: var(--radius);
  width: 200px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.topsearch:focus { border-color: var(--accent); background: var(--bg); box-shadow: 0 0 0 3px rgba(15,23,42,0.06); }
@media (max-width: 720px) {
  .brand-sub { display: none; }
  .topsearch { width: 130px; }
}

/* ── 좌측 사이드바 ── */
.app-shell { display: flex; align-items: flex-start; }
.sidebar {
  width: 224px;
  flex-shrink: 0;
  border-right: 1px solid var(--line);
  background: var(--bg);
  position: sticky;
  top: 60px;
  height: calc(100vh - 60px);
  overflow-y: auto;
  padding: 20px 14px;
}
.sidenav { display: flex; flex-direction: column; gap: 2px; }
.sidenav-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 14px 12px 6px;
}
.sidenav-label:first-child { padding-top: 4px; }
.sidenav a {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  line-height: 1.3;
  color: var(--muted);
  padding: 8px 12px;
  border-radius: var(--radius);
  transition: color .15s, background .15s;
}
.sidenav a .nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.sidenav a .nav-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}
.sidenav a:hover { color: var(--txt); background: var(--panel2); text-decoration: none; }
.sidenav a.active { color: var(--txt); font-weight: 600; background: var(--panel2); }
.app-shell > .container { flex: 1; min-width: 0; }
@media (max-width: 720px) {
  .app-shell { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
  .sidenav { flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .sidenav-label { display: none; }
}

/* ── 레이아웃 ── */
.container { max-width: 1100px; margin: 0 auto; padding: 28px 24px; }
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
h1 { font-size: 22px; font-weight: 700; margin: 0; letter-spacing: -0.02em; }
h2 { font-size: 16px; font-weight: 600; margin: 0 0 12px; }

/* ── 버튼 ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: var(--accent-fg);
  padding: 8px 16px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  transition: opacity .15s, background .15s;
  white-space: nowrap;
}
.btn:hover { opacity: .85; text-decoration: none; }
.btn.ghost {
  background: var(--bg);
  border-color: var(--line);
  color: var(--txt);
}
.btn.ghost:hover { background: var(--panel2); opacity: 1; }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn.danger { background: var(--err); border-color: var(--err); }

/* ── 테이블 ── */
.grid {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.grid th, .grid td {
  padding: 11px 16px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.grid th { color: var(--muted); font-weight: 500; background: var(--panel); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.grid tr:last-child td { border-bottom: none; }
.grid tbody tr:hover { background: var(--panel); }

/* ── 카드 ── */
.card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

/* ── 히어로 섹션 ── */
.hero {
  text-align: center;
  padding: 48px 20px 40px;
  margin-bottom: 8px;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--accent-light);
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 22px;
}
.hero-badge::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--ok);
}
.hero-title {
  font-size: 42px;
  font-weight: 800;
  line-height: 1.18;
  letter-spacing: -0.035em;
  margin: 0 0 18px;
  color: var(--txt);
}
.hero-sub {
  font-size: 16px;
  color: var(--muted);
  max-width: 560px;
  margin: 0 auto 26px;
  line-height: 1.65;
}
.hero-actions { display: flex; gap: 10px; justify-content: center; }
.hero-actions .btn { padding: 11px 22px; font-size: 15px; }

/* ── 요약 통계 ── */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 32px;
}
.stat-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 20px;
}
.stat-val { font-size: 28px; font-weight: 800; letter-spacing: -0.03em; color: var(--txt); display: block; }
.stat-label { font-size: 13px; color: var(--muted); margin-top: 2px; display: block; }

/* ── 섹션 헤더 ── */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 16px;
}
.section-head h2 { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }
.section-head .count { color: var(--muted); font-weight: 400; font-size: 14px; margin-left: 8px; }

/* ── 업체 카드 그리드 ── */
.company-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.company-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  box-shadow: var(--shadow);
  transition: box-shadow .18s, transform .18s, border-color .18s;
  display: flex;
  flex-direction: column;
}
.company-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: #cbd5e1; }
.cc-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.cc-avatar {
  width: 44px; height: 44px;
  border-radius: 11px;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  flex-shrink: 0;
}
.cc-title { flex: 1; min-width: 0; }
.cc-name { display: block; font-size: 16px; font-weight: 700; color: var(--txt); letter-spacing: -0.01em; }
.cc-name:hover { text-decoration: underline; }
.cc-domain { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.cc-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 14px 0;
  margin-bottom: 16px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.cc-stat { text-align: center; }
.cc-stat-val { font-size: 20px; font-weight: 800; color: var(--txt); display: block; letter-spacing: -0.02em; }
.cc-stat-label { font-size: 11px; color: var(--muted); margin-top: 2px; display: block; }
.cc-actions { display: flex; gap: 8px; margin-top: auto; }
.cc-actions .btn { flex: 1; justify-content: center; }
.cc-actions .btn.icon-only { flex: 0 0 auto; }

/* ── 섹션 래퍼 ── */
.home-section { margin-bottom: 44px; }
.home-section > p.section-desc { color: var(--muted); font-size: 14px; margin: -8px 0 18px; }

/* ── 에이전트 카테고리 카드 ── */
.agent-cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.agent-cat-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  display: flex;
  gap: 13px;
  align-items: flex-start;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.agent-cat-card:hover { border-color: #cbd5e1; box-shadow: var(--shadow-md); transform: translateY(-2px); }
.acc-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.acc-icon svg { width: 21px; height: 21px; }
.acc-icon.ic-blue   { background: #eff6ff; color: #2563eb; }
.acc-icon.ic-amber  { background: #fffbeb; color: #d97706; }
.acc-icon.ic-teal   { background: #f0fdfa; color: #0d9488; }
.acc-icon.ic-purple { background: #f5f3ff; color: #7c3aed; }
.acc-icon.ic-rose   { background: #fff1f2; color: #e11d48; }
.acc-icon.ic-orange { background: #fff7ed; color: #ea580c; }
.acc-icon.ic-indigo { background: #eef2ff; color: #4f46e5; }
.acc-body { min-width: 0; }
.acc-name { font-size: 14px; font-weight: 700; color: var(--txt); display: flex; align-items: center; gap: 6px; }
.acc-step { font-size: 10px; font-weight: 600; color: var(--muted); background: var(--panel2); padding: 1px 6px; border-radius: 999px; }
.acc-desc { font-size: 12.5px; color: var(--muted); margin-top: 4px; line-height: 1.5; }

/* ── CTA 섹션 ── */
.cta-section {
  background: var(--accent);
  border-radius: 18px;
  padding: 44px 40px;
  text-align: center;
  margin-bottom: 44px;
}
.cta-section h2 { color: #fff; font-size: 26px; font-weight: 800; letter-spacing: -0.03em; margin: 0 0 10px; }
.cta-section p { color: #cbd5e1; font-size: 15px; margin: 0 0 22px; }
.cta-section .btn {
  background: #fff; color: var(--accent); border-color: #fff;
  padding: 12px 26px; font-size: 15px; font-weight: 600;
}
.cta-section .btn:hover { opacity: .9; }

/* ── 다단 푸터 ── */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--panel);
  margin-top: 40px;
}
.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 24px 28px;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
  gap: 32px;
}
.footer-brand .fb-name { font-size: 16px; font-weight: 800; color: var(--txt); letter-spacing: -0.02em; }
.footer-brand p { font-size: 13px; color: var(--muted); margin: 10px 0 0; line-height: 1.6; max-width: 280px; }
.footer-col h4 { font-size: 13px; font-weight: 700; color: var(--txt); margin: 0 0 12px; }
.footer-col a, .footer-col span { display: block; font-size: 13px; color: var(--muted); padding: 4px 0; }
.footer-col a:hover { color: var(--txt); }
.footer-bottom {
  border-top: 1px solid var(--line);
  padding: 16px 24px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}
@media (max-width: 720px) {
  .footer-inner { grid-template-columns: 1fr 1fr; gap: 24px; }
}

/* ── 폼 ── */
.form { display: grid; gap: 14px; max-width: 520px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; color: var(--txt); }
.form input, .form textarea, .form select {
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--txt);
  padding: 9px 12px;
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
.form input:focus, .form textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15,23,42,0.08);
}
.actions { display: flex; gap: 10px; margin: 10px 0; }

/* ── 상태 배지 ── */
.pill { padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 500; }
.pill.ok   { background: var(--ok-bg);   color: var(--ok); }
.pill.run  { background: var(--run-bg);  color: var(--run); }
.pill.idle { background: var(--idle-bg); color: var(--idle); }
.pill.err-pill { background: var(--err-bg); color: var(--err); }

/* ── 배너 ── */
.banner { padding: 12px 16px; border-radius: var(--radius); margin: 12px 0; font-size: 14px; border: 1px solid; }
.banner.warn { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.banner.ok   { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
.banner.err  { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.banner.info { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }
.hidden { display: none; }

/* ── 기타 유틸 ── */
.muted { color: var(--muted); }
.err   { color: var(--err); }
.json, pre {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 13px;
  line-height: 1.6;
}

/* ── 흐름 시각화 ── */
.flow-page { display: flex; flex-direction: column; height: calc(100vh - 56px); overflow: hidden; }
.flow-topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 20px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  flex-wrap: wrap;
}
.flow-title-group { display: flex; align-items: center; gap: 10px; }
.flow-title-group h2 { margin: 0; font-size: 15px; }

.round-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.rtab {
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 4px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all .15s;
}
.rtab:hover { border-color: var(--accent); color: var(--txt); }
.rtab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.rtab-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }

.flow-badge { padding: 5px 14px; border-radius: 999px; font-size: 12px; font-weight: 600; margin-left: auto; }
.flow-badge.idle    { background: var(--idle-bg); color: var(--idle); }
.flow-badge.done    { background: var(--ok-bg);   color: var(--ok); }
.flow-badge.running { background: var(--run-bg);  color: var(--run); }
.flow-badge.run     { background: var(--run-bg);  color: var(--run); }

.flow-body { display: flex; flex: 1; overflow: hidden; }
.flow-graph-wrap { flex: 1; position: relative; overflow: hidden; background: var(--panel); }
.flow-svg { position: absolute; top: 0; left: 0; pointer-events: none; }
.flow-nodes { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }

/* ── 플로우 노드 ── */
.fnode {
  position: absolute;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.fnode:hover { transform: scale(1.03); box-shadow: var(--shadow-md); border-color: var(--accent); }
.fnode-inner { display: flex; align-items: center; gap: 8px; padding: 0 12px; height: 100%; }
.fnode-icon  { font-size: 18px; flex-shrink: 0; }
.fnode-text  { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.fnode-text b { color: var(--txt); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fnode-status { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; margin-left: auto; }

/* ── 산출물 패널 ── */
.panel-placeholder {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  text-align: center;
  font-size: 14px;
  padding: 20px;
}
.panel-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; padding: 16px; }
.panel-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}
.panel-head span:first-child { font-size: 20px; }
.panel-head strong { font-size: 14px; font-weight: 600; color: var(--txt); }
.panel-head code {
  font-size: 11px;
  background: var(--panel2);
  padding: 2px 7px;
  border-radius: 4px;
  color: var(--muted);
  border: 1px solid var(--line);
}
.panel-content pre {
  flex: 1;
  overflow-y: auto;
  font-size: 13.5px;
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  background: var(--panel);
  border-radius: var(--radius);
  padding: 18px 20px;
}

/* 흐름도 전체 너비 (컨테이너 자체 패딩만 탈출) */
.flow-fullbleed {
  width: calc(100% + 48px);
  margin-left: -24px;
  margin-right: -24px;
}

/* ── 문서 목록 ── */
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab {
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
  transition: all .15s;
  background: var(--bg);
}
.tab:hover { border-color: var(--accent); color: var(--txt); text-decoration: none; }
.tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.tab b { font-weight: 700; }
.search-box {
  margin-left: auto;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--txt);
  padding: 7px 12px;
  border-radius: var(--radius);
  width: 220px;
  font-size: 13px;
  outline: none;
  transition: border-color .15s;
}
.search-box:focus { border-color: var(--accent); }

.bs-table { width: 100%; border-collapse: collapse; font-size: 13px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.bs-table th, .bs-table td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.bs-table th { background: var(--panel, var(--bg)); color: var(--muted); font-weight: 600; }
.bs-table td.num, .bs-table th:nth-last-child(-n+3) { text-align: right; }
.bs-table tbody tr:hover { background: var(--hover, rgba(255,255,255,.03)); }

.doc-grid { display: grid; gap: 10px; }
.doc-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  box-shadow: var(--shadow);
  transition: box-shadow .15s;
}
.doc-card:hover { box-shadow: var(--shadow-md); }
.doc-meta { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; font-size: 12px; flex-wrap: wrap; }
.source-tag { color: var(--accent); font-weight: 600; font-size: 11px; background: var(--panel2); padding: 2px 8px; border-radius: 999px; }
.doc-title { font-size: 14px; font-weight: 600; display: block; margin-bottom: 6px; color: var(--txt); }
.doc-title:hover { text-decoration: underline; }
.doc-body { font-size: 13px; color: var(--muted); margin: 0; line-height: 1.5; }
.pagination { display: flex; align-items: center; gap: 14px; justify-content: center; padding: 24px 0; }

/* ── 푸터 ── */
.foot { text-align: center; color: var(--muted); padding: 28px; font-size: 12px; border-top: 1px solid var(--line); margin-top: 24px; }

/* ── 파이프라인 흐름도 ── */
.pipe-phase {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 4px;
  box-shadow: var(--shadow);
}
.pipe-phase.idle-phase { opacity: .55; }
.phase-header { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.phase-icon { font-size: 20px; }
.phase-title { font-size: 15px; font-weight: 700; flex: 1; }
.phase-stat { font-size: 12px; padding: 3px 10px; border-radius: 999px; font-weight: 600; }
.phase-stat.ok   { background: var(--ok-bg);   color: var(--ok); }
.phase-stat.run  { background: var(--run-bg);  color: var(--run); }
.phase-stat.idle { background: var(--idle-bg); color: var(--idle); }

/* ── 수집 칩 ── */
.collect-chips { display: flex; gap: 10px; flex-wrap: wrap; }
.collect-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  font-size: 13px;
  background: var(--bg);
  transition: all .15s;
}
.collect-chip.done { border-color: #86efac; background: #f0fdf4; }
.collect-chip.idle { opacity: .5; }
.chip-icon  { font-size: 16px; }
.chip-label { color: var(--txt); font-weight: 600; }
.chip-cnt   { color: var(--muted); font-size: 12px; }
.collect-chip.done .chip-cnt { color: var(--ok); }

/* ── 에이전트 카드 ── */
.agent-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin: 4px 0; }
.agent-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  min-width: 160px;
  box-shadow: var(--shadow);
  transition: all .15s;
}
.agent-card:hover { border-color: var(--accent); box-shadow: var(--shadow-md); }
.agent-card.selected { border-color: var(--accent); background: var(--panel2); }
.agent-card.done     { border-color: #86efac; background: #f0fdf4; }
.agent-card.running  { border-color: #fcd34d; background: #fffbeb; }
.ag-icon { font-size: 20px; }
.ag-body { flex: 1; }
.ag-body strong { display: block; font-size: 13px; font-weight: 600; }
.ag-sub { font-size: 11px; color: var(--muted); }
.ag-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.ag-dot.done    { background: var(--ok); }
.ag-dot.running { background: var(--run); }
.ag-dot.idle    { background: var(--line); }
.agent-arrow { text-align: center; color: var(--muted); font-size: 18px; line-height: 1.2; }
.debate-badge {
  margin-top: 10px;
  text-align: center;
  font-size: 12px;
  color: var(--run);
  background: var(--run-bg);
  border-radius: var(--radius);
  padding: 5px 12px;
  display: inline-block;
}

/* ── 결과 그리드 ── */
.result-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.result-item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  text-align: center;
}
.ri-label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.ri-val   { font-size: 15px; font-weight: 700; color: var(--txt); }

/* ── 파이프 화살표 ── */
.pipe-arrow { display: flex; flex-direction: column; align-items: center; padding: 2px 0; color: var(--muted); font-size: 12px; gap: 1px; }
.arrow-line { width: 2px; height: 12px; background: var(--line); }
.arrow-head { font-size: 14px; line-height: 1; }
.arrow-label { font-size: 11px; color: var(--muted); }

/* ── 기억/인사이트 ── */
.mem-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.mem-list li { border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.insight-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.round { font-weight: 700; }
details summary { cursor: pointer; padding: 6px 0; color: var(--accent); font-size: 14px; }

/* ── 사업자 관리 공통 ── */
.badge { display:inline-flex; align-items:center; padding:2px 10px; border-radius:999px; font-size:12px; font-weight:600; }
.badge-ok   { background:var(--ok-bg);   color:var(--ok); }
.badge-run  { background:var(--run-bg);  color:var(--run); }
.badge-err  { background:var(--err-bg);  color:var(--err); }
.badge-idle { background:var(--idle-bg); color:var(--idle); }

.meta-row { display:flex; flex-wrap:wrap; gap:12px; margin-top:4px; }
.meta-item { font-size:13px; color:var(--muted); }

.chip {
  display:inline-block; padding:2px 10px; border-radius:999px;
  background:var(--panel2); border:1px solid var(--line);
  font-size:12px; color:var(--txt); text-decoration:none;
}
.chip:hover { background:var(--accent-light); text-decoration:none; }

.empty-state { text-align:center; padding:60px 20px; color:var(--muted); }

.modal-backdrop {
  position:fixed; inset:0; background:rgba(15,23,42,0.4);
  display:flex; align-items:center; justify-content:center; z-index:500;
  backdrop-filter:blur(2px);
}
.modal-box {
  background:var(--bg); border-radius:12px; width:90%; max-height:90vh;
  overflow-y:auto; box-shadow:var(--shadow-md);
  padding:24px;
}
.modal-head { display:flex; align-items:center; justify-content:space-between; margin-bottom:20px; font-size:17px; font-weight:700; }
.modal-foot { display:flex; justify-content:flex-end; gap:10px; margin-top:24px; }
.icon-btn { background:none; border:none; cursor:pointer; font-size:18px; color:var(--muted); padding:4px 8px; }
.icon-btn:hover { color:var(--txt); }

.form-grid { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.form-label { display:flex; flex-direction:column; gap:5px; font-size:13px; font-weight:500; color:var(--muted); }
.form-input {
  padding:9px 12px; border:1px solid var(--line); border-radius:var(--radius);
  font-size:14px; font-family:inherit; color:var(--txt); background:var(--bg); outline:none;
}
.form-input:focus { border-color:var(--accent); box-shadow:0 0 0 3px rgba(15,23,42,0.06); }
.form-input:disabled { background:var(--panel2); color:var(--muted); }
.req { color:var(--err); }

.notice { border-radius:var(--radius); padding:14px 16px; font-size:14px; }
.notice-warn { background:var(--run-bg); color:#92400e; }
.notice-warn a { color:#92400e; text-decoration:underline; }
.notice-warn code { background:rgba(0,0,0,0.08); padding:1px 5px; border-radius:4px; font-size:12px; }
.notice-err  { background:var(--err-bg); color:var(--err); }

/* ── 사업자 카드 ── */
.biz-list { display:grid; gap:16px; }
.biz-card {
  display:flex; gap:20px; background:var(--bg);
  border:1px solid var(--line); border-radius:12px;
  padding:20px; box-shadow:var(--shadow);
  transition: box-shadow .15s;
}
.biz-card:hover { box-shadow:var(--shadow-md); }
.biz-card-body { flex:1; min-width:0; }
.biz-card-head { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; flex-wrap:wrap; }
.biz-actions { display:flex; gap:6px; flex-wrap:wrap; flex-shrink:0; }
.err-btn { color:var(--err) !important; }

/* 사업자등록증 썸네일 */
.cert-thumb {
  width:140px; height:100px; flex-shrink:0;
  border:2px solid var(--line); border-radius:8px;
  overflow:hidden; cursor:pointer; position:relative;
  display:flex; align-items:center; justify-content:center;
  background:var(--panel2);
}
.cert-thumb img { width:100%; height:100%; object-fit:cover; }
.cert-thumb-overlay {
  position:absolute; inset:0; background:rgba(15,23,42,0.5);
  color:#fff; font-size:12px; font-weight:600;
  display:flex; align-items:center; justify-content:center;
  opacity:0; transition:opacity .15s;
}
.cert-thumb:hover .cert-thumb-overlay { opacity:1; }
.cert-thumb-empty { flex-direction:column; gap:4px; font-size:24px; color:var(--muted); cursor:default; }
.cert-thumb-empty span { font-size:11px; }

.valid-badge {
  display:inline-block; font-size:12px; font-weight:600;
  padding:2px 8px; border-radius:999px;
  background:var(--ok-bg); color:var(--ok); margin-left:6px;
}
.valid-badge.invalid { background:var(--err-bg); color:var(--err); }

/* 파일 드롭존 */
.drop-zone {
  border:2px dashed var(--line); border-radius:10px;
  padding:20px; text-align:center; cursor:pointer;
  transition:border-color .15s, background .15s;
  background:var(--panel);
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color:var(--accent); background:var(--accent-light);
}

/* 스피너 */
.spinner {
  display:inline-block; width:14px; height:14px;
  border:2px solid var(--line); border-top-color:var(--accent);
  border-radius:50%; animation:spin .7s linear infinite;
  margin-right:6px; vertical-align:middle;
}
@keyframes spin { to { transform:rotate(360deg); } }
@keyframes slideInRight { from { transform:translateX(40px); opacity:0; } to { transform:translateX(0); opacity:1; } }
@keyframes fadeInUp { from { transform:translateY(12px); opacity:0; } to { transform:translateY(0); opacity:1; } }

/* ── 모달 내 인증 결과 ── */
.verify-result {
  display:flex; flex-direction:column; align-items:center; text-align:center;
  padding:24px 20px; border-radius:10px; margin-bottom:16px;
  animation: fadeInUp .3s ease;
}
.verify-ok   { background:var(--ok-bg);  border:1.5px solid var(--ok); }
.verify-err  { background:var(--err-bg); border:1.5px solid var(--err); }
.verify-warn { background:var(--run-bg); border:1.5px solid var(--run); }
.verify-icon { font-size:40px; margin-bottom:8px; }
.verify-title { font-size:17px; font-weight:700; margin-bottom:6px; }
.verify-desc  { font-size:14px; line-height:1.6; color:var(--muted); }

/* ── 로그인 / 회원가입 ── */
.auth-page { display:flex; align-items:center; justify-content:center; min-height:100vh; background:var(--panel); }
.auth-container { width:100%; max-width:400px; padding:24px 16px; }
.auth-brand { text-align:center; margin-bottom:24px; }
.auth-card {
  background:var(--bg); border:1px solid var(--line); border-radius:16px;
  padding:32px 28px; box-shadow:var(--shadow-md);
}
.auth-title { font-size:20px; font-weight:700; margin:0 0 24px; text-align:center; }
.auth-btn { width:100%; padding:12px; font-size:15px; margin-top:4px; }
.auth-footer { text-align:center; margin-top:20px; font-size:13px; color:var(--muted); }
.auth-footer a { color:var(--accent); font-weight:600; }
.auth-error {
  background:var(--err-bg); color:var(--err); border:1px solid var(--err);
  border-radius:var(--radius); padding:10px 14px; font-size:13px; margin-bottom:16px;
}
.auth-success {
  background:var(--ok-bg); color:var(--ok); border:1px solid var(--ok);
  border-radius:var(--radius); padding:10px 14px; font-size:13px; margin-bottom:16px;
}
.field-hint { font-size:11px; color:var(--muted); }

/* ── 반응형 ── */
@media (max-width: 600px) {
  .result-grid { grid-template-columns: repeat(2, 1fr); }
  .agent-card  { min-width: 130px; }
  .container   { padding: 16px; }
  .form-grid   { grid-template-columns: 1fr; }
}


/* ── 챗머니 ─────────────────────────────────────────────────────────────── */
.cm-wrap {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 220px);
  max-width: 820px;
  margin: 0 auto;
}
.cm-intro { text-align: center; margin: 80px 0 30px; }
.cm-intro h1 { font-size: 26px; margin: 0 0 8px; }

.cm-messages {
  flex: 1;
  display: none;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  padding: 10px 4px 20px;
  max-height: 60vh;
}
.cm-messages.active { display: flex; }

.cm-msg { display: flex; }
.cm-msg-user { justify-content: flex-end; }
.cm-msg-assistant { justify-content: flex-start; }

.cm-bubble {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 14px;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.55;
}
.cm-msg-user .cm-bubble { background: var(--accent); color: var(--accent-fg); border-bottom-right-radius: 4px; }
.cm-msg-assistant .cm-bubble { background: var(--panel); border: 1px solid var(--line); border-bottom-left-radius: 4px; }

.cm-typing::after {
  content: "●●●";
  letter-spacing: 2px;
  color: var(--muted);
  animation: cm-blink 1.2s infinite;
}
@keyframes cm-blink { 0%,100% { opacity: 0.2; } 50% { opacity: 1; } }

.cm-composer {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px 14px 10px;
  box-shadow: var(--shadow);
  background: var(--bg);
  margin-top: auto;
}
.cm-textarea {
  width: 100%;
  border: none;
  outline: none;
  resize: none;
  font: inherit;
  font-size: 15px;
  background: transparent;
  color: var(--txt);
  max-height: 200px;
}
.cm-toolbar { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.cm-toolbar-left { display: flex; align-items: center; gap: 6px; }
.cm-icon-btn {
  border: none; background: transparent; font-size: 16px; cursor: pointer;
  padding: 6px; border-radius: 8px; color: var(--muted);
}
.cm-icon-btn:disabled { opacity: 0.4; cursor: default; }
.cm-pill {
  border: 1px solid var(--line); background: var(--panel2); border-radius: 999px;
  padding: 6px 12px; font-size: 13px; color: var(--txt); cursor: pointer;
}
.cm-pill.active { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.cm-send-btn {
  border: none; background: var(--accent); color: var(--accent-fg);
  width: 34px; height: 34px; border-radius: 50%; font-size: 15px; cursor: pointer;
}
.cm-send-btn:disabled { opacity: 0.5; cursor: default; }
.cm-disclaimer { text-align: center; font-size: 12px; margin: 10px 0 0; }

/* ── 카카오맵 ───────────────────────────────────────────────────────────── */
.km-layout { display: flex; gap: 14px; align-items: flex-start; }
#km-map { flex: 1; height: 600px; border: 1px solid var(--line); border-radius: var(--radius); }
.km-list { width: 300px; max-height: 600px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.km-item { padding: 10px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.km-item:hover { background: var(--panel); }
.km-item:last-child { border-bottom: none; }
.km-item-title { font-weight: 600; margin-bottom: 2px; }
.km-item-addr, .km-item-phone { font-size: 12px; }

.api-doc-link { font-size:12px; color:#6c8ebf; text-decoration:none; margin-left:8px; vertical-align:middle; } .api-doc-link:hover { text-decoration:underline; }


/* 사이드바 구분선 및 아이콘 */
.sidenav-sep {
  height: 1px;
  background: var(--line);
  margin: 8px 0;
}
.sidenav a {
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-icon {
  font-size: 15px;
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}
/* 사이드바 활성 상태 강화 */
.sidenav a.active {
  color: var(--txt);
  font-weight: 600;
  background: var(--panel2);
  border-left: 3px solid var(--accent);
  padding-left: 9px;
}
/* 모바일: 사이드바 수평 스크롤 */
@media (max-width: 720px) {
  .sidenav a { white-space: nowrap; }
}

/* ==== Sidebar text + mode toggle (2026-07-02) ==== */
.sidenav a {
  font-size: 15px;
  color: #334155;
}
.sidenav a.active {
  color: var(--txt);
  font-weight: 600;
  background: var(--panel2);
  border-left: 3px solid var(--accent);
  padding-left: 9px;
}
.sidenav a .nav-icon svg {
  width: 17px;
  height: 17px;
  opacity: 0.75;
}
.mode-toggle {
  display: flex;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}
.mode-btn {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--muted);
  transition: background 0.15s, color 0.15s;
}
.mode-btn.active {
  background: var(--accent);
  color: #fff;
}


/* ==== Icon vertical align fix ==== */
/* nav-icon sizing now defined in sidenav block above */

/* ==== Auth page wider ==== */
.auth-container { max-width: 520px !important; }

/* ==== Biz scale buttons ==== */
.biz-scale-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 18px; border-radius: 8px; font-size: 14px; font-weight: 500;
  border: 2px solid var(--line); background: transparent; cursor: pointer;
  color: var(--muted); transition: all 0.15s;
}
.biz-scale-btn.active {
  border-color: var(--accent); background: var(--accent); color: #fff;
}
#otp-section { display: none; }


/* ==== 사업자 인증 배지 (상단) ==== */
.mode-toggle { background: transparent; border: none; border-radius: 0; overflow: visible; }
.biz-badge {
  display: inline-flex; align-items: center; gap: 2px;
  background: var(--panel2); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 12px;
  font-size: 13px; font-weight: 700; color: var(--txt);
  max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.biz-badge-scale {
  font-size: 11px; font-weight: 600; color: var(--muted);
  background: var(--bg); border: 1px solid var(--line);
  border-radius: 999px; padding: 1px 8px; margin-left: 6px;
}
.biz-badge-unverified {
  color: #003d47; background: #00f0ff; border-color: #00d4e8;
  box-shadow: 0 0 8px rgba(0,240,255,0.6);
}

.biz-badge-list { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.biz-badge-btn {
  display: inline-flex; align-items: center; gap: 2px;
  background: var(--panel2); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 12px; cursor: pointer;
  font-size: 13px; font-weight: 700; color: var(--muted);
  max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: all .15s;
}
.biz-badge-btn:hover { border-color: var(--accent); color: var(--txt); }
.biz-badge-btn.active {
  color: var(--txt); background: var(--bg); border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
@media (max-width: 640px) {
  .biz-badge-btn { max-width: 100px; }
  .biz-badge-btn .biz-badge-scale { display: none; }
}


/* ==== 사이드바 아이콘 크기 강제 고정 (2026-07-04 버그수정) ==== */
.sidenav a[style*="display: none"], .sidenav a[style*="display:none"] { display: none !important; }
.sidenav a {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  line-height: 1.3;
  padding: 8px 12px;
  white-space: nowrap;
}
.sidenav a .nav-icon,
.sidenav a .nav-icon svg {
  width: 18px !important;
  height: 18px !important;
  flex-shrink: 0;
}
.sidenav a .nav-icon {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
}


/* ==== 모바일 상단바 가로 넘침 방지 (2026-07-04) ==== */
@media (max-width: 640px) {
  .topbar { padding: 0 12px; gap: 8px; }
  .topbar-right { gap: 8px; min-width: 0; }
  .topsearch { display: none; }
  .biz-badge { max-width: 120px; }
  .biz-badge-scale { display: none; }
  #auth-area > span { display: none; }
}
