.app {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  border-right: 1px solid var(--sidebar-line);
  padding: 12px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}

.brand h1 {
  font-size: 18px;
  color: var(--sidebar-text);
}

.brand p {
  margin-top: 4px;
  color: var(--sidebar-muted);
  font-size: 12px;
}

.menu-group {
  display: grid;
  gap: 4px;
}

.menu-btn {
  width: 100%;
  border: 1px solid var(--sidebar-line);
  background: transparent;
  color: var(--sidebar-text);
  border-radius: 8px;
  padding: 8px;
  text-align: left;
  display: flex;
  gap: 8px;
  align-items: center;
  cursor: pointer;
  font-size: 13px;
}

.menu-btn.active {
  border-color: var(--brand);
  color: #fff;
  background: var(--sidebar-active);
}

/* 입력 페이지 등 본문에서 쓰는 탭 — 브랜드 컬러(빨강 + 흰색) */
.tab.active {
  border-color: var(--brand);
  color: #fff;
  background: var(--brand);
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(220, 38, 38, .25);
}

.content {
  padding: 20px;
  overflow: auto;
  background: var(--bg-page);
}

.input-wrap {
  max-width: 780px;
  margin: 32px auto;
  display: grid;
  gap: 12px;
}

.integration-grid {
  align-items: stretch;
}

.integration-card-hd {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.integration-card h4 {
  margin: 0;
  font-size: 15px;
}

.integration-status {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--soft-bg);
  color: var(--muted);
}

.integration-status.on {
  background: rgba(22, 163, 74, .1);
  color: var(--ok);
}

.integration-hint {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.integration-label {
  margin-top: 8px;
}

.integration-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.integration-btn {
  flex: 1;
  min-width: 140px;
}

.integration-err {
  color: var(--bad);
  font-size: 12px;
  margin-top: 8px;
}

.integration-warn {
  font-size: 11px;
  color: var(--muted);
  margin-top: 8px;
  line-height: 1.5;
}

.integration-warn code {
  font-size: 10px;
  background: var(--soft-bg);
  padding: 1px 4px;
  border-radius: 4px;
}

.integration-banner {
  margin-top: 8px;
}

.integration-banner p {
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
}

.integration-banner-dash p {
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
}

.delta-pill {
  font-size: 11px;
  font-weight: 800;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  display: grid;
  gap: 8px;
}

.card-clickable {
  cursor: pointer;
  transition: border-color .2s;
}

.card-clickable:hover {
  border-color: var(--brand);
}

.card.soft {
  background: var(--soft-bg);
}

.card.success {
  border-color: rgba(22, 163, 74, .3);
}

.card.danger {
  border-color: rgba(220, 38, 38, .3);
}

.row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.row.between {
  justify-content: space-between;
}

.row.wrap {
  flex-wrap: wrap;
}

.row.gap-sm {
  gap: 4px;
}

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

label {
  color: var(--muted);
  font-size: 12px;
}

input {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  padding: 10px;
}

.primary {
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, #dc2626, #ef4444);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .2s;
}

.primary:hover {
  opacity: .9;
}

.tab,
.link-btn,
.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  padding: 6px 10px;
  cursor: pointer;
  font-size: 13px;
  transition: border-color .2s;
}

.tab:hover,
.link-btn:hover,
.chip:hover {
  border-color: var(--brand);
}

.link-btn {
  border-radius: 8px;
}

.score {
  font-weight: 800;
}

.score-box {
  font-size: 24px;
  font-weight: 900;
}

.bar {
  width: 100%;
  height: 6px;
  background: var(--bar-bg);
  border-radius: 999px;
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
}

.section-hd {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.item-row {
  display: grid;
  grid-template-columns: 1fr 42px;
  gap: 8px;
  padding: 8px 0;
  border-top: 1px solid var(--divider);
}

.item-row p {
  font-size: 13px;
  color: var(--muted);
}

.score-col {
  text-align: right;
}

.pill {
  border: 1px solid;
  border-radius: 999px;
  padding: 0 6px;
  font-size: 11px;
}

.tag {
  display: inline-block;
  margin-right: 6px;
  color: var(--warn);
  font-weight: 600;
}

/* === Sidebar footer & membership badge === */
.sidebar-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--sidebar-line);
  display: grid;
  gap: 6px;
}

.membership-badge {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: .5px;
}

.badge-free {
  background: rgba(156, 163, 175, .2);
  color: #9ca3af;
}

.badge-pro {
  background: linear-gradient(135deg, rgba(220, 38, 38, .25), rgba(249, 115, 22, .25));
  color: #f97316;
}

.beta-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .12em;
  padding: 2px 6px;
  border-radius: 4px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  vertical-align: middle;
  box-shadow: 0 1px 4px rgba(99,102,241,.35);
}

.sidebar-contact {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--sidebar-line);
  font-size: 11px;
}
.sidebar-contact .contact-link {
  color: var(--sidebar-muted);
  text-decoration: none;
  transition: color .15s;
}
.sidebar-contact .contact-link:hover { color: #8b5cf6; }
.sidebar-contact .contact-sep { color: var(--sidebar-muted); opacity: .5; }

/* 진단 방식 선택 카드 */
.diag-mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 20px;
}
@media (max-width: 640px) {
  .diag-mode-grid { grid-template-columns: 1fr; }
}
.diag-mode-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 20px 18px;
  border: 2px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  text-decoration: none;
  color: var(--text);
  transition: transform .15s, border-color .15s, box-shadow .15s;
  position: relative;
  overflow: hidden;
}
.diag-mode-card:hover {
  transform: translateY(-2px);
  border-color: var(--brand);
  box-shadow: 0 6px 18px rgba(220,38,38,.12);
}
.diag-mode-card.active {
  border-color: var(--brand);
  background: linear-gradient(135deg, rgba(220,38,38,.06), rgba(249,115,22,.06));
  box-shadow: 0 4px 14px rgba(220,38,38,.15);
}
.diag-mode-card.active::before {
  content: "✓ 선택됨";
  position: absolute;
  top: 10px; right: 12px;
  font-size: 11px;
  font-weight: 800;
  color: var(--brand);
  background: rgba(220,38,38,.12);
  padding: 3px 8px;
  border-radius: 999px;
}
.diag-mode-icon { font-size: 28px; line-height: 1; }
.diag-mode-title {
  font-size: 17px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.diag-mode-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: .08em;
}
.tag-beta { background: linear-gradient(135deg,#6366f1,#8b5cf6); color:#fff; }
.tag-stable { background: rgba(34,197,94,.18); color: #16a34a; }
.diag-mode-desc { font-size: 13px; line-height: 1.5; color: var(--muted); }
.diag-mode-meta { font-size: 11.5px; color: var(--muted); margin-top: 4px; opacity: .85; }
.diag-mode-card.manual:hover .diag-mode-meta { color: var(--brand); }

/* 입력 페이지 — 메인 CTA */
.primary-cta {
  width: 100%;
  margin-top: 18px;
  padding: 16px 24px;
  font-size: 17px;
  font-weight: 800;
  border-radius: 12px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6, #ec4899);
  color: #fff;
  border: none;
  cursor: pointer;
  letter-spacing: -0.01em;
  box-shadow: 0 6px 20px rgba(139, 92, 246, .35);
  transition: transform .15s, box-shadow .15s;
}
.primary-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(139, 92, 246, .45);
}
.primary-cta:active { transform: translateY(0); }

/* 고급 영역 토글 */
.advanced-toggle-wrap {
  margin-top: 24px;
  border-top: 1px dashed var(--border);
  padding-top: 16px;
}
.advanced-toggle {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  transition: background .15s, border-color .15s;
}
.advanced-toggle:hover { background: rgba(99,102,241,.04); border-color: #8b5cf6; }
.advanced-toggle.open { background: rgba(99,102,241,.05); border-color: #8b5cf6; }
.advanced-toggle-icon {
  font-size: 14px;
  color: #8b5cf6;
  margin-top: 2px;
  flex-shrink: 0;
}
.advanced-toggle-text { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.advanced-toggle-text strong { font-size: 14px; font-weight: 700; color: var(--text); }
.advanced-toggle-text small { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.optional-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(139,92,246,.15);
  color: #8b5cf6;
  letter-spacing: .04em;
}
.advanced-panel {
  margin-top: 14px;
  animation: advancedFadeIn .25s ease-out;
}
@keyframes advancedFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.paid-toggle-btn {
  width: 100%;
  padding: 10px;
  border: 1px dashed var(--sidebar-line);
  border-radius: 8px;
  background: transparent;
  color: var(--sidebar-muted);
  cursor: pointer;
  font-size: 13px;
  transition: all .2s;
}

.paid-toggle-btn:hover {
  border-color: var(--brand);
  color: var(--sidebar-text);
}

.paid-toggle-btn.is-pro {
  border-style: solid;
  border-color: rgba(249, 115, 22, .4);
  color: #f97316;
  background: rgba(249, 115, 22, .08);
}

/* === Theme toggle === */
.theme-toggle-btn {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--sidebar-line);
  border-radius: 8px;
  background: transparent;
  color: var(--sidebar-muted);
  cursor: pointer;
  font-size: 12px;
  transition: all .2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.theme-toggle-btn:hover {
  border-color: var(--brand);
  color: var(--sidebar-text);
}

/* === Analysis panel === */
.analysis-panel {
  gap: 14px;
}

.analysis-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.analysis-stat {
  text-align: center;
  padding: 10px 4px;
  background: var(--soft-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.analysis-stat-num {
  font-size: 24px;
  font-weight: 900;
  display: block;
}

.analysis-stat small {
  color: var(--muted);
  font-size: 11px;
}

.analysis-insights {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.analysis-insight {
  padding: 10px 12px;
  border-radius: 8px;
}

.analysis-insight strong {
  font-size: 12px;
  display: block;
  margin-bottom: 4px;
}

.analysis-insight p {
  font-size: 13px;
}

.analysis-insight.danger {
  background: rgba(220, 38, 38, .06);
  border: 1px solid rgba(220, 38, 38, .15);
}

.analysis-insight.danger strong {
  color: var(--bad);
}

.analysis-insight.success {
  background: rgba(22, 163, 74, .06);
  border: 1px solid rgba(22, 163, 74, .15);
}

.analysis-insight.success strong {
  color: var(--ok);
}

.analysis-priority {
  display: grid;
  gap: 6px;
}

.analysis-priority > strong {
  font-size: 13px;
  color: var(--muted);
}

.analysis-priority-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--soft-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.analysis-rank {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(220, 38, 38, .1);
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  flex-shrink: 0;
}

/* === PRO detail button === */
.pro-detail-section {
  margin: 4px 0;
}

.pro-detail-btn {
  width: 100%;
  padding: 0;
  border: 1px dashed rgba(220, 38, 38, .3);
  border-radius: 12px;
  background: var(--brand-light);
  color: var(--text);
  cursor: pointer;
  transition: all .2s;
}

.pro-detail-btn:hover {
  border-color: rgba(220, 38, 38, .5);
  background: rgba(220, 38, 38, .08);
}

.pro-detail-btn-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
}

.pro-detail-btn-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pro-detail-icon {
  font-size: 24px;
}

.pro-detail-btn-left strong {
  display: block;
  font-size: 14px;
}

.pro-detail-btn-left p {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.pro-badge {
  background: linear-gradient(135deg, #dc2626, #ef4444);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: .5px;
}

.pro-detail-divider {
  text-align: center;
  position: relative;
  padding: 8px 0;
}

.pro-detail-divider::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--brand), transparent);
  opacity: .3;
}

.pro-detail-divider span {
  position: relative;
  background: var(--bg);
  padding: 0 16px;
  font-size: 13px;
  color: var(--brand);
  font-weight: 600;
}

/* === Pricing page === */
.pricing-wrap {
  max-width: 960px;
  margin: 0 auto;
  display: grid;
  gap: 24px;
}

.pricing-header {
  text-align: center;
  padding: 24px 0;
}

.pricing-header p {
  color: var(--muted);
  margin-top: 6px;
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  align-items: start;
}

.pricing-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px 20px;
  display: grid;
  gap: 20px;
  position: relative;
}

.pricing-card.pro {
  border-color: rgba(220, 38, 38, .35);
  box-shadow: 0 4px 24px rgba(220, 38, 38, .08);
}

.pricing-popular {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #dc2626, #ef4444);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 4px 14px;
  border-radius: 999px;
  letter-spacing: 1px;
}

.pricing-card-hd h3 {
  font-size: 18px;
  margin-bottom: 4px;
}

.pricing-price {
  font-size: 32px;
  font-weight: 900;
}

.pricing-price small {
  font-size: 14px;
  color: var(--muted);
  font-weight: 400;
}

.pricing-features {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}

.pricing-features li {
  font-size: 13px;
  line-height: 1.5;
}

.pricing-features li.disabled {
  color: var(--muted);
  opacity: .5;
}

.pricing-features li.highlight {
  color: var(--brand);
}

.pricing-btn {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
}

.pricing-btn:hover {
  border-color: var(--brand);
}

.pricing-btn:disabled {
  opacity: .5;
  cursor: default;
}

.pricing-btn.pro-btn {
  background: linear-gradient(135deg, #dc2626, #ef4444);
  color: #fff;
  border: 0;
}

.pricing-btn.pro-btn:hover {
  opacity: .9;
}

.pricing-btn.enterprise {
  border-color: var(--line);
}

.pricing-faq {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  display: grid;
  gap: 16px;
}

.pricing-faq h4 {
  font-size: 16px;
}

.pricing-faq-item {
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.pricing-faq-item strong {
  font-size: 14px;
  display: block;
  margin-bottom: 6px;
}

.pricing-faq-item p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

/* === Report page — 카드·히어로·TOC 레이아웃은 layout.css === */

.report-summary {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.report-groups {
  display: grid;
  gap: 6px;
}

.report-group-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.report-group-name {
  min-width: 160px;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.report-tag {
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 6px;
  line-height: 1.4;
}

.report-tag.success {
  background: rgba(22, 163, 74, .08);
  color: var(--ok);
}

.report-tag.danger {
  background: rgba(220, 38, 38, .08);
  color: var(--bad);
}

.report-actions {
  display: grid;
  gap: 4px;
}

.report-action {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

/* === Chapter hero with donut === */
.chapter-hero-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.chapter-hero-text {
  flex: 1;
  display: grid;
  gap: 6px;
}

.chapter-hero-text h2 {
  font-size: 20px;
}

.chapter-hero-text p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

/* === Score badge (compact triad: gauge arc + number + pill) === */
.score-badge {
  display: grid;
  grid-template-rows: auto auto;
  align-items: end;
  justify-items: center;
  gap: 6px;
  position: relative;
  min-width: 120px;
  padding: 6px 4px 0;
}

.score-badge-gauge {
  display: block;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.05));
}

.score-badge-text {
  position: absolute;
  top: 20px;
  left: 0;
  right: 0;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 2px;
  pointer-events: none;
}

.score-badge-num {
  font-size: 30px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.score-badge-unit {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  opacity: 0.7;
}

.score-badge-pill {
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid;
  letter-spacing: 0.02em;
  line-height: 1.4;
  white-space: nowrap;
}

/* === Score donut === */
.donut-wrap {
  position: relative;
  flex-shrink: 0;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.06));
}

.donut-svg {
  display: block;
}

.donut-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.donut-score {
  font-size: 38px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.donut-status {
  font-size: 10.5px;
  font-weight: 700;
  margin-top: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid;
  letter-spacing: 0.02em;
  line-height: 1.4;
}

/* === Group bars === */
.group-bars {
  display: grid;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
}

.group-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.group-bar-label {
  min-width: 150px;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.group-bar-track {
  flex: 1;
  height: 8px;
  background: var(--bar-bg);
  border-radius: 999px;
  overflow: hidden;
}

.group-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width .4s ease;
}

.group-bar-score {
  font-weight: 800;
  font-size: 14px;
  min-width: 28px;
  text-align: right;
}

.group-bar-status {
  font-size: 10px;
  min-width: 32px;
  text-align: center;
}

/* === Radar chart === */
.radar-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  background:
    radial-gradient(ellipse at top, rgba(168, 85, 247, 0.04), transparent 60%),
    linear-gradient(180deg, var(--panel), var(--panel));
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.radar-svg {
  width: 100%;
  max-width: 360px;
  height: auto;
  overflow: visible;
}

/* === Gauge chart === */
.gauge-panel {
  gap: 12px;
}

.gauge-grid {
  display: flex;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
}

.gauge-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.gauge-label {
  position: absolute;
  bottom: 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.gauge-score {
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
}

.gauge-status {
  font-size: 11px;
  color: var(--muted);
}

.gauge-title {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
  margin-top: 4px;
}

/* === Channel bars === */
.channel-bars-card {
  gap: 12px;
}

.channel-bars {
  display: grid;
  gap: 12px;
}

.channel-bar-item {
  display: grid;
  gap: 4px;
}

.channel-bar-hd {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.channel-bar-name {
  font-size: 13px;
  font-weight: 600;
}

.channel-bar-score {
  font-weight: 800;
  font-size: 14px;
}

.channel-bar-track {
  height: 24px;
  background: var(--bar-bg);
  border-radius: 6px;
  overflow: hidden;
}

.channel-bar-fill {
  height: 100%;
  border-radius: 6px;
  display: flex;
  align-items: center;
  padding: 0 8px;
  min-width: fit-content;
  transition: width .4s ease;
}

.channel-bar-pct {
  font-size: 10px;
  color: #fff;
  font-weight: 700;
}

.channel-bar-meta {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: var(--muted);
}

.channel-legend {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  padding-top: 8px;
  border-top: 1px solid var(--divider);
}

.channel-legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--muted);
}

.channel-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

/* === Checklist === */
.checklist-panel {
  gap: 12px;
}

.checklist-progress {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checklist-progress-bar {
  flex: 1;
  height: 10px;
  background: var(--bar-bg);
  border-radius: 999px;
  overflow: hidden;
}

.checklist-progress-fill {
  height: 100%;
  border-radius: 999px;
  transition: width .4s ease;
}

.checklist-pct {
  font-weight: 800;
  font-size: 14px;
  min-width: 64px;
}

.checklist-count {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.checklist-items {
  display: grid;
  gap: 2px;
  max-height: 320px;
  overflow-y: auto;
}

.checklist-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 13px;
}

.checklist-row.done {
  background: rgba(22, 163, 74, .05);
}

.checklist-row.partial {
  background: rgba(217, 119, 6, .05);
}

.checklist-row.missing {
  background: rgba(220, 38, 38, .05);
}

.checklist-icon {
  font-size: 14px;
  flex-shrink: 0;
}

.checklist-name {
  flex: 1;
}

.checklist-score {
  font-weight: 800;
  font-size: 13px;
  min-width: 24px;
  text-align: right;
}

/* === Report infographic elements === */
.report-infographic {
  padding: 8px 0;
}

.report-infographic .radar-wrap {
  padding: 12px;
  border: 0;
  background: transparent;
}

.report-infographic .radar-svg {
  max-width: 280px;
}

/* Report channel mini bars */
.report-channel-mini {
  display: grid;
  gap: 6px;
}

.report-ch-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.report-ch-bar-name {
  min-width: 100px;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.report-ch-bar-track {
  flex: 1;
  height: 6px;
  background: var(--bar-bg);
  border-radius: 999px;
  overflow: hidden;
}

.report-ch-bar-fill {
  height: 100%;
  border-radius: 999px;
}

/* Report gauge mini */
.report-gauge-mini {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.report-mini-gauge {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.report-mini-gauge-score {
  font-size: 18px;
  font-weight: 900;
  margin-top: -18px;
}

.report-mini-gauge-label {
  font-size: 10px;
  color: var(--muted);
  margin-top: 2px;
  text-align: center;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Report checklist mini */
.report-checklist-mini {
  display: grid;
  gap: 8px;
}

.report-ck-progress {
  display: flex;
  align-items: center;
  gap: 8px;
}

.report-ck-bar {
  flex: 1;
  height: 8px;
  background: var(--bar-bg);
  border-radius: 999px;
  overflow: hidden;
}

.report-ck-fill {
  height: 100%;
  border-radius: 999px;
}

.report-ck-stats {
  display: flex;
  gap: 12px;
}

.report-ck-stat {
  font-size: 12px;
  font-weight: 600;
}

.report-ck-items {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.report-ck-item {
  font-size: 12px;
  color: var(--muted);
  padding: 3px 6px;
  background: rgba(220, 38, 38, .04);
  border-radius: 4px;
}

.report-ck-item strong {
  float: right;
}

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

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--sidebar-line);
  }

  .grid.two {
    grid-template-columns: 1fr;
  }

  .chapter-hero-inner {
    flex-direction: column;
    text-align: center;
  }

  .group-bar-label {
    min-width: 100px;
    font-size: 11px;
  }

  .report-overview-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .report-swot {
    grid-template-columns: 1fr;
  }

  .report-group-name {
    min-width: 120px;
  }

  .analysis-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .analysis-insights {
    grid-template-columns: 1fr;
  }

  .pricing-grid {
    grid-template-columns: 1fr;
  }

  .gauge-grid {
    gap: 16px;
  }

  .channel-legend {
    gap: 8px;
  }

  .report-gauge-mini {
    gap: 10px;
  }

  .report-ch-bar-name {
    min-width: 70px;
    font-size: 11px;
  }
}

/* ======================= 마케팅 실행 플랜 ======================= */
.plan-wrap { display: flex; flex-direction: column; gap: 20px; }

.plan-hero { background: linear-gradient(135deg, rgba(139,92,246,.08), rgba(236,72,153,.08)); }
.plan-hero-inner { display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center; }
.plan-hero-kicker { font-size: 13px; font-weight: 700; color: var(--brand); margin: 0 0 8px; }
.plan-hero-stats { display: flex; gap: 16px; }
.plan-hero-stat { display: flex; flex-direction: column; align-items: center; padding: 12px 20px; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-sm); min-width: 88px; }
.plan-hero-stat-num { font-size: 32px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; }
.plan-hero-stat-lb { font-size: 11px; color: var(--muted); margin-top: 4px; }

.plan-weakest-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 12px; }
.plan-weakest-card {
  display: flex; flex-direction: column; gap: 6px; padding: 16px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--surface); cursor: pointer; text-align: left;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.plan-weakest-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--brand); }
.plan-weakest-ic { font-size: 24px; }
.plan-weakest-lb { font-size: 13px; font-weight: 700; color: var(--text); }
.plan-weakest-score { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }

.plan-roadmap { display: flex; flex-direction: column; gap: 16px; }
.plan-phase {
  border: 2px solid; border-radius: 18px; padding: 20px;
  box-shadow: var(--shadow-sm);
}
.plan-phase-hd { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }
.plan-phase-title { display: flex; align-items: center; gap: 12px; }
.plan-phase-ic {
  width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
}
.plan-phase-title h3 { margin: 0; font-size: 18px; font-weight: 800; }
.plan-phase-sub { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.plan-phase-meta { display: flex; gap: 8px; align-items: center; }
.plan-phase-count { font-size: 13px; font-weight: 800; }
.plan-phase-effort {
  font-size: 11px; padding: 4px 10px; border-radius: 999px;
  background: var(--surface); color: var(--muted); border: 1px solid var(--line);
}
.plan-phase-list { display: flex; flex-direction: column; gap: 10px; }
.plan-phase-empty { color: var(--muted); font-size: 13px; margin: 0; padding: 12px; text-align: center; }

.plan-action {
  padding: 14px 16px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line);
  cursor: pointer; transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.plan-action:hover { transform: translateX(2px); box-shadow: var(--shadow-sm); border-color: var(--brand); }
.plan-action-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.plan-action-ch { display: flex; align-items: center; gap: 6px; }
.plan-action-ic { font-size: 16px; }
.plan-action-lb { font-size: 12px; font-weight: 700; color: var(--text-secondary); }
.plan-action-score {
  font-size: 11px; padding: 3px 10px; border-radius: 999px;
  border: 1px solid; font-weight: 700; font-variant-numeric: tabular-nums;
}
.plan-action-text { margin: 0; font-size: 14px; line-height: 1.55; color: var(--text); }

.plan-cta { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.plan-cta-text h3 { margin: 0 0 4px; font-size: 16px; }
.plan-cta .primary { flex-shrink: 0; }

/* --- Plan PRO banner --- */
.plan-pro-banner {
  display: flex; align-items: center; gap: 14px; padding: 14px 18px;
  background: linear-gradient(135deg, rgba(139,92,246,.1), rgba(236,72,153,.1));
  border: 1px solid rgba(139,92,246,.25); border-radius: 14px;
}
.plan-pro-ic { font-size: 28px; }
.plan-pro-text { flex: 1; }
.plan-pro-text strong { display: block; font-size: 14px; margin-bottom: 2px; }
.plan-pro-text p { margin: 0; font-size: 12px; color: var(--muted); }

/* --- Plan action card (expandable) --- */
.plan-action { cursor: default; }
.plan-action-head { cursor: pointer; }
.plan-action-text { cursor: pointer; }
.plan-action-meta { display: flex; align-items: center; gap: 8px; }
.plan-action-lock { font-size: 14px; }
.plan-action-chevron {
  font-size: 14px; color: var(--muted); transition: transform .2s ease;
  display: inline-block; min-width: 14px; text-align: center;
}
.plan-action.is-open { border-color: var(--brand); box-shadow: var(--shadow-md); }
.plan-action.is-open .plan-action-chevron { color: var(--brand); }

/* --- Plan detail (expanded) --- */
.plan-action-detail { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); position: relative; }
.plan-detail { display: flex; flex-direction: column; gap: 16px; }
.plan-detail-block { }
.plan-detail-hd {
  margin: 0 0 8px; font-size: 13px; font-weight: 800; color: var(--text);
  letter-spacing: .01em;
}
.plan-detail-text { margin: 0; font-size: 13px; line-height: 1.6; color: var(--text-secondary); }
.plan-detail-steps {
  margin: 0; padding-left: 20px; font-size: 13px; line-height: 1.8; color: var(--text-secondary);
}
.plan-detail-steps li { padding-left: 4px; }
.plan-detail-steps li::marker { color: var(--brand); font-weight: 800; }
.plan-detail-list {
  margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.7; color: var(--text-secondary);
}
.plan-detail-list li { padding-left: 2px; }
.plan-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.plan-detail-meta {
  display: grid; grid-template-columns: auto 1fr; gap: 4px 12px;
  margin: 0; font-size: 13px;
}
.plan-detail-meta dt {
  color: var(--muted); font-weight: 600;
}
.plan-detail-meta dd {
  margin: 0; color: var(--text-secondary);
}
.plan-detail-tools { display: flex; flex-wrap: wrap; gap: 6px; }
.plan-tool-chip {
  font-size: 12px; padding: 4px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
  border: 1px solid rgba(37,99,235,.2);
}

/* --- Locked detail (non-paid) --- */
.plan-detail-locked { position: relative; min-height: 180px; }
.plan-locked-preview { filter: blur(6px); opacity: .5; pointer-events: none; user-select: none; }
.plan-locked-overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, rgba(255,255,255,.5), rgba(255,255,255,.85));
  z-index: 2; border-radius: 10px;
}
[data-theme="dark"] .plan-locked-overlay {
  background: linear-gradient(180deg, rgba(20,24,36,.55), rgba(20,24,36,.9));
}
.plan-locked-content {
  text-align: center; padding: 20px; max-width: 360px;
}
.plan-locked-ic { font-size: 32px; display: block; margin-bottom: 8px; }
.plan-locked-content h4 { margin: 0 0 6px; font-size: 15px; }
.plan-locked-content p { margin: 0 0 12px; font-size: 12px; color: var(--muted); line-height: 1.5; }

/* --- Plan download section --- */
.plan-download {
  display: flex; flex-direction: column; gap: 14px;
  background: linear-gradient(135deg, rgba(13,148,136,.06), rgba(139,92,246,.06));
  border: 1px solid rgba(13,148,136,.2);
}
.plan-download.is-locked {
  background: linear-gradient(135deg, rgba(100,116,139,.05), rgba(139,92,246,.06));
  border-color: var(--line);
}
.plan-download-head { display: flex; align-items: center; gap: 14px; }
.plan-download-ic { font-size: 32px; }
.plan-download-head h3 { margin: 0 0 4px; font-size: 16px; }
.plan-download-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.plan-download-actions button.is-disabled {
  opacity: .55; cursor: not-allowed; background: var(--panel); color: var(--muted); border: 1px solid var(--line);
}
.plan-download-actions button.secondary {
  background: var(--surface); color: var(--text); border: 1px solid var(--line);
  padding: 10px 18px; border-radius: 10px; font-weight: 700; cursor: pointer;
  transition: background .15s ease;
}
.plan-download-actions button.secondary:hover:not(.is-disabled) { background: var(--panel-hover); border-color: var(--brand); }

/* --- Print cover (화면에서는 숨김, 인쇄·HTML export에서만 보임) --- */
.plan-print-cover { display: none; }

@media (max-width: 760px) {
  .plan-hero-inner { grid-template-columns: 1fr; }
  .plan-weakest-grid { grid-template-columns: 1fr; }
  .plan-phase { padding: 16px; }
  .plan-detail-grid { grid-template-columns: 1fr; }
  .plan-pro-banner { flex-direction: column; text-align: center; }
  .plan-download-actions { flex-direction: column; }
  .plan-download-actions button { width: 100%; }
}

/* ======================= 인쇄(PDF 저장) 스타일 ======================= */
@media print {
  @page { size: A4; margin: 16mm 14mm; }

  body { background: #fff !important; }

  /* 숨길 UI */
  .sidebar,
  .plan-cta,
  .plan-download,
  .plan-pro-banner,
  .plan-action-chevron,
  .plan-action-lock,
  .theme-toggle-btn,
  .paid-toggle-btn { display: none !important; }

  .app { display: block !important; }
  .content { padding: 0 !important; }
  .plan-wrap { max-width: 100% !important; gap: 12px !important; }

  /* 카드는 페이지 넘어가도 분리되지 않게 */
  .plan-phase, .plan-action, .plan-weakest, .plan-hero { page-break-inside: avoid; break-inside: avoid; }
  .plan-action-detail[hidden] { display: block !important; }
  .plan-action-detail { border-top: 1px dashed #ddd; }

  .plan-action { cursor: default !important; box-shadow: none !important; border: 1px solid #ddd !important; }
  .plan-phase { box-shadow: none !important; }
  .card { box-shadow: none !important; border: 1px solid #e0e0e0 !important; }

  /* 표지 페이지 */
  .plan-print-cover {
    display: flex !important; align-items: center; justify-content: center;
    min-height: 90vh; page-break-after: always; break-after: page;
    text-align: center;
  }
  .plan-print-cover-inner { max-width: 600px; }
  .plan-print-kicker { font-size: 14px; color: #888; letter-spacing: .2em; margin: 0 0 24px; text-transform: uppercase; }
  .plan-print-cover h1 { font-size: 48px; font-weight: 800; margin: 0 0 16px; color: #111; }
  .plan-print-sub { font-size: 16px; color: #444; margin: 0 0 48px; }
  .plan-print-sub strong { color: #dc2626; }
  .plan-print-date { font-size: 13px; color: #888; margin: 0; }

  /* 히어로는 표지 다음 첫 페이지에 */
  .plan-hero { page-break-before: auto; }

  /* 링크 색상 표시 안 함 */
  a { color: inherit; text-decoration: none; }
}

/* 다운로드 실행 중일 때 화면에서도 전체 펼침 유지 (window.print 전 상태 보장) */
body.is-printing-plan .plan-action-detail[hidden] { display: block !important; }

/* ======================= GA4 통계 분석 페이지 ======================= */
.ga4-wrap { display: flex; flex-direction: column; gap: 20px; }

.ga4-hero { background: linear-gradient(135deg, rgba(37,99,235,.08), rgba(13,148,136,.06)); }
.ga4-hero-kicker { font-size: 13px; font-weight: 700; color: var(--accent); margin: 0 0 8px; }

/* 연동 카드 */
.ga4-connect-head { display: flex; align-items: center; gap: 14px; }
.ga4-connect-ic {
  width: 52px; height: 52px; border-radius: 14px; display: flex; align-items: center; justify-content: center;
  font-size: 26px; color: #fff; flex-shrink: 0;
}
.ga4-connect-text { flex: 1; }
.ga4-connect-text h3 { margin: 0 0 4px; font-size: 16px; }
.ga4-connect-form { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); }
.ga4-connect-form input {
  width: 100%; max-width: 320px; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--input-bg); color: var(--text); font-size: 14px;
}
.ga4-connect-connected { border-left: 4px solid var(--ok); }

/* KPI 카드 그리드 */
.ga4-kpi-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px;
}
.ga4-kpi-card {
  padding: 16px; border-radius: 14px; background: var(--surface);
  border: 1px solid var(--line); box-shadow: var(--shadow-xs);
}
.ga4-kpi-top { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.ga4-kpi-ic { font-size: 18px; }
.ga4-kpi-lb { font-size: 12px; color: var(--muted); font-weight: 600; }
.ga4-kpi-value { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; margin-bottom: 4px; }
.ga4-kpi-delta { font-size: 12px; color: var(--muted); }
.ga4-kpi-delta span { color: var(--muted); margin-left: 4px; font-size: 11px; }
.ga4-delta { font-weight: 700; }

/* 채널 분석 */
.ga4-channel-list { display: flex; flex-direction: column; gap: 14px; }
.ga4-channel-row {
  padding: 12px 14px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line);
}
.ga4-channel-hd { display: flex; justify-content: space-between; margin-bottom: 6px; }
.ga4-channel-name { font-weight: 700; font-size: 14px; }
.ga4-channel-pct { font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }
.ga4-channel-bar {
  height: 10px; background: var(--bar-bg); border-radius: 999px; overflow: hidden; margin-bottom: 8px;
}
.ga4-channel-fill { height: 100%; border-radius: 999px; }
.ga4-channel-meta {
  display: flex; gap: 14px; font-size: 12px; color: var(--muted); flex-wrap: wrap;
}
.ga4-channel-meta strong { color: var(--text); }

/* 페이지 테이블 */
.ga4-pages-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.ga4-pages-sub { font-size: 13px; font-weight: 800; margin: 0 0 10px; }
.ga4-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ga4-table th {
  text-align: left; padding: 8px 10px; background: var(--panel); color: var(--muted);
  font-size: 11px; font-weight: 700;
}
.ga4-table td {
  padding: 8px 10px; border-bottom: 1px solid var(--line-light);
  font-variant-numeric: tabular-nums;
}
.ga4-table tr:last-child td { border-bottom: none; }
.ga4-path { color: var(--text); font-family: ui-monospace, monospace; font-size: 12px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 진단 해석 */
.ga4-diag-list { display: flex; flex-direction: column; gap: 10px; }
.ga4-diag-item {
  padding: 14px 16px; border-radius: 10px; background: var(--panel);
  border-left: 4px solid;
}
.ga4-diag-hd { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.ga4-diag-level {
  font-size: 11px; padding: 3px 10px; border-radius: 999px; color: #fff; font-weight: 700;
}
.ga4-diag-text { margin: 0 0 8px; font-size: 13px; line-height: 1.6; color: var(--text-secondary); }
.link-btn {
  background: none; border: none; color: var(--accent); font-weight: 700; font-size: 13px;
  cursor: pointer; padding: 0; text-decoration: underline;
}
.link-btn:hover { color: var(--brand); }

.ga4-diag-locked-box {
  text-align: center; padding: 40px 20px;
  background: linear-gradient(135deg, rgba(139,92,246,.06), rgba(236,72,153,.06));
  border-radius: 12px;
}
.ga4-diag-locked-box h4 { margin: 8px 0 6px; font-size: 15px; }
.ga4-diag-locked-box p { color: var(--muted); font-size: 13px; margin: 0 0 14px; }

.ga4-pro-chip {
  font-size: 10px; padding: 3px 8px; border-radius: 999px;
  background: linear-gradient(135deg, #8b5cf6, #ec4899); color: #fff; font-weight: 700;
  margin-left: 6px; vertical-align: middle;
}

.ga4-empty { text-align: center; padding: 40px; color: var(--muted); }

@media (max-width: 760px) {
  .ga4-pages-grid { grid-template-columns: 1fr; }
  .ga4-connect-head { flex-wrap: wrap; }
}

/* GA4 확장: 3열 페이지 그리드 · 지역 · 인구통계 · 이벤트 · 소스/매체 */
.ga4-pages-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 18px;
  margin-top: 14px;
}
.ga4-pages-sub {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

/* 지역 */
.ga4-geo-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 14px;
}
.ga4-geo-list { display: flex; flex-direction: column; gap: 10px; }

/* 인구통계 */
.ga4-demo-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 14px;
}
.ga4-demo-bars { display: flex; flex-direction: column; gap: 8px; }
.ga4-demo-bar {
  display: grid;
  grid-template-columns: 80px 1fr 130px;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}
.ga4-demo-lb { font-weight: 700; color: var(--text); }
.ga4-demo-track {
  height: 10px; background: var(--bg-muted, #f3f4f6);
  border-radius: 999px; overflow: hidden;
}
.ga4-demo-fill { height: 100%; border-radius: 999px; transition: width .3s; }
.ga4-demo-val { font-size: 12px; color: var(--muted); text-align: right; }
.ga4-demo-hint {
  margin-top: 14px; padding: 10px 12px;
  background: rgba(139,92,246,.08); border-left: 3px solid #8b5cf6;
  border-radius: 6px; font-size: 12px; color: var(--text); line-height: 1.6;
}

/* 이벤트 */
.ga4-events-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.ga4-event-row {
  display: grid;
  grid-template-columns: 180px 1fr 140px;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--card-bg, transparent);
  transition: background .15s;
}
.ga4-event-row:hover { background: rgba(139,92,246,.04); }
.ga4-event-row.is-conversion {
  background: rgba(13,148,136,.08);
  border-left: 3px solid var(--ok);
}
.ga4-event-name { font-size: 13px; font-weight: 600; color: var(--text); }
.ga4-event-bar {
  height: 10px; background: var(--bg-muted, #f3f4f6);
  border-radius: 999px; overflow: hidden;
}
.ga4-event-fill { height: 100%; border-radius: 999px; transition: width .3s; }
.ga4-event-count { font-size: 13px; font-weight: 700; color: var(--text); text-align: right; }
.ga4-event-count small { font-weight: 500; color: var(--muted); }
.ga4-warn-box {
  margin-top: 14px; padding: 12px 14px;
  background: rgba(190,18,60,.08); border-left: 3px solid var(--bad);
  border-radius: 6px; font-size: 13px; color: var(--text); line-height: 1.6;
}

/* 소스/매체 테이블 */
.ga4-sm-table { margin-top: 12px; }
.ga4-sm-table th,
.ga4-sm-table td { padding: 8px 10px; font-size: 13px; }

.ga4-pill-hint {
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
  background: var(--bg-muted, #eef2ff); color: var(--muted);
  font-weight: 600; margin-left: 6px; vertical-align: middle;
}

@media (max-width: 960px) {
  .ga4-pages-grid-3 { grid-template-columns: 1fr; }
  .ga4-geo-grid,
  .ga4-demo-grid { grid-template-columns: 1fr; }
  .ga4-event-row { grid-template-columns: 120px 1fr 100px; }
}

/* =========================================================
 * 경쟁사 비교분석 (compete)
 * ========================================================= */
.compete-wrap { display: flex; flex-direction: column; gap: 18px; }
.compete-hero {
  background: linear-gradient(135deg, rgba(13,148,136,.08), rgba(236,72,153,.08));
  border: 1px solid var(--border);
}
.compete-hero-kicker { font-size: 13px; font-weight: 700; color: var(--brand); margin: 0 0 6px; }

.compete-input-form { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.compete-input-row { display: flex; flex-direction: column; gap: 4px; }
.compete-input-row label { font-size: 12px; font-weight: 700; color: var(--muted); }
.compete-input-row input {
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; background: var(--card-bg, #fff); color: var(--text);
}

.compete-summary {
  padding: 22px;
}
.compete-summary-top {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
}
.compete-team { text-align: center; }
.compete-team-lb {
  display: block; font-size: 13px; font-weight: 700; color: var(--muted);
  margin-bottom: 6px;
}
.compete-team-score { font-size: 56px; font-weight: 900; line-height: 1; }
.compete-team-mine .compete-team-score { color: #0d9488; }
.compete-team-comp .compete-team-score { color: #ec4899; }

.compete-vs { text-align: center; display: flex; flex-direction: column; gap: 4px; align-items: center; }
.compete-vs-badge {
  padding: 6px 14px; border-radius: 999px; color: #fff;
  font-size: 14px; font-weight: 800; letter-spacing: 1px;
}
.compete-vs small { font-size: 12px; color: var(--muted); font-weight: 700; }

.compete-summary-stats {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 12px; padding-top: 16px; border-top: 1px solid var(--border);
}
.compete-stat { text-align: center; display: flex; flex-direction: column; gap: 4px; }
.compete-stat strong { font-size: 28px; font-weight: 900; }
.compete-stat span { font-size: 12px; color: var(--muted); font-weight: 600; }

.compete-notes {
  margin-top: 12px; padding: 8px 12px;
  background: rgba(236,72,153,.06); border-radius: 6px;
  font-size: 12px; color: var(--muted);
}

.compete-radar-wrap { display: flex; justify-content: center; margin: 12px 0; }
.compete-radar { max-width: 520px; }
.compete-legend {
  display: flex; justify-content: center; gap: 20px; font-size: 13px;
  color: var(--text); font-weight: 600;
}
.compete-legend span { display: inline-flex; align-items: center; gap: 6px; }
.compete-dot {
  display: inline-block; width: 12px; height: 12px; border-radius: 3px;
}

.compete-ch-ic { margin-right: 4px; }

/* 확장형 카드 리스트 */
.compete-card-list { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.compete-card {
  border: 1px solid var(--border); border-radius: 10px;
  overflow: hidden; background: var(--card-bg, #fff);
  transition: box-shadow .15s, border-color .15s;
}
.compete-card.is-open { border-color: #8b5cf6; box-shadow: 0 4px 14px rgba(139,92,246,.08); }
.compete-card-mine { border-left: 4px solid #0d9488; }
.compete-card-comp { border-left: 4px solid #ec4899; }
.compete-card-tie  { border-left: 4px solid var(--muted); }

.compete-card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; padding: 14px 18px; cursor: pointer;
  user-select: none;
}
.compete-card-head:hover { background: rgba(139,92,246,.04); }
.compete-card-title { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.compete-card-title strong { font-weight: 700; }
.compete-card-scores {
  display: flex; align-items: center; gap: 12px; font-size: 13px;
}
.compete-card-score { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.compete-card-score small { font-size: 10px; color: var(--muted); font-weight: 600; }
.compete-card-score strong { font-size: 18px; font-weight: 900; }
.compete-card-vs { font-size: 11px; color: var(--muted); font-weight: 700; }
.compete-card-diff { font-weight: 800; font-size: 14px; min-width: 36px; text-align: center; }
.compete-card-verdict {
  padding: 4px 10px; border-radius: 999px; color: #fff;
  font-size: 11px; font-weight: 800;
}
.compete-card-chev {
  font-size: 16px; color: var(--muted); margin-left: 4px;
  transition: transform .15s;
}

/* 확장 패널 */
.compete-card-detail { border-top: 1px solid var(--border); padding: 18px; background: var(--bg, #fafafa); }
.compete-detail-panel { display: flex; flex-direction: column; gap: 16px; }

.compete-detail-bars { display: flex; flex-direction: column; gap: 8px; }
.compete-detail-bar {
  display: grid; grid-template-columns: 90px 1fr 48px;
  align-items: center; gap: 12px; font-size: 13px;
}
.compete-detail-lb { font-weight: 700; color: var(--text); }
.compete-detail-track {
  height: 14px; background: var(--bg-muted, #eef2ff);
  border-radius: 999px; overflow: hidden;
}
.compete-detail-fill { height: 100%; border-radius: 999px; transition: width .3s; }

.compete-detail-gap {
  margin: 0; padding: 10px 12px;
  background: rgba(139,92,246,.06); border-left: 3px solid #8b5cf6;
  border-radius: 6px; font-size: 13px; color: var(--text); line-height: 1.6;
}

.compete-detail-cols {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
}
.compete-detail-col {
  padding: 12px 14px; border-radius: 8px;
  border: 1px solid var(--border);
}
.compete-detail-mine { background: rgba(13,148,136,.04); border-left: 3px solid #0d9488; }
.compete-detail-comp { background: rgba(236,72,153,.04); border-left: 3px solid #ec4899; }
.compete-detail-col h5 { margin: 0 0 8px; font-size: 13px; }
.compete-detail-col strong { font-size: 12px; color: var(--muted); display: block; margin: 8px 0 4px; }
.compete-detail-col ul { margin: 0; padding-left: 18px; font-size: 12.5px; color: var(--text); line-height: 1.6; }
.compete-detail-sum { margin: 0 0 6px; font-size: 12.5px; color: var(--text); line-height: 1.6; }
.compete-detail-col h5 small {
  font-size: 11px; font-weight: 700; color: var(--muted);
  margin-left: 6px;
}
.compete-detail-hint {
  margin: 10px 0 0; padding: 6px 10px;
  background: rgba(139,92,246,.06); border-radius: 6px;
  font-size: 11px; color: var(--muted); line-height: 1.5;
}

/* 격차 분석 박스 */
.compete-gap-box {
  padding: 14px 16px; border-radius: 10px;
  background: linear-gradient(135deg, rgba(13,148,136,.05), rgba(236,72,153,.05));
  border: 1px solid var(--border);
}
.compete-gap-box h5 { margin: 0 0 10px; font-size: 14px; }
.compete-gap-box p { margin: 0 0 8px; font-size: 13px; color: var(--text); line-height: 1.6; }
.compete-gap-box p strong { font-size: 12px; color: var(--muted); }
.compete-gap-box ul {
  margin: 0 0 12px; padding-left: 20px;
  font-size: 12.5px; color: var(--text); line-height: 1.7;
}
.compete-gap-tip {
  margin: 4px 0 0 !important;
  padding: 8px 10px;
  background: rgba(251,191,36,.1); border-left: 3px solid #f59e0b;
  border-radius: 6px;
  font-size: 12.5px !important; font-weight: 600;
}

.compete-detail-actions {
  padding: 12px 14px; border-radius: 8px;
  background: rgba(251,191,36,.06); border-left: 3px solid #f59e0b;
}
.compete-detail-actions h5 { margin: 0 0 8px; font-size: 13px; }
.compete-detail-actions ol { margin: 0; padding-left: 18px; font-size: 12.5px; color: var(--text); line-height: 1.7; }

/* 레이더 라벨 */
.compete-radar-label text { pointer-events: none; }

.compete-locked {
  text-align: center; padding: 40px 20px;
  background: linear-gradient(135deg, rgba(139,92,246,.06), rgba(236,72,153,.06));
  border: 1px solid var(--border);
}
.compete-locked h4 { margin: 10px 0 6px; font-size: 16px; }
.compete-locked p { color: var(--muted); font-size: 13px; margin: 0 0 16px; }

.compete-action-list { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.compete-action-item {
  display: grid; grid-template-columns: 50px 1fr; gap: 14px;
  padding: 14px; border: 1px solid var(--border); border-radius: 10px;
  background: rgba(236,72,153,.04);
}
.compete-action-rank {
  width: 44px; height: 44px; border-radius: 50%;
  background: linear-gradient(135deg, #ec4899, #be123c);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 900;
}
.compete-action-body h4 { margin: 0 0 6px; font-size: 15px; }
.compete-action-body p { margin: 0 0 10px; font-size: 13px; color: var(--text); }

.compete-empty { text-align: center; padding: 40px; color: var(--muted); }

@media (max-width: 760px) {
  .compete-summary-top { grid-template-columns: 1fr; gap: 14px; }
  .compete-team-score { font-size: 44px; }
  .compete-card-head { flex-direction: column; align-items: flex-start; }
  .compete-card-scores { flex-wrap: wrap; }
  .compete-detail-cols { grid-template-columns: 1fr; }
}

/* =========================================================
 * 변화 추이 분석 (history)
 * ========================================================= */
.history-empty {
  text-align: center; padding: 50px 24px;
  background: linear-gradient(135deg, rgba(13,148,136,.05), rgba(139,92,246,.05));
}
.history-empty h3 { margin: 12px 0 8px; font-size: 17px; }
.history-empty p { color: var(--muted); font-size: 13px; margin: 0 0 18px; }

.history-summary {
  padding: 22px;
}
.history-summary-top {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
}
.history-team { text-align: center; display: flex; flex-direction: column; gap: 4px; }
.history-team-lb { font-size: 13px; font-weight: 700; color: var(--muted); }
.history-team small { font-size: 11px; color: var(--muted); }
.history-team-score { font-size: 56px; font-weight: 900; line-height: 1; margin-top: 4px; }

.history-vs { text-align: center; display: flex; flex-direction: column; gap: 4px; align-items: center; }
.history-vs-badge {
  padding: 6px 14px; border-radius: 999px; color: #fff;
  font-size: 14px; font-weight: 800; letter-spacing: 1px;
}
.history-vs small { font-size: 12px; color: var(--muted); font-weight: 700; }

.history-stats-card { padding: 16px 22px; }

.history-action-bar { padding: 14px 18px; }
.history-action-bar strong { font-size: 14px; }

.history-lock-pill {
  font-size: 10px; padding: 3px 8px; border-radius: 999px;
  background: rgba(139,92,246,.12); color: #8b5cf6;
  font-weight: 800; margin-left: 4px;
}

.history-detail-locked {
  text-align: center; padding: 24px;
  background: linear-gradient(135deg, rgba(139,92,246,.06), rgba(236,72,153,.06));
  border-radius: 10px;
}
.history-detail-locked h5 { margin: 8px 0 4px; font-size: 14px; }
.history-detail-locked p { color: var(--muted); font-size: 12.5px; margin: 0 0 14px; }

.history-detail-panel { display: flex; flex-direction: column; gap: 14px; }

.history-timeseries-card { padding: 22px; }
.history-timeseries-card svg { display: block; margin-top: 10px; }

.history-auto-card {
  padding: 18px 22px;
  background: linear-gradient(135deg, rgba(13,148,136,.06), rgba(13,148,136,.02));
  border-left: 4px solid #0d9488;
}
.history-auto-locked {
  padding: 22px;
  background: linear-gradient(135deg, rgba(139,92,246,.05), rgba(236,72,153,.05));
  text-align: center;
}
.history-auto-locked h3 { margin: 0 0 8px; font-size: 16px; }
.history-auto-locked p { color: var(--muted); font-size: 13px; margin: 0 0 14px; }

@media (max-width: 760px) {
  .history-summary-top { grid-template-columns: 1fr; gap: 14px; }
  .history-team-score { font-size: 44px; }
}

/* ===================== ContentFlow Phase 1 ===================== */
.kw-input-row, .cal-input-row, .draft-form {
  display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0 18px;
}
.kw-input-row input, .cal-input-row input, .draft-form input, .draft-form select {
  flex: 1 1 240px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text); font-size: 14px;
}
.draft-form select { flex: 0 0 140px; }

.kw-lab .kw-head h4 { margin: 0 0 4px; }
.kw-empty, .cal-empty, .draft-empty { text-align:center; padding: 48px 20px; border: 2px dashed var(--border); border-radius: 12px; }
.kw-empty-ic, .cal-empty-ic, .draft-empty-ic { font-size: 48px; margin-bottom: 12px; }
.kw-empty code { background: var(--surface-2); padding: 2px 6px; border-radius: 4px; }

.kw-stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
.kw-stat { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px; text-align:center; }
.kw-stat .n { font-size: 24px; font-weight: 700; }
.kw-stat .l { font-size: 12px; color: var(--muted); }

.kw-block { margin: 18px 0; padding: 14px; background: var(--surface-2); border-radius: 10px; border: 1px solid var(--border); }
.kw-block h5 { margin: 0 0 12px; font-size: 14px; }

.kw-intent { display: grid; grid-template-columns: 200px 1fr; gap: 10px; align-items:center; margin-bottom: 6px; font-size: 13px; }
.kw-intent-bar { background: var(--border); height: 8px; border-radius: 4px; overflow: hidden; }
.kw-intent-bar > div { height: 100%; }
.kw-dot { display:inline-block; width:10px; height:10px; border-radius:50%; margin-right:6px; vertical-align:middle; }

.kw-quad-wrap { display: grid; grid-template-columns: 1fr 240px; gap: 16px; }
.kw-quad {
  position: relative; aspect-ratio: 1/1; max-width: 480px;
  display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  overflow: hidden;
}
.kw-q-cell { padding: 10px; font-size: 12px; opacity: .6; border: 1px dashed var(--border); }
.q-gem { background: rgba(34,197,94,.08); }
.q-hard { background: rgba(245,158,11,.08); }
.q-easy { background: rgba(100,116,139,.08); }
.q-avoid { background: rgba(220,38,38,.06); }
.kw-q-axis-y { position:absolute; left: -8px; top: 50%; transform: rotate(-90deg) translateX(50%); font-size: 11px; color: var(--muted); }
.kw-q-axis-x { position:absolute; right: 8px; bottom: -18px; font-size: 11px; color: var(--muted); }
.kw-q-dot { position:absolute; width: 8px; height: 8px; border-radius: 50%; transform: translate(-50%, 50%); }
.kw-q-tip { background: var(--surface); border-radius: 8px; padding: 12px; font-size: 13px; border:1px solid var(--border); }

.kw-clusters { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.kw-cluster { background: var(--surface); border:1px solid var(--border); border-radius: 10px; padding: 12px; }
.kw-cluster-head { display:flex; justify-content:space-between; align-items:center; margin-bottom:6px; }
.kw-cluster-head small { color: var(--muted); }
.kw-chips { display:flex; flex-wrap:wrap; gap:5px; margin: 6px 0; }
.kw-chip { display:inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid; }
.small { font-size: 12px; }

.kw-table-wrap { overflow-x: auto; }
.kw-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.kw-table th, .kw-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.kw-table th { background: var(--surface); font-weight: 600; }
.kw-pill { display:inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.kw-sug { font-size: 11px; color: var(--muted); }

/* Calendar */
.cal-summary { background: var(--surface-2); border:1px solid var(--border); border-radius: 10px; padding: 12px; margin-bottom: 16px; }
.cal-totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px,1fr)); gap: 10px; margin-bottom: 10px; }
.cal-total { display:flex; align-items:center; gap: 10px; padding: 10px; background: var(--surface); border-radius: 8px; border: 1px solid; }
.cal-total-ic { width: 32px; height: 32px; border-radius: 50%; color:#fff; display:flex; align-items:center; justify-content:center; }
.cal-total-n { font-weight: 700; font-size: 18px; }
.cal-total-l { font-size: 11px; color: var(--muted); }
.cal-weak { font-size: 13px; color: var(--text); padding-top: 8px; border-top: 1px dashed var(--border); }

.cal-week { margin-bottom: 18px; }
.cal-week h5 { margin: 0 0 8px; font-size: 13px; color: var(--muted); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-day { background: var(--surface-2); border:1px solid var(--border); border-radius: 8px; padding: 6px; min-height: 100px; }
.cal-day.is-today { border-color: #22c55e; box-shadow: 0 0 0 2px rgba(34,197,94,.15); }
.cal-day-head { display:flex; justify-content:space-between; align-items:center; margin-bottom: 4px; font-size: 11px; }
.cal-day-date { font-weight: 700; font-size: 14px; }
.cal-day-wk { color: var(--muted); }
.cal-item { background: var(--surface); border-left: 3px solid; padding: 6px 8px; border-radius: 4px; margin-top: 4px; font-size: 11px; }
.cal-item-ch { font-weight: 700; font-size: 10px; margin-bottom: 2px; }
.cal-item-tp { font-size: 11px; }
.cal-item-tx { font-size: 11px; color: var(--muted); margin-top: 2px; }
.cal-empty-day { font-size: 11px; color: var(--muted); text-align:center; padding-top: 30px; }

/* Draft Generator */
.draft-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 14px 0 8px; }
.draft-tab { background: var(--surface-2); border: 1px solid var(--border); padding: 8px 12px; border-radius: 8px; font-size: 13px; cursor: pointer; color: var(--text); }
.draft-tab.active { background: #22c55e; color: #fff; border-color: #22c55e; }
.draft-out { background: var(--surface-2); border:1px solid var(--border); border-radius: 10px; padding: 14px; }
.draft-meta { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; font-size: 13px; }
.draft-meta > div { background: var(--surface); padding: 10px; border-radius: 6px; border:1px solid var(--border); }
.draft-body { background: var(--surface); padding: 12px; border-radius: 6px; border:1px solid var(--border); margin-top: 10px; }
.draft-body pre { white-space: pre-wrap; word-break: break-word; font-family: inherit; font-size: 13px; line-height: 1.6; margin: 0; }
.draft-cta { background: #22c55e; color: #fff; padding: 10px 14px; border-radius: 8px; text-align:center; margin-top: 10px; font-weight: 600; }
.ig-toolbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px dashed var(--border); }
.ig-toolbar-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ig-download-bar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; padding: 14px 16px; margin-bottom: 14px; background: linear-gradient(135deg, #eef2ff, #faf5ff); border: 1px solid #c7d2fe; border-radius: 12px; }
.ig-download-bar button.primary { font-size: 14px; padding: 10px 18px; font-weight: 700; background: #6366f1; color: #fff; border: none; border-radius: 8px; cursor: pointer; }
.ig-download-bar button.primary:hover { background: #4f46e5; }
.ig-download-bar button.primary:disabled { opacity: .6; cursor: not-allowed; }
[data-theme="dark"] .ig-download-bar { background: linear-gradient(135deg, #1e1b4b, #2e1065); border-color: #4338ca; }

/* Shortform 9:16 frames */
.sf-frames { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-bottom: 16px; }
.sf-frame { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
.sf-frame-img-wrap { position: relative; aspect-ratio: 9/16; background: linear-gradient(135deg, #1e293b, #334155); overflow: hidden; }
.sf-frame-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; z-index: 1; }
.sf-frame-overlay { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 12px; text-align: center; background: linear-gradient(180deg, rgba(0,0,0,.35) 0%, rgba(0,0,0,.55) 50%, rgba(0,0,0,.8) 100%); }
.sf-frame-time { position: absolute; top: 10px; left: 10px; background: rgba(0,0,0,.6); color: #fff; padding: 4px 10px; border-radius: 12px; font-size: 11px; font-weight: 800; }
.sf-frame-role { position: absolute; top: 10px; right: 10px; background: rgba(255,255,255,.22); color: #fff; padding: 4px 10px; border-radius: 12px; font-size: 11px; font-weight: 700; }
.sf-frame-text { color: #fff; font-weight: 900; font-size: 15px; line-height: 1.35; text-shadow: 0 2px 6px rgba(0,0,0,.6); white-space: pre-wrap; word-break: keep-all; }
.sf-frame-meta { padding: 10px 12px; border-top: 1px solid var(--border); }
.sf-frame-meta strong { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.sf-frame-meta pre { white-space: pre-wrap; word-break: break-word; font-family: inherit; font-size: 13px; line-height: 1.5; margin: 0; }
.sf-frame-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; z-index: 1; background: #000; }
.sf-gen-overlay { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; background: rgba(0,0,0,.65); color: #fff; font-weight: 700; font-size: 13px; }
.sf-text-overlay { position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; padding: 18px 14px 16px; background: linear-gradient(to top, rgba(0,0,0,.88) 0%, rgba(0,0,0,.55) 60%, rgba(0,0,0,0) 100%); color: #fff; display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
.sf-text-overlay .sf-text-role { font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; opacity: .9; background: rgba(255,255,255,.2); padding: 3px 8px; border-radius: 4px; align-self: flex-start; }
.sf-text-overlay .sf-text-line { font-size: 14px; font-weight: 800; line-height: 1.35; white-space: pre-wrap; text-shadow: 0 2px 6px rgba(0,0,0,.7); }
.sf-spinner { width: 36px; height: 36px; border: 3px solid rgba(255,255,255,.3); border-top-color: #fff; border-radius: 50%; animation: sf-spin .9s linear infinite; }
@keyframes sf-spin { to { transform: rotate(360deg); } }
.ig-slides { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-bottom: 16px; }
.ig-slide { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.ig-slide-img-wrap { position: relative; aspect-ratio: 1/1; background: linear-gradient(135deg, #e5e7eb, #d1d5db); overflow: hidden; }
.ig-slide-img { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s; background: transparent; }
.ig-slide-overlay { z-index: 2; }
.ig-slide-badge, .ig-slide-tag { z-index: 3; }
.ig-slide-tag.design { background: rgba(139,92,246,.95); color: #fff; }
.ig-slide-caption { padding: 10px 12px; background: var(--surface); border-top: 1px solid var(--border); }
.ig-slide-caption pre { white-space: pre-wrap; font-family: inherit; font-size: 12px; line-height: 1.5; margin: 0; color: var(--text); }
.ig-slide:hover .ig-slide-img { transform: scale(1.04); }
.ig-slide-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: linear-gradient(0deg, rgba(0,0,0,.55) 0%, rgba(0,0,0,.15) 50%, rgba(0,0,0,.1) 100%); padding: 16px; pointer-events: none; }
.ig-slide-text { color: #fff; font-weight: 700; font-size: 15px; text-align: center; white-space: pre-wrap; line-height: 1.4; text-shadow: 0 2px 6px rgba(0,0,0,.5); }
.ig-slide-badge { position: absolute; top: 8px; left: 8px; background: rgba(0,0,0,.7); color: #fff; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.ig-slide-tag { position: absolute; top: 8px; right: 8px; padding: 3px 8px; border-radius: 999px; font-size: 10px; font-weight: 600; }
.ig-slide-tag.ai { background: rgba(139,92,246,.95); color: #fff; }
.ig-slide-tag.user { background: rgba(34,197,94,.95); color: #fff; }
.ig-slide-controls { display: flex; gap: 4px; padding: 8px; flex-wrap: wrap; background: var(--surface-2); }
.ig-upload-btn { font-size: 11px; padding: 6px 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; cursor: pointer; color: var(--text); }
.ig-upload-btn:hover { background: #8b5cf6; color: #fff; border-color: #8b5cf6; }
.ig-slide-controls .ghost.small { margin-top: 0; font-size: 11px; padding: 6px 8px; }
.draft-slides { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-bottom: 12px; }
.draft-slide { background: var(--surface); border:1px solid var(--border); border-radius: 8px; padding: 10px; text-align:center; min-height: 120px; }
.draft-slide-n { background: #22c55e; color:#fff; width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items:center; justify-content:center; font-weight: 700; font-size: 12px; }
.draft-slide-role { font-size: 10px; color: var(--muted); margin: 4px 0; }
.draft-slide-text { font-size: 12px; white-space: pre-wrap; }
.draft-beats { display: grid; gap: 6px; margin-bottom: 12px; }
.draft-beat { display: grid; grid-template-columns: 70px 60px 1fr; gap: 8px; padding: 8px; background: var(--surface); border:1px solid var(--border); border-radius: 6px; font-size: 13px; align-items:center; }
.draft-beat-t { font-weight: 700; color: #22c55e; font-size: 12px; }
.draft-beat-role { font-size: 11px; color: var(--muted); }
.draft-section { background: var(--surface); border:1px solid var(--border); border-radius: 8px; padding: 12px; margin-top: 10px; }
.draft-section h6 { margin: 0 0 6px; font-size: 14px; }
.draft-section pre { white-space: pre-wrap; font-family: inherit; font-size: 13px; line-height: 1.5; margin: 0; }

/* Copy Templates */
.tpl-tabs { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; margin: 14px 0; }
.tpl-tab { background: var(--surface-2); border: 1px solid var(--border); padding: 10px; border-radius: 8px; cursor: pointer; text-align: left; color: var(--text); display: grid; gap: 2px; }
.tpl-tab strong { font-size: 14px; }
.tpl-tab small { font-size: 10px; color: var(--muted); }
.tpl-tab.active { background: #8b5cf6; color: #fff; border-color: #8b5cf6; }
.tpl-tab.active small { color: rgba(255,255,255,.85); }
.tpl-detail { background: var(--surface-2); border:1px solid var(--border); border-radius: 10px; padding: 14px; }
.tpl-info h5 { margin: 0 0 4px; }
.tpl-info p { color: var(--muted); margin: 0 0 8px; }
.tpl-best { font-size: 12px; padding: 8px 10px; background: var(--surface); border-radius: 6px; border:1px solid var(--border); }
.tpl-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.tpl-col { background: var(--surface); border:1px solid var(--border); border-radius: 8px; padding: 12px; }
.tpl-col h6 { margin: 0 0 10px; font-size: 13px; }
.tpl-step { display: grid; grid-template-columns: 28px 1fr; gap: 8px; align-items: start; padding: 6px 0; border-bottom: 1px dashed var(--border); }
.tpl-step:last-child { border-bottom: 0; }
.tpl-step-n { background: #8b5cf6; color: #fff; width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items:center; justify-content:center; font-weight: 700; font-size: 12px; }
.tpl-fill { padding: 8px 0; border-bottom: 1px dashed var(--border); }
.tpl-fill:last-of-type { border-bottom: 0; }
.tpl-fill-k { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.tpl-fill-v { font-size: 13px; }
.ghost.small { font-size: 12px; padding: 6px 10px; margin-top: 8px; }

/* Template variable input form */
.tpl-vars { background: linear-gradient(135deg, rgba(139,92,246,.06), rgba(34,197,94,.05)); border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin: 14px 0 18px; }
.tpl-vars-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.tpl-vars-head strong { font-size: 15px; }
.tpl-vars-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.tpl-vars-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.tpl-vars-grid input { padding: 9px 11px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); color: var(--text); font-size: 13px; }
.tpl-vars-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.tpl-vars-note { font-size: 12px; padding-top: 6px; border-top: 1px dashed var(--border); }

/* All-frames grid view */
.tpl-all-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.tpl-card { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 14px; }
.tpl-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.tpl-card-head strong { font-size: 16px; color: #8b5cf6; }
.tpl-card-desc { font-size: 12px; color: var(--muted); margin: 0 0 8px; line-height: 1.5; }
.tpl-card-best { font-size: 11px; padding: 6px 8px; background: var(--surface); border-radius: 6px; margin-bottom: 10px; }
.tpl-card-fills { display: grid; gap: 6px; }
.tpl-card .tpl-fill { padding: 6px 0; border-bottom: 1px dashed var(--border); }
.tpl-card .tpl-fill:last-child { border-bottom: 0; }

@media (max-width: 760px) {
  .tpl-vars-grid { grid-template-columns: 1fr; }
  .tpl-all-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .kw-stats-row { grid-template-columns: repeat(2, 1fr); }
  .kw-quad-wrap { grid-template-columns: 1fr; }
  .kw-intent { grid-template-columns: 140px 1fr; }
  .cal-grid { grid-template-columns: 1fr; }
  .draft-meta { grid-template-columns: 1fr; }
  .tpl-cols { grid-template-columns: 1fr; }
}
