/* ============================================================
   Drafters(드래프터즈) — forest-green × antique-gold design system
   로고 기준: 딥그린 #1E3A2F · 골드 #B08A3E · 웜그레이 #7A7263
   무드: 특허사무소 클래식 — 세리프 디스플레이 + 웜 페이퍼 서피스
   ============================================================ */

:root {
  /* Brand — deep forest green + antique gold */
  --ink: #1E3A2F;              /* 로고 그린: 워드마크·히어로·최심 강조 */
  --primary: #24523F;          /* 인터랙티브 그린: 기본 버튼·활성 */
  --primary-dark: #16352A;
  --primary-soft: #e9efe7;
  --primary-contrast: #ffffff;
  --accent: #96701F;           /* 딥 골드: 링크·하이라이트(본문 대비 확보) */
  --accent-soft: #f5eedb;
  --gold: #B08A3E;             /* 로고 골드: 장식·포인트(대형 요소 전용) */
  --gold-soft: #f7f0df;

  /* Surfaces — 웜 페이퍼 */
  --bg-app: #f7f6f1;
  --bg-surface: #fffdf9;
  --bg-subtle: #f1efe7;
  --bg-hover: #eae7dc;
  --bg-inset: #faf9f3;

  /* Text — 그린·웜그레이 틴트 */
  --text-primary: #232e27;
  --text-secondary: #5a615a;
  --text-muted: #8c8b7d;

  /* Lines */
  --border: #e5e2d6;
  --border-strong: #d3cfc0;

  /* Semantic match colors */
  --o: #e5484d;  --o-bg: #fdecec;  --o-fg: #c4292e;  --o-border: #f6cccd;
  --y: #e0900a;  --y-bg: #fdf3e0;  --y-fg: #b3730a;  --y-border: #f6e0b3;
  --x: #2a9d63;  --x-bg: #e9f6ef;  --x-fg: #1f7a4d;  --x-border: #c2e6d2;

  --success: #2a9d63;
  --warning: #e0900a;
  --danger: #e5484d;

  /* Effects — softer, more layered */
  --shadow-sm: 0 1px 2px rgba(30,58,47,0.05), 0 1px 3px rgba(30,58,47,0.06);
  --shadow-md: 0 6px 18px rgba(30,58,47,0.09);
  --shadow-lg: 0 18px 44px rgba(30,58,47,0.15);
  --ring: 0 0 0 3px rgba(176,138,62,0.32);

  /* 클래식 무드 — 라운딩 절제 */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  --nav-h: 60px;

  /* Typography */
  --font-body: 'Inter', 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  --font-display: 'Lora', 'Noto Serif KR', Georgia, 'Times New Roman', serif;
}

[data-theme="dark"] {
  --ink: #d9e4da;
  --primary: #8fc0a4;
  --primary-dark: #a5d1b7;
  --primary-soft: #1c2a21;
  --primary-contrast: #0e1512;
  --accent: #d2a856;
  --accent-soft: #2a2413;
  --gold: #c89a48;
  --gold-soft: #2b2414;

  --bg-app: #0f1310;
  --bg-surface: #151a16;
  --bg-subtle: #1a201a;
  --bg-hover: #212921;
  --bg-inset: #111611;

  --text-primary: #e6eae3;
  --text-secondary: #a2aa9f;
  --text-muted: #70786d;

  --border: #293028;
  --border-strong: #363e35;

  --o: #ff6b6f;  --o-bg: #2a1517;  --o-fg: #ff8a8d;  --o-border: #4a2326;
  --y: #f0ad2e;  --y-bg: #2a2113;  --y-fg: #ffc658;  --y-border: #4a3a1a;
  --x: #3fb87a;  --x-bg: #122a1e;  --x-fg: #5fd197;  --x-border: #1d4a33;

  --success: #3fb87a;
  --warning: #f0ad2e;
  --danger: #ff6b6f;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 6px 18px rgba(0,0,0,0.42);
  --shadow-lg: 0 18px 44px rgba(0,0,0,0.52);
  --ring: 0 0 0 3px rgba(200,154,72,0.32);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  letter-spacing: -0.01em;
  background: var(--bg-app);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background 0.25s ease, color 0.25s ease;
}

/* ============================ Navbar ============================ */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  background: color-mix(in srgb, var(--bg-surface) 85%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.navbar-inner {
  max-width: 1180px;
  height: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 19px;
}

/* 로고 마크(3단 바 + 골드팁)를 그대로 노출 — 배지 박스 없음.
   바는 currentColor(=--ink)로 그려 라이트/다크 자동 반전, 골드팁은 SVG 안에서 var(--gold). */
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
}
.brand-mark svg { display: block; }

.brand-name {
  font-family: var(--font-display);
  color: var(--ink);
  letter-spacing: -0.01em;
}
.brand-dot { color: var(--gold); }

.footer-note { color: var(--text-muted); font-size: 12px; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link {
  position: relative;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
}

.nav-link:hover { color: var(--text-primary); background: var(--bg-hover); }

.nav-link.active { color: var(--primary); background: var(--primary-soft); font-weight: 600; }
.nav-link.nav-em { color: var(--text-primary); font-weight: 700; }  /* 메인 기둥(스튜디오) 상시 강조 */
.nav-link.nav-em.active { color: var(--primary); }

.theme-toggle {
  margin-left: 8px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}

.theme-toggle:hover { background: var(--bg-hover); transform: rotate(-15deg); }

.theme-icon-light { display: none; }
.theme-icon-dark { display: inline; }
[data-theme="dark"] .theme-icon-light { display: inline; }
[data-theme="dark"] .theme-icon-dark { display: none; }

/* ============================ Layout ============================ */
.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 32px 24px 24px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}

.page-head h1 {
  font-family: var(--font-display);
  font-size: 27px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.page-head .subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.page-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* ============================ Cards ============================ */
.card {
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  transition: background 0.25s, border-color 0.25s;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ============================ Upload ============================ */
.upload-area {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-md);
  padding: 44px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  background: var(--bg-inset);
}

.upload-area:hover, .upload-area.dragover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.upload-area .upload-icon {
  width: 56px;
  height: 56px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 26px;
  box-shadow: var(--shadow-sm);
}

.upload-area .upload-text { font-size: 15px; color: var(--text-primary); margin-bottom: 4px; font-weight: 500; }
.upload-area .upload-hint { font-size: 13px; color: var(--text-muted); }

.upload-area input[type="file"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer;
}

/* ============================ Buttons ============================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }

.btn-sm { padding: 6px 12px; font-size: 13px; }

.btn-primary { background: var(--primary); color: var(--primary-contrast); }
.btn-primary:hover { background: var(--primary-dark); box-shadow: var(--shadow-md); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }

.btn-secondary {
  background: var(--bg-subtle);
  color: var(--text-primary);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--bg-hover); border-color: var(--border-strong); }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(1.05); box-shadow: var(--shadow-md); }

.btn-danger { background: var(--danger); color: #fff; }

/* ============================ File chip ============================ */
.file-name-display {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--primary-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-top: 16px;
  color: var(--primary);
  font-size: 14px;
  font-weight: 500;
}

.file-name-display .remove-file {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

/* ============================ Flash ============================ */
.flash-messages { margin-bottom: 16px; }

.flash-message {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  font-size: 14px;
}

.flash-message.error { background: var(--o-bg); color: var(--o-fg); border: 1px solid var(--o-border); }
.flash-message.success { background: var(--x-bg); color: var(--x-fg); border: 1px solid var(--x-border); }

/* 전역 flash(base/layout_marketing이 렌더, 감사 #1) — 중립 톤 + 닫기 버튼 + 자동 소멸 페이드(ui.js) */
.flash-message.info { background: var(--bg-subtle); color: var(--text-primary); border: 1px solid var(--border); }
.global-flash .flash-message { display: flex; align-items: flex-start; gap: 10px; transition: opacity .3s ease; }
.global-flash .flash-message.flash-out { opacity: 0; }
.flash-close {
  margin-left: auto; background: none; border: none; padding: 0;
  color: inherit; opacity: .55; cursor: pointer; font-size: 13px; line-height: 1.4;
}
.flash-close:hover { opacity: 1; }
/* 마케팅 레이아웃은 full-bleed — 전역 flash만 본문 폭으로 가운데 정렬 */
.mkt .global-flash { max-width: var(--mkt-max); margin: 16px auto 0; padding: 0 24px; }

/* ============================ Task info ============================ */
.task-info p, .result-info p { font-size: 14px; color: var(--text-secondary); margin-bottom: 6px; }
.task-info strong, .result-info strong { color: var(--text-primary); margin-right: 4px; }

/* ============================ Steps ============================ */
.steps-container { margin: 20px 0; display: flex; flex-direction: column; gap: 6px; }

.step-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 1px solid transparent;
  transition: all 0.25s;
}

.step-item .step-icon {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--border);
  color: var(--text-muted);
  font-size: 13px;
  margin-right: 12px;
  flex-shrink: 0;
  transition: all 0.25s;
}

.step-item .step-icon.pending {
  background: var(--primary); color: var(--primary-contrast); animation: pulse 1.5s infinite;
}
.step-item .step-icon.done { background: var(--success); color: #fff; }

.step-label { flex: 1; font-size: 14px; color: var(--text-primary); }
.step-status { font-size: 12px; color: var(--text-muted); }
.step-status.status-processing { color: var(--primary); font-weight: 600; }
.step-status.status-completed { color: var(--success); font-weight: 600; }

@keyframes pulse { 0%,100%{opacity:1;} 50%{opacity:0.45;} }

/* ============================ Progress bar ============================ */
.progress-bar-container {
  width: 100%; height: 8px;
  background: var(--bg-subtle);
  border-radius: 999px;
  overflow: hidden;
  margin: 24px 0 12px;
}

.progress-bar {
  height: 100%; width: 0%;
  /* 로고 모티프: 그린 바의 끝에 골드 팁 */
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary) 82%, var(--gold) 100%);
  border-radius: 999px;
  transition: width 0.5s ease;
}
.progress-bar.error { background: var(--danger); }

.progress-text { text-align: center; color: var(--text-secondary); font-size: 14px; margin-bottom: 8px; }
.progress-text.text-error { color: var(--danger); font-weight: 600; }

/* ============================ Preview ============================ */
.results-preview { margin-bottom: 20px; }

.preview-card {
  background: var(--bg-inset);
  padding: 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  border-left: 3px solid var(--primary);
}
.preview-card h4 { font-size: 14px; color: var(--text-primary); margin-bottom: 8px; }
.preview-card p { font-size: 13px; color: var(--text-secondary); margin-bottom: 4px; }

/* ============================ Log ============================ */
.log-content {
  background: #101511;
  color: #cdd4cc;
  padding: 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  max-height: 320px;
  overflow-y: auto;
  font-family: 'SFMono-Regular', 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.7;
}

.log-entry { padding: 2px 0; }
.log-time { color: #c9aa5f; margin-right: 8px; }
.log-error { color: #ff7b72; }
.log-warning { color: #e3b341; }

/* ============================ Summary cards ============================ */
.summary-cards { display: flex; gap: 16px; margin-top: 20px; }

.summary-card {
  flex: 1;
  padding: 20px;
  border-radius: var(--radius-md);
  text-align: center;
  border: 1px solid var(--border);
}

.summary-card .summary-count { display: block; font-size: 34px; font-weight: 700; margin-bottom: 2px; line-height: 1.1; }
.summary-card .summary-label { font-size: 13px; font-weight: 600; }

.summary-card.match-o { background: var(--o-bg); color: var(--o-fg); border-color: var(--o-border); }
.summary-card.match-y { background: var(--y-bg); color: var(--y-fg); border-color: var(--y-border); }
.summary-card.match-x { background: var(--x-bg); color: var(--x-fg); border-color: var(--x-border); }

/* ============================ Table ============================ */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

table { width: 100%; border-collapse: collapse; font-size: 14px; }

th, td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

/* position: sticky 를 쓰지 않는다.
   모든 표는 .table-container(overflow-x:auto) 안에 있고, overflow-x 가 auto 면
   overflow-y 도 auto 로 계산되어 그 컨테이너가 스크롤 컨테이너가 된다. 그 안에서
   `top: var(--nav-h)` 로 sticky 를 걸면 세로 스크롤이 없어도 헤더가 nav 높이만큼
   아래로 밀려 본문 첫 행 위에 겹쳐 그려진다(표 있는 전 페이지에서 발생했다).
   헤더 고정이 필요하면 세로 스크롤(max-height)이 있는 컨테이너에서만 opt-in 할 것. */
th {
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

tbody tr { transition: background 0.12s; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--bg-hover); }

.row-match-o { background: color-mix(in srgb, var(--o-bg) 55%, transparent); }
.row-match-y { background: color-mix(in srgb, var(--y-bg) 55%, transparent); }
.row-match-x { background: color-mix(in srgb, var(--x-bg) 45%, transparent); }

/* ============================ Badges ============================ */
.match-badge {
  display: inline-block;
  min-width: 26px;
  text-align: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 12px;
  color: #fff;
}
.match-badge.match-o { background: var(--o); }
.match-badge.match-y { background: var(--y); }
.match-badge.match-x { background: var(--x); }

.patent-ref { font-size: 13px; color: var(--text-primary); line-height: 1.5; word-break: break-word; }

/* ============================ Info box ============================ */
.info-box {
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  padding: 16px 20px;
  border-radius: var(--radius-sm);
}

.info-box ul { list-style: none; padding-left: 0; }
.info-box li { padding: 4px 0; color: var(--text-secondary); font-size: 14px; }
.info-box li::before { content: "▸"; color: var(--primary); margin-right: 8px; }

/* ============================ Error message ============================ */
.error-message { background: var(--o-bg); border: 1px solid var(--o-border); border-radius: var(--radius-sm); padding: 16px 20px; color: var(--o-fg); }
.error-message .error-detail { font-size: 13px; margin-top: 8px; font-family: monospace; opacity: 0.85; }

/* ============================ Status text ============================ */
.status-completed { color: var(--success); font-weight: 600; }
.status-failed { color: var(--danger); font-weight: 600; }
.status-processing { color: var(--primary); font-weight: 600; animation: pulse 1.5s infinite; }

/* ============================ No data ============================ */
.no-data { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.no-data .no-data-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.6; }
.no-data p { font-size: 15px; }

/* ============================ Action buttons ============================ */
.action-buttons { margin-top: 24px; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ============================ Footer ============================ */
.app-layout footer {
  text-align: center;
  padding: 28px 20px 12px;
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 12px;
}

footer .disclaimer {
  max-width: 720px;
  margin: 0 auto 12px;
  padding: 12px 16px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.7;
  text-align: left;
}

footer .footer-meta a {
  color: var(--text-secondary);
  text-decoration: underline;
}
footer .footer-meta a:hover { color: var(--primary); }

/* ============================ Tabs ============================ */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 16px;
  margin-bottom: -1px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--primary); border-bottom-color: var(--gold); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ============================ Textarea ============================ */
.textarea {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-inset);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
.textarea::placeholder { color: var(--text-muted); }

/* ============================ Score ============================ */
.score-row {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 8px;
}

.score-badge {
  flex-shrink: 0;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 4px solid;
}
.score-badge .score-num { font-size: 40px; font-weight: 800; line-height: 1; }
.score-badge .score-unit { font-size: 13px; opacity: 0.7; margin-top: 2px; }

.score-good { color: var(--x); border-color: var(--x); background: var(--x-bg); }
.score-mid  { color: var(--y); border-color: var(--y); background: var(--y-bg); }
.score-bad  { color: var(--o); border-color: var(--o); background: var(--o-bg); }

.score-headline { font-size: 17px; font-weight: 700; color: var(--text-primary); }
.score-sub { font-size: 14px; color: var(--text-secondary); margin-top: 4px; }

/* ============================ Stat pills ============================ */
.stat-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

.pill {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid var(--border);
}
.pill-muted { background: var(--bg-subtle); color: var(--text-secondary); font-weight: 500; }

/* ============================ Issues ============================ */
.issue-list { display: flex; flex-direction: column; gap: 10px; }

.issue {
  border: 1px solid var(--border);
  border-left: 4px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  background: var(--bg-inset);
}
.issue-error { border-left-color: var(--o); }
.issue-warning { border-left-color: var(--y); }
.issue-info { border-left-color: var(--x); }

.issue-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.issue-cat {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-subtle);
  padding: 2px 8px;
  border-radius: 6px;
}
.issue-title { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.issue-loc { font-size: 12px; color: var(--text-muted); margin-left: auto; }
.issue-detail { font-size: 13px; color: var(--text-secondary); margin-top: 8px; line-height: 1.55; }

/* ============================ Callout / Terms ============================ */
.callout {
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  font-size: 14px;
  line-height: 1.7;
}
.callout > strong:first-child { display: block; margin-bottom: 6px; font-size: 13px; letter-spacing: 0.2px; }
.callout-warning {
  background: var(--y-bg);
  color: var(--y-fg);
  border: 1px solid var(--y-border);
}

.terms h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 22px 0 8px;
}
.terms h3:first-child { margin-top: 0; }
.terms p, .terms li { font-size: 14px; color: var(--text-secondary); line-height: 1.7; }
.terms ol, .terms ul { padding-left: 20px; }
.terms li { margin-bottom: 6px; }
.terms strong { color: var(--text-primary); }
.terms .terms-meta {
  margin-top: 22px;
  padding: 14px 16px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: var(--bg-subtle, transparent);
}
.terms .terms-meta > p { margin: 0 0 8px; font-size: 13px; }
.terms .terms-note {
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
}

/* ============================ Workspace ============================ */
.ws-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.segmented {
  display: inline-flex;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 3px;
}
.segmented .seg {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.segmented .seg:hover { color: var(--text-primary); }
.segmented .seg.active { background: var(--bg-surface); color: var(--primary); box-shadow: var(--shadow-sm); }

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

.ws-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.ws-pane {
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  min-height: var(--ws-h, 68vh); /* 풀스크린 모드가 --ws-h로 오버라이드 */
}

.ws-kbd-hint { display: inline-flex; align-items: center; font-size: 12px; color: var(--text-muted); margin-right: 4px; white-space: nowrap; }
/* 단축키 키캡 칩 — 보이게 강조 + 상하 중심 정렬 */
.ws-shortcut { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-secondary); white-space: nowrap; margin-right: 2px; }
.ws-shortcut kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 6px;
  font-family: inherit; font-size: 11px; font-weight: 700; line-height: 1;
  color: var(--text-primary); background: var(--bg-subtle);
  border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 5px;
}
.proj-select { max-width: 200px; padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-inset); color: var(--text-primary); font-size: 13px; font-family: inherit; }
.proj-select:focus { outline: none; border-color: var(--primary); }
@media (max-width: 640px) { .ws-kbd-hint { display: none; } }
.ws-pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  background: var(--bg-subtle);
}
.ws-hint { font-size: 12px; font-weight: 500; color: var(--text-muted); }
/* 수정본 다운로드(TXT/Word) — 우측 패널 헤더 */
.ws-dl { display: inline-flex; align-items: center; gap: 5px; margin-left: auto; }
.ws-dl-label { font-size: 11px; font-weight: 500; color: var(--text-muted); }
.ws-dl-btn {
  border: 1px solid var(--border); background: var(--bg-surface); color: var(--text-secondary);
  font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 5px; cursor: pointer;
}
.ws-dl-btn:hover { border-color: var(--primary); color: var(--primary); }

.ws-textarea {
  flex: 1;
  border: none;
  resize: none;
  padding: 16px;
  background: var(--bg-surface);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.7;
}
.ws-textarea:focus { outline: none; }

.ws-output {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}
.ws-placeholder {
  color: var(--text-muted);
  font-size: 14px;
  text-align: center;
  padding: 48px 16px;
}

.ws-score-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

/* normalize (일괄수정) */
.nz-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.nz-toggle { display: inline-flex; background: var(--bg-subtle); border: 1px solid var(--border); border-radius: 6px; padding: 2px; }
.nz-tab { border: none; background: transparent; color: var(--text-secondary); font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 5px; cursor: pointer; }
.nz-tab.active { background: var(--bg-surface); color: var(--primary); }
.nz-btns { display: flex; gap: 6px; }
.nz-view { font-size: 14px; line-height: 1.8; white-space: pre-wrap; word-break: break-word; }
.nz-plain { font-family: inherit; margin: 0; }
.nz-diff ins { background: rgba(42,157,99,0.18); color: var(--x-fg); text-decoration: none; border-radius: 3px; }
.nz-diff del { background: rgba(229,72,77,0.16); color: var(--o-fg); border-radius: 3px; }

/* compare (1:1 비교) */
.cmp-legend { font-size: 12px; color: var(--text-muted); margin-bottom: 12px; }
.cmp-legend .cmp-del { background: rgba(229,72,77,0.16); color: var(--o-fg); padding: 1px 6px; border-radius: 3px; }
.cmp-legend .cmp-ins { background: rgba(42,157,99,0.18); color: var(--x-fg); padding: 1px 6px; border-radius: 3px; }
.cmp-row { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 10px; background: var(--bg-inset); }
.cmp-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.cmp-row .nz-diff { font-size: 13px; }

/* compare method guide */
.cmp-guide {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 14px; margin-bottom: 14px;
  background: var(--primary-soft); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.cmp-guide-title { font-size: 13px; font-weight: 700; color: var(--text-primary); }
.cmp-guide-desc { font-size: 12px; color: var(--text-secondary); }
.segmented-sm .cseg {
  border: none; background: transparent; color: var(--text-secondary);
  font-size: 13px; font-weight: 600; padding: 5px 12px; border-radius: 6px; cursor: pointer;
}
.segmented-sm { background: var(--bg-surface); border: 1px solid var(--border); border-radius: 6px; padding: 2px; display: inline-flex; gap: 2px; }
.segmented-sm .cseg.active { background: var(--primary); color: var(--primary-contrast); }

.cmp-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cmp-side { font-size: 13px; color: var(--text-secondary); line-height: 1.55; }
.cmp-tag { display: inline-block; font-size: 11px; font-weight: 700; color: var(--primary); background: var(--primary-soft); border-radius: 4px; padding: 0 5px; margin-right: 4px; }
.cmp-only { margin-top: 8px; font-size: 12.5px; color: var(--text-secondary); }
@media (max-width: 640px) { .cmp-pair { grid-template-columns: 1fr; } }

/* normalize instruction bar */
.nz-instruction {
  flex: 1; min-width: 200px; padding: 7px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-surface); color: var(--text-primary); font-size: 13px; font-family: inherit;
}
.nz-instruction:focus { outline: none; border-color: var(--primary); }
.nz-presets { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.nz-preset {
  border: 1px solid var(--border); background: var(--bg-surface); color: var(--text-secondary);
  font-size: 12px; padding: 5px 10px; border-radius: 999px; cursor: pointer;
}
.nz-preset:hover { color: var(--primary); border-color: var(--primary); }

/* 기재불비 전체 문서 편집 */
.ws-fix { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 14px; }
.ws-fix-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; font-size: 13px; font-weight: 600; }
.ws-fix-hint { font-weight: 400; font-size: 12px; color: var(--text-muted); }
.ws-fixdoc {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-inset); color: var(--text-primary);
  padding: 14px; font-size: 14px; line-height: 1.9; white-space: pre-wrap; word-break: break-word;
  min-height: 200px; max-height: 50vh; overflow-y: auto;
}
.ws-fixdoc:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
.ws-err { color: #e5484d; background: rgba(229,72,77,0.12); font-weight: 700; border-radius: 3px; padding: 0 2px; }
[data-theme="dark"] .ws-err { color: #ff8a8d; }

/* 지적사항/클레임차트 토글 */
.chk-tabs { display: inline-flex; gap: 2px; background: var(--bg-subtle); border: 1px solid var(--border); border-radius: 6px; padding: 2px; margin-bottom: 14px; }
.chk-tab { border: none; background: transparent; color: var(--text-secondary); font-size: 13px; font-weight: 600; padding: 5px 12px; border-radius: 5px; cursor: pointer; }
.chk-tab.active { background: var(--bg-surface); color: var(--primary); box-shadow: var(--shadow-sm); }

/* 클레임 차트 */
.clchart { display: flex; flex-direction: column; gap: 14px; }
.clc-claim { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.clc-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px; background: var(--bg-subtle); border-bottom: 1px solid var(--border); }
.clc-num { font-weight: 700; font-size: 14px; color: var(--text-primary); }
.clc-refs { font-size: 12px; color: var(--text-muted); }
.clc-table { width: 100%; border-collapse: collapse; }
.clc-table td { border-bottom: 1px solid var(--border); padding: 8px 12px; font-size: 13px; line-height: 1.6; vertical-align: top; }
.clc-table tr:last-child td { border-bottom: none; }
.clc-idx { width: 34px; text-align: center; color: var(--text-muted); font-weight: 600; background: var(--bg-inset); }
.clc-el { color: var(--text-primary); word-break: break-word; }

@media (max-width: 820px) {
  .ws-split { grid-template-columns: 1fr; }
  .ws-pane { min-height: 300px; }
}

/* ============================ AI Chat ============================ */
.chat-fab {
  position: fixed; right: 24px; bottom: 24px; z-index: 200;
  width: 54px; height: 54px; border-radius: 50%;
  border: none; cursor: pointer; font-size: 22px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: var(--primary-contrast); box-shadow: var(--shadow-lg);
  transition: transform 0.15s;
}
.chat-fab:hover { transform: scale(1.06); }

.chat-drawer {
  position: fixed; right: 24px; bottom: 90px; z-index: 200;
  width: 400px; max-width: calc(100vw - 32px);
  height: 560px; max-height: calc(100vh - 130px);
  display: flex; flex-direction: column;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  transform: translateY(12px) scale(0.98); opacity: 0; pointer-events: none;
  transition: transform 0.18s, opacity 0.18s;
}
.chat-drawer.open { transform: none; opacity: 1; pointer-events: auto; }

.chat-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  font-weight: 600; font-size: 14px;
}
.chat-close { background: none; border: none; font-size: 22px; line-height: 1; color: var(--text-muted); cursor: pointer; }
.chat-head-right { display: flex; align-items: center; gap: 8px; }
#auto-seg .aseg { border: none; background: transparent; color: var(--text-secondary); font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 5px; cursor: pointer; }
#auto-seg .aseg.active { background: var(--primary); color: var(--primary-contrast); }
.chat-state { padding: 6px 14px; font-size: 12px; color: var(--text-secondary); background: var(--bg-inset); border-bottom: 1px solid var(--border); }
.chat-proposal { margin: 6px 0; padding: 8px 10px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: 6px; font-size: 12px; white-space: pre-wrap; max-height: 160px; overflow-y: auto; color: var(--text-primary); }
.chat-approve-row { display: flex; gap: 6px; }
.chat-approved { color: var(--x-fg); font-weight: 600; }
.chat-rejected { color: var(--text-muted); }

.chat-msgs { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
/* 메시지가 적을 때 위로 뜨지 않고 아래에서부터 쌓이게(메신저식). 넘치면 auto가 0으로 접혀 스크롤 정상. */
.chat-msgs > :first-child { margin-top: auto; }
/* 응답 대기 중 빈 말풍선 대신 타이핑 인디케이터(···) */
.chat-typing { display: inline-flex; gap: 4px; align-items: center; padding: 2px 0; }
.chat-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--text-muted); opacity: .35; animation: chat-typing-blink 1.2s infinite both; }
.chat-typing i:nth-child(2) { animation-delay: .2s; }
.chat-typing i:nth-child(3) { animation-delay: .4s; }
@keyframes chat-typing-blink { 0%, 60%, 100% { opacity: .25; } 30% { opacity: .9; } }
/* Todo 계획 패널(에이전트 자동작성 하네스) */
.todo-panel { align-self: stretch; border: 1px solid var(--border); border-radius: 10px; padding: 8px 11px; background: var(--bg-subtle); font-size: 12.5px; }
.todo-head { font-weight: 600; margin-bottom: 6px; color: var(--text-secondary); }
.todo-item { display: flex; align-items: baseline; gap: 6px; padding: 3px 0; }
.todo-item.done .todo-title { color: var(--text-muted); text-decoration: line-through; }
.todo-item.running .todo-title { font-weight: 600; }
.todo-st { flex: none; }
.todo-title { color: var(--text-primary); }
.todo-sum { color: var(--text-muted); font-size: 11.5px; }
/* 서브에이전트 항목(인라인 확장 스트림) */
.sub-item { border-top: 1px solid var(--border); padding: 4px 0; }
.sub-item > summary { cursor: pointer; list-style: none; display: flex; gap: 6px; align-items: baseline; font-weight: 500; }
.sub-item > summary::-webkit-details-marker { display: none; }
.sub-body { margin: 6px 0 2px; padding: 7px 9px; background: var(--bg-inset); border-radius: 6px; font-size: 12px; color: var(--text-secondary); white-space: pre-wrap; max-height: 220px; overflow-y: auto; }
.chat-hint { color: var(--text-muted); font-size: 13px; text-align: center; padding: 24px 8px; line-height: 1.6; }

.chat-msg { display: flex; }
.chat-user { justify-content: flex-end; }
.chat-bubble {
  max-width: 88%; padding: 9px 13px; border-radius: 12px;
  font-size: 13.5px; line-height: 1.6; white-space: pre-wrap; word-break: break-word;
}
.chat-bubble strong { font-weight: 700; }
.chat-body code, .chat-reason-body code, .sub-body code { background: var(--bg-inset); padding: 1px 5px; border-radius: 4px; font-size: .9em; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.chat-user .chat-bubble { background: var(--primary); color: var(--primary-contrast); border-bottom-right-radius: 4px; }
.chat-assistant .chat-bubble { background: var(--bg-subtle); color: var(--text-primary); border: 1px solid var(--border); border-bottom-left-radius: 4px; }

.chat-reason { margin-bottom: 6px; }
.chat-reason summary { cursor: pointer; font-size: 12px; color: var(--text-muted); }
.chat-reason-body { margin-top: 6px; padding: 8px 10px; background: var(--bg-inset); border-radius: 6px;
  font-size: 12px; color: var(--text-secondary); white-space: pre-wrap; max-height: 200px; overflow-y: auto; }

.chat-edit-note {
  margin-top: 8px; font-size: 12px; color: var(--x-fg);
  background: var(--x-bg); border: 1px solid var(--x-border);
  padding: 6px 10px; border-radius: 6px;
}
.chat-undo { margin-left: 6px; background: none; border: none; color: var(--primary); cursor: pointer; font-size: 12px; text-decoration: underline; }

/* 모드 전환 승인 — 녹색 카드 대신 작고 눈에 띄지 않는 단일 버튼 */
.chat-mode-row { margin-top: 6px; }
.chat-mode-btn {
  background: none; border: none; padding: 2px 0; cursor: pointer;
  color: var(--text-muted); font-size: 12px; font-family: inherit;
  text-decoration: underline; text-underline-offset: 2px;
}
.chat-mode-btn:hover { color: var(--primary); }
.chat-mode-done { font-size: 12px; color: var(--text-muted); }

/* 기재불비 진단 오버레이 — 단일 캔버스 통합(진단→문단타겟 수정) */
.chat-check-report { align-self: stretch; margin-top: 8px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-subtle); overflow: hidden; }
.ck-head { padding: 8px 11px; font-size: 12.5px; font-weight: 600; color: var(--text-primary); border-bottom: 1px solid var(--border); }
.ck-counts { font-weight: 400; color: var(--text-muted); margin-left: 4px; }
.ck-empty { padding: 10px 11px; font-size: 12.5px; color: var(--text-muted); }
.ck-list { max-height: 300px; overflow-y: auto; }
.ck-item { padding: 7px 11px; border-bottom: 1px solid var(--border); }
.ck-item:last-child { border-bottom: none; }
.ck-item.ck-error { border-left: 3px solid var(--x-fg, #e5484d); }
.ck-item.ck-warning { border-left: 3px solid #d9a400; }
.ck-item.ck-info { border-left: 3px solid var(--primary); }
.ck-row { display: flex; align-items: center; gap: 6px; }
.ck-sev { font-size: 10px; }
.ck-loc { font-size: 11px; color: var(--text-muted); background: var(--bg-inset); padding: 1px 6px; border-radius: 4px; white-space: nowrap; }
.ck-title { font-size: 12.5px; color: var(--text-primary); flex: 1; }
.ck-fix { flex: none; background: none; border: 1px solid var(--border); border-radius: 6px; padding: 2px 8px; cursor: pointer; color: var(--primary); font-size: 11.5px; font-family: inherit; }
.ck-fix:hover { background: var(--bg-inset); }
.ck-detail { margin: 3px 0 0 16px; font-size: 11.5px; color: var(--text-muted); line-height: 1.4; }
.ck-actions { padding: 8px 11px; border-top: 1px solid var(--border); text-align: right; }

.chat-input { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); }
.chat-input textarea {
  flex: 1; resize: none; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 8px 10px; background: var(--bg-inset); color: var(--text-primary);
  font-family: inherit; font-size: 13.5px;
}
.chat-input textarea:focus { outline: none; border-color: var(--primary); }

@media (max-width: 520px) {
  .chat-drawer { right: 8px; left: 8px; width: auto; bottom: 84px; }
}

/* ============================ Auth ============================ */
.auth-card { max-width: 420px; margin: 0 auto; }
.auth-perks { list-style: none; margin: 0 0 18px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px;
  background: var(--accent-soft); border-radius: var(--radius-sm, 8px); font-size: 13px; color: var(--text-secondary); }
.auth-perks li { position: relative; padding-left: 18px; }
.auth-perks li::before { content: "◈"; position: absolute; left: 0; color: var(--gold); font-size: 11px; top: 1px; }
.auth-perks strong { color: var(--accent); }
.auth-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-secondary); margin: 14px 0 6px; }
.auth-label .auth-hint { font-weight: 400; color: var(--text-muted); }
.auth-input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--bg-inset); color: var(--text-primary);
  font-size: 14px; font-family: inherit;
}
.auth-input:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
.auth-alt { margin-top: 16px; font-size: 13px; color: var(--text-secondary); text-align: center; }
.auth-alt a, .auth-note a { color: var(--primary); text-decoration: none; }
.auth-note { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-muted); }
/* 구글 로그인 — 폼과 소셜 버튼 사이 구분선 + 브랜드 버튼 */
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--text-muted); font-size: 12px; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.btn-google {
  width: 100%; justify-content: center; gap: 10px;
  background: var(--bg-inset); color: var(--text-primary);
  border: 1px solid var(--border-strong); font-weight: 600;
}
.btn-google:hover { background: var(--bg-hover); }
.btn-google svg { flex: none; }
.nav-user { font-size: 13px; font-weight: 600; color: var(--text-primary); padding: 0 4px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 크레딧 잔량 배지(권한 2단계) — 로그인·익명 공통, /api/quota 로 채워 표시. */
.credit-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600;
  color: var(--accent); background: var(--accent-soft); border: 1px solid transparent;
  border-radius: 999px; padding: 3px 10px; text-decoration: none; white-space: nowrap; line-height: 1.4; }
.credit-badge:hover { border-color: var(--accent); }
.credit-badge-icon { color: var(--gold); font-size: 11px; }
.credit-badge-low { color: var(--warning); background: transparent; border-color: var(--warning); }
.credit-badge-low .credit-badge-icon { color: var(--warning); }

/* ============================ Responsive ============================ */
@media (max-width: 768px) {
  .navbar-inner { padding: 0 16px; }
  .brand-name { display: none; }
  .container { padding: 20px 16px; }
  .page-head { flex-direction: column; align-items: stretch; }
  .page-actions { flex-wrap: wrap; }
  .summary-cards { flex-direction: column; }
  th, td { padding: 10px 12px; font-size: 13px; }
}

/* AI 생성물 표시 (AI기본법 고지) */
.ai-badge {
  display: inline-block; margin: 0 0 12px;
  padding: 6px 12px; border-radius: var(--radius-sm);
  background: var(--primary-soft); color: var(--primary);
  border: 1px solid var(--border); font-size: 12.5px; font-weight: 600;
}

/* ============================================================
   모바일 가드 — 입력/편집 페이지는 좁은 화면에서 사용 제한
   ============================================================ */
.mobile-guard { display: none; }
.mobile-guard-card {
  max-width: 340px; margin: auto; text-align: center;
  padding: 32px 26px; background: var(--bg-surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
.mobile-guard-mark {
  width: 56px; height: 56px; margin: 0 auto 18px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 16px; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--primary));
}
.mobile-guard-card h2 { font-family: var(--font-display); font-size: 19px; font-weight: 600; margin-bottom: 10px; color: var(--ink); }
.mobile-guard-card p { font-size: 14px; color: var(--text-secondary); line-height: 1.7; margin-bottom: 22px; }
.mg-btn {
  display: inline-block; padding: 11px 20px; border-radius: var(--radius-md);
  background: var(--primary); color: var(--primary-contrast);
  text-decoration: none; font-weight: 600; font-size: 14px;
}

@media (max-width: 820px) {
  body.guard-mobile .navbar,
  body.guard-mobile .container { display: none !important; }
  body.guard-mobile .mobile-guard {
    display: flex; position: fixed; inset: 0; z-index: 9999;
    padding: 24px; background: var(--bg-app);
  }
}

/* ============================================================
   반응형 앱 내비게이션
   ============================================================ */
@media (max-width: 720px) {
  .navbar-inner { padding: 0 14px; gap: 8px; }
  .nav-links { gap: 2px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .nav-links::-webkit-scrollbar { display: none; }
  .nav-link { padding: 8px 10px; font-size: 13.5px; white-space: nowrap; }
  .nav-user { display: none; }
  .container { padding-left: 14px; padding-right: 14px; }
  .page-head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .page-head h1 { font-size: 22px; }
}

/* ============================================================
   마케팅 레이아웃 (공개 사이트) — 모바일 완전 대응
   ============================================================ */
.mkt { --mkt-max: 1120px; }
.mkt-nav {
  position: sticky; top: 0; z-index: 100; height: var(--nav-h);
  background: color-mix(in srgb, var(--bg-surface) 82%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.mkt-nav-inner {
  max-width: var(--mkt-max); height: 100%; margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.mkt-nav-links { display: flex; align-items: center; gap: 6px; }
.mkt-nav-links a {
  text-decoration: none; color: var(--text-secondary); font-weight: 500;
  font-size: 14.5px; padding: 8px 12px; border-radius: var(--radius-sm);
}
.mkt-nav-links a:hover { color: var(--text-primary); background: var(--bg-hover); }
/* nav 링크 규칙이 CTA 색을 덮지 않도록 특정성 보강 */
.mkt-nav-links a.btn-cta { color: var(--primary-contrast); }
.mkt-nav-links a.btn-cta:hover { color: var(--primary-contrast); background: var(--primary); }
.mkt-menu-toggle { display: none; background: none; border: 0; cursor: pointer; padding: 8px; color: var(--text-primary); }

.btn-cta {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: var(--radius-md); border: 0; cursor: pointer;
  background: var(--primary); color: var(--primary-contrast);
  font-weight: 700; font-size: 14.5px; text-decoration: none;
  box-shadow: var(--shadow-sm); transition: transform .12s ease, box-shadow .12s ease;
}
.btn-cta:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-ghost {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 18px; border-radius: var(--radius-md);
  background: transparent; color: var(--text-primary);
  border: 1px solid var(--border-strong); font-weight: 600; font-size: 14.5px; text-decoration: none;
}
.btn-ghost:hover { background: var(--bg-hover); }

.mkt-section { max-width: var(--mkt-max); margin: 0 auto; padding: 88px 24px; }
.mkt-section.tight { padding: 56px 24px; }
.mkt-eyebrow {
  display: inline-block; font-size: 12.5px; font-weight: 700; letter-spacing: .09em;
  text-transform: uppercase; color: var(--accent); margin-bottom: 14px;
}
.mkt-h2 { font-family: var(--font-display); font-size: clamp(26px, 4vw, 38px); font-weight: 600; letter-spacing: -0.01em; line-height: 1.25; color: var(--ink); word-break: keep-all; }
.mkt-lead { font-size: 17px; color: var(--text-secondary); max-width: 640px; margin-top: 14px; line-height: 1.7; }

/* 히어로 */
.hero {
  position: relative; overflow: hidden;
  background:
    radial-gradient(1000px 500px at 80% -10%, var(--accent-soft), transparent 60%),
    linear-gradient(180deg, var(--bg-surface), var(--bg-app));
  border-bottom: 1px solid var(--border);
}
.hero-inner {
  max-width: var(--mkt-max); margin: 0 auto; padding: 84px 24px 72px;
  display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 56px; align-items: center;
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 13px;
  border-radius: 999px; background: var(--primary-soft); color: var(--primary);
  font-size: 13px; font-weight: 600; border: 1px solid var(--border); margin-bottom: 22px;
}
.hero h1 { font-family: var(--font-display); font-size: clamp(32px, 5vw, 52px); font-weight: 600; letter-spacing: -0.015em; line-height: 1.18; color: var(--ink); word-break: keep-all; }
.hero h1 .grad { background: linear-gradient(90deg, var(--primary), var(--gold)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.hero p.sub { font-size: 18px; color: var(--text-secondary); margin: 22px 0 30px; line-height: 1.65; max-width: 520px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-trust { margin-top: 26px; font-size: 13.5px; color: var(--text-muted); }
.hero-visual {
  border-radius: var(--radius-xl); border: 1px solid var(--border);
  background: var(--bg-surface); box-shadow: var(--shadow-lg); overflow: hidden;
  aspect-ratio: 4/3; display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 14px;
}

/* 히어로 우측: /app 진입 대형 클릭 패널 */
.hero-entry {
  flex-direction: column; gap: 6px; text-decoration: none; text-align: center;
  padding: 32px; cursor: pointer;
  background:
    radial-gradient(600px 300px at 50% -20%, var(--accent-soft), transparent 70%),
    linear-gradient(160deg, var(--bg-surface), var(--primary-soft));
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.hero-entry:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg), 0 0 0 4px var(--accent-soft); border-color: var(--accent); }
.hero-entry-icon {
  width: 68px; height: 68px; border-radius: 20px; margin-bottom: 6px;
  display: flex; align-items: center; justify-content: center; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--primary)); box-shadow: var(--shadow-md);
  font-size: 30px;
}
.hero-entry-title { font-family: var(--font-display); font-size: 24px; font-weight: 600; color: var(--ink); letter-spacing: -0.01em; }
.hero-entry-sub { font-size: 14px; color: var(--text-secondary); max-width: 280px; line-height: 1.5; word-break: keep-all; }
.hero-entry-go {
  margin-top: 14px; display: inline-flex; align-items: center; gap: 6px;
  padding: 11px 22px; border-radius: var(--radius-md);
  background: var(--primary); color: var(--primary-contrast);
  font-weight: 700; font-size: 15px; box-shadow: var(--shadow-sm);
}
.hero-entry:hover .hero-entry-go { background: var(--primary-dark); }

/* 신뢰 바 */
.trust-bar { border-bottom: 1px solid var(--border); background: var(--bg-surface); }
.trust-bar-inner {
  max-width: var(--mkt-max); margin: 0 auto; padding: 22px 24px;
  display: flex; flex-wrap: wrap; gap: 14px 34px; align-items: center; justify-content: center;
  font-size: 14px; color: var(--text-secondary);
}
.trust-bar-inner span { display: inline-flex; align-items: center; gap: 8px; }

/* 카드 그리드 (3기둥/기능) */
.card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 40px; }
.card-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }  /* 4기둥은 2+2 배열 */
.pillar-card {
  padding: 28px 24px; border-radius: var(--radius-lg);
  background: var(--bg-surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-sm); transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
  text-decoration: none; display: block;
}
.pillar-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.pillar-ico {
  width: 46px; height: 46px; border-radius: 13px; margin-bottom: 16px;
  display: flex; align-items: center; justify-content: center; font-size: 22px;
  background: var(--accent-soft); color: var(--primary);
}
.pillar-card h3 { font-family: var(--font-display); font-weight: 600; font-size: 19px; color: var(--ink); margin-bottom: 8px; }
.pillar-card p { font-size: 14.5px; color: var(--text-secondary); line-height: 1.65; }
.pillar-more { display: inline-block; margin-top: 14px; color: var(--accent); font-weight: 600; font-size: 14px; }
/* 도면 제작 = 핵심 유료 제품(대시보드 히어로 카드) */
.pillar-hero { position: relative; border-color: var(--accent); border-width: 1.5px;
  background: linear-gradient(135deg, var(--accent-soft), var(--bg-surface) 60%); }
.pillar-hero .pillar-ico { background: var(--accent); color: var(--primary-contrast); }
.pillar-hero h3 { font-size: 22px; }
.pillar-badge { position: absolute; top: 18px; right: 20px; font-size: 12px; font-weight: 700;
  letter-spacing: .04em; color: var(--primary-contrast); background: var(--accent); padding: 3px 10px; border-radius: 999px; }

/* 문제 제기 / 스텝 */
.feature-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; margin-top: 36px; }
.feature-item { padding: 22px; border-radius: var(--radius-md); background: var(--bg-subtle); border: 1px solid var(--border); }
.feature-item h4 { font-size: 16px; margin-bottom: 8px; color: var(--text-primary); }
.feature-item p { font-size: 14px; color: var(--text-secondary); line-height: 1.6; }
.step-num { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; background: var(--primary); color: var(--primary-contrast); font-weight: 700; font-size: 14px; margin-bottom: 12px; }

/* CTA 밴드 */
.cta-band {
  background: linear-gradient(135deg, #16352A, #1E3A2F 55%, #24523F);
  color: #fff; border-radius: var(--radius-xl); text-align: center;
  border: 1px solid rgba(176,138,62,0.45);
  padding: 56px 32px; max-width: var(--mkt-max); margin: 40px auto; position: relative; overflow: hidden;
}
.cta-band h2 { font-family: var(--font-display); font-size: clamp(24px, 3.5vw, 34px); font-weight: 600; margin-bottom: 12px; }
.cta-band p { opacity: .88; font-size: 16px; margin-bottom: 26px; }
.waitlist-form { display: flex; gap: 10px; max-width: 460px; margin: 0 auto; flex-wrap: wrap; }
.waitlist-form input[type=email] {
  flex: 1; min-width: 220px; padding: 13px 16px; border-radius: var(--radius-md);
  border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.12);
  color: #fff; font-size: 15px;
}
.waitlist-form input[type=email]::placeholder { color: rgba(255,255,255,.6); }
.waitlist-form button {
  /* cta-band는 라이트/다크 공통 리터럴 딥그린 — 버튼도 리터럴로 대비 고정 */
  padding: 13px 22px; border-radius: var(--radius-md); border: 0; cursor: pointer;
  background: #fff; color: #1E3A2F; font-weight: 700; font-size: 15px;
}
.waitlist-note { font-size: 12.5px; opacity: .7; margin-top: 14px; }

/* FAQ */
.faq-list { max-width: 760px; margin: 36px auto 0; }
.faq-item { border-bottom: 1px solid var(--border); }
.faq-item summary { padding: 20px 4px; cursor: pointer; font-weight: 600; font-size: 16px; color: var(--text-primary); list-style: none; display: flex; justify-content: space-between; gap: 16px; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: '+'; color: var(--text-muted); font-weight: 400; }
.faq-item[open] summary::after { content: '−'; }
.faq-item p { padding: 0 4px 20px; color: var(--text-secondary); font-size: 14.5px; line-height: 1.7; }

/* 마케팅 푸터 */
.mkt-footer { border-top: 1px solid var(--border); background: var(--bg-surface); margin-top: 40px; }
.mkt-footer-inner { max-width: var(--mkt-max); margin: 0 auto; padding: 48px 24px 36px; display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 32px; }
.mkt-footer h5 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); margin-bottom: 14px; }
.mkt-footer a { display: block; color: var(--text-secondary); text-decoration: none; font-size: 14px; padding: 5px 0; }
.mkt-footer a:hover { color: var(--text-primary); }
.mkt-footer-legal { max-width: var(--mkt-max); margin: 0 auto; padding: 20px 24px 40px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--text-muted); line-height: 1.7; }

/* 마케팅 반응형 */
@media (max-width: 900px) {
  .hero-inner { grid-template-columns: 1fr; gap: 36px; padding: 60px 20px 52px; }
  .hero-visual { order: -1; aspect-ratio: 16/10; }
  .card-grid, .feature-row { grid-template-columns: 1fr; }
  .mkt-footer-inner { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .mkt-nav-links { display: none; }
  .mkt-nav-links.open {
    display: flex; position: absolute; top: var(--nav-h); left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 2px; padding: 12px 16px;
    background: var(--bg-surface); border-bottom: 1px solid var(--border); box-shadow: var(--shadow-md);
  }
  .mkt-menu-toggle { display: inline-flex; }
  .mkt-section { padding: 56px 20px; }
  .mkt-footer-inner { grid-template-columns: 1fr; gap: 24px; }
  .waitlist-form { flex-direction: column; }
  .waitlist-form input[type=email], .waitlist-form button { width: 100%; }
}

/* 마케팅 폼 입력 */
.input, form label > .input {
  width: 100%; padding: 10px 13px; margin-top: 6px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--bg-inset); color: var(--text-primary);
  font-size: 14.5px; font-family: inherit;
}
.input:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
form label { font-size: 13.5px; font-weight: 600; color: var(--text-secondary); }
@media (max-width: 640px) { #contact-form > div { grid-template-columns: 1fr !important; } }

/* 상담(support) 챗봇 fab — 마케팅 페이지 강조 */
.chat-fab-accent { background: linear-gradient(135deg, var(--accent), var(--primary)); }
.chat-fab-accent::after {
  content: ''; position: absolute; top: 8px; right: 8px;
  width: 11px; height: 11px; border-radius: 50%;
  background: #22c55e; border: 2px solid #fff;
}
.chat-fab { position: fixed; }

/* 챗 헤더 대화 초기화 버튼 */
.chat-reset { background: none; border: none; font-size: 17px; line-height: 1; color: var(--text-muted); cursor: pointer; margin-right: 2px; }
.chat-reset:hover { color: var(--text-primary); }
.chat-head-right { display: inline-flex; align-items: center; gap: 6px; }

/* ============================================================
   실무 어시스턴트 — 도킹 사이드 패널 (FHD ≥1600px)
   · 상담(마케팅) 위젯은 dock 미사용이라 영향 없음
   ============================================================ */
/* 실무 페이지 본문 폭 언캡(FHD 여백 활용) + 부드러운 밀림 */
body.app-wide .container { max-width: none; transition: padding-right .2s ease; }
/* 도킹 중 앱 navbar 고정 → 레일 top 기준(60px) 유지 */
body.app-wide.chat-docked .navbar { position: sticky; top: 0; }

@media (min-width: 1600px) {
  /* 우측 풀하이트 레일 */
  .chat-drawer.dock-right {
    top: var(--nav-h); bottom: 0; right: 0;
    width: 440px; height: auto; max-height: none;
    border: none; border-left: 1px solid var(--border);
    border-radius: 0; box-shadow: -8px 0 24px rgba(30,58,47,0.07);
    transform: none;
  }
  .chat-drawer.dock-right.open { transform: none; }
  /* 열림 시 본문을 왼쪽으로 밀어 겹침 방지(레일폭 440 + 여백 24) */
  body.chat-docked .container { padding-right: 464px; }
  /* 레일이 이미 보이므로 fab 숨김 */
  body.chat-docked .chat-fab { display: none; }
  /* 도킹은 높으니 편집 제안 미리보기 더 크게 */
  .chat-drawer.dock-right .chat-proposal { max-height: 360px; }
}
/* 1600px 미만: 도킹 해제 → 기본 플로팅 드로어로 폴백(자동) */

/* 챗 헤더 아이콘 버튼(지우기·접기·닫기) — SVG 기준 정리 */
.chat-reset, .chat-close {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; padding: 0; border: none; background: none;
  border-radius: 7px; color: var(--text-muted); cursor: pointer;
  transition: background .12s, color .12s;
}
.chat-reset:hover, .chat-close:hover { background: var(--bg-hover); color: var(--text-primary); }
.chat-reset svg, .chat-close svg { display: block; }
.chat-head-right { display: inline-flex; align-items: center; gap: 4px; }

/* app-wide: navbar도 본문처럼 풀폭 → 브랜드는 화면 좌측, 메뉴는 우측 끝(리사이즈에 반응) */
body.app-wide .navbar-inner { max-width: none; }
/* 도킹 중엔 메뉴를 본문과 같은 폭으로 정렬(패널 자리 예약) */
@media (min-width: 1600px) {
  body.app-wide.chat-docked .navbar-inner { padding-right: 464px; }
}
.chat-proposal { white-space: pre-wrap; word-break: break-word; max-height: 260px; overflow-y: auto; margin: 6px 0; padding: 8px 10px; background: var(--bg-inset); border-radius: 6px; font-size: 12px; }
.chat-proposal.live { border-left: 2px solid var(--primary); }
.draft-nav-sec { font-weight: 600; color: var(--text-primary); margin-top: 4px; }
.ws-edit-live { white-space: pre-wrap; word-break: break-word; margin: 0; padding: 4px; font: inherit; font-size: 13.5px; line-height: 1.7; }
/* 정지 버튼: workspace(#chat-send)와 공용 위젯(.chat-input 전송 버튼) 공통 — 감사 #5 */
#chat-send.is-stop, .chat-input .btn.is-stop { background: var(--o, #e5484d); border-color: var(--o, #e5484d); color: #fff; }
.chat-stopped { color: var(--text-muted); font-size: 12px; margin-top: 4px; }
/* 제안 미리보기 절단 안내(감사 #20) */
.chat-trunc { margin-top: 2px; font-size: 11.5px; color: var(--text-muted); }
/* 툴 실행 상태 한 줄(감사 #6) — 다음 콘텐츠 도착 시 프런트가 제거하는 임시 표시 */
.chat-tool-note { margin-top: 6px; font-size: 12px; color: var(--text-muted); }

/* ============================ 풀스크린(클라이언트 앱) 모드 ============================ */
/* base.html의 ⛶ 토글이 body.app-fullscreen을 걸고, localStorage 'drafters.fs.<pathname>'로 기억 */
.fs-toggle { font-size: 15px; margin-left: 4px; }
body.app-fullscreen .navbar,
body.app-fullscreen .page-head,
body.app-fullscreen footer { display: none; }
body.app-fullscreen .container { max-width: none; padding-top: 14px; }
/* 체크: 좌우 패널 높이(--ws-h)를 뷰포트 기준으로 */
body.app-fullscreen { --ws-h: calc(100vh - 96px); }
/* 스튜디오: CodeMirror 뷰포트 채움(기존 min-height:72vh 대체) */
body.app-fullscreen #editor,
body.app-fullscreen .cm-editor { min-height: calc(100vh - 130px); }
body.app-fullscreen .draft-nav { max-height: calc(100vh - 130px); }
/* 도면: iframe 뷰포트 채움 */
body.app-fullscreen.figures-shell .container { padding: 8px 10px 0; }
body.app-fullscreen .figures-frame { height: calc(100vh - 20px); border: none; border-radius: 0; }

/* 우상단 반투명 플로팅 컨트롤(홈 + ⛶ 해제) — 풀스크린 중 유일한 내비게이션 */
.fs-float {
  display: none;
  position: fixed; top: 10px; right: 14px; z-index: 400;
  gap: 8px;
}
body.app-fullscreen .fs-float { display: flex; }
.fs-exit {
  display: inline-flex;
  width: 38px; height: 38px; padding: 0;
  align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: 50%;
  background: color-mix(in srgb, var(--bg-surface) 72%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  color: var(--text-secondary); font-size: 15px; cursor: pointer;
  opacity: 0.55; transition: opacity 0.15s, transform 0.15s;
  text-decoration: none;
}
.fs-exit:hover { opacity: 1; transform: scale(1.06); color: var(--text-primary); }

/* ============================ 공용 토스트/스피너 (WP-11, ui.js) ============================ */
/* 우하단 스택 — 테마 변수 기반이라 라이트/다크 공통 */
#dr-toasts {
  position: fixed; right: 18px; bottom: 18px; z-index: 500;
  display: flex; flex-direction: column; gap: 8px;
  max-width: min(380px, calc(100vw - 36px));
}
.dr-toast {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 11px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: 13.5px; line-height: 1.5; color: var(--text-primary);
  animation: dr-toast-in 0.18s ease-out;
}
@keyframes dr-toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.dr-toast-out { opacity: 0; transform: translateY(6px); transition: opacity 0.22s, transform 0.22s; }
.dr-toast-err { border-color: var(--o-border); background: var(--o-bg); color: var(--o-fg); }
.dr-toast-ok { border-color: var(--x-border); background: var(--x-bg); color: var(--x-fg); }
.dr-toast-icon { flex-shrink: 0; font-size: 14px; line-height: 1.4; }
.dr-toast-body { flex: 1 1 auto; word-break: break-word; }
.dr-toast-action {
  flex-shrink: 0; align-self: center;
  padding: 4px 10px; border-radius: 999px;
  background: var(--primary); color: var(--primary-contrast);
  font-size: 12px; font-weight: 600; text-decoration: none; white-space: nowrap;
}
.dr-toast-action:hover { background: var(--primary-dark); }
.dr-toast-close {
  flex-shrink: 0; border: none; background: none; cursor: pointer;
  padding: 0 2px; font-size: 12px; line-height: 1.6; color: inherit; opacity: 0.55;
}
.dr-toast-close:hover { opacity: 1; }
.dr-toast-close:focus-visible, .dr-toast-action:focus-visible { outline: none; box-shadow: var(--ring); }

/* busyButton 스피너 */
.dr-spinner {
  display: inline-block; width: 13px; height: 13px;
  border: 2px solid currentColor; border-top-color: transparent;
  border-radius: 50%; vertical-align: -2px;
  animation: dr-spin 0.7s linear infinite;
}
@keyframes dr-spin { to { transform: rotate(360deg); } }

/* ============================ 상태 칩 (WP-11 P2-b) ============================ */
/* 이력 테이블 + WP-7 백그라운드 작업 섹션 공용 — 기존 .status-* 텍스트 색상 위에 칩 배경/테두리 */
.status-chip {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
}
.status-chip.status-completed { background: var(--x-bg); color: var(--x-fg); border-color: var(--x-border); }
.status-chip.status-failed { background: var(--o-bg); color: var(--o-fg); border-color: var(--o-border); animation: none; }
.status-chip.status-processing { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

/* ============================ 접근성: 포커스 가시성 (WP-11 P3) ============================ */
/* .btn 외의 아이콘/세그먼트/탭 버튼도 키보드 포커스가 보이도록 — 링 변수 공용 */
.tab:focus-visible, .seg:focus-visible, .cseg:focus-visible, .aseg:focus-visible,
.theme-toggle:focus-visible, .chat-fab:focus-visible, .nav-link:focus-visible,
.nz-preset:focus-visible, .nz-tab:focus-visible, .chk-tab:focus-visible,
.draft-nav-item:focus-visible, .ws-dl-btn:focus-visible, .remove-file:focus-visible,
.chat-reset:focus-visible, .chat-close:focus-visible, .fs-exit:focus-visible,
.tr-close:focus-visible, .ck-fix:focus-visible, .mg-btn:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

/* 진행/저장 상태 문구 공통 톤(WP-11 P3) — 자동 저장됨/처리 중/취소 안내 등 12px 뮤티드로 통일 */
.status-note { font-size: 12px; color: var(--text-muted); }

/* 기한 대시보드(P3) — 상태·D-day 뱃지. 색은 브랜드 토큰만 사용(다크 모드 자동 대응). */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px;
  font-weight: 600; line-height: 1.5; white-space: nowrap;
  background: var(--bg-subtle); color: var(--text-secondary); border: 1px solid var(--border);
}
.badge-proposed  { background: var(--accent-soft); color: var(--accent); border-color: var(--gold); }
.badge-confirmed { background: var(--gold-soft);   color: var(--text-primary); }
.badge-needs     { background: var(--accent-soft); color: var(--warning);  border-color: var(--warning); }
.badge-warn      { background: transparent;        color: var(--warning);  border-color: var(--warning); }
.badge-urgent    { background: var(--danger);      color: #fff;            border-color: var(--danger); }
.badge-done      { color: var(--text-muted); }
.docket-actions form { display: inline-flex; gap: 4px; align-items: center; margin: 2px 4px 2px 0; }

/* ============================ 사무소·운영 공용 컴포넌트 ============================
   admin.html 로컬 <style> 에서 승격 — cases/clients/docket/invoices/import/_efiling 등
   10여 화면이 같은 어휘(adm-*)를 쓰므로 시스템 클래스로 올린다. 색은 전부 토큰만. */

/* 표 — 전역 table(width:100%)은 열이 많으면 셀을 찌그러뜨린다.
   min-width 를 줘야 .table-container 의 overflow-x 가 실제로 스크롤된다. */
.adm-table { min-width: 100%; width: max-content; }
.adm-table th, .adm-table td { padding: 10px 14px; white-space: nowrap; vertical-align: middle; }
.adm-table td.adm-wrap { white-space: normal; min-width: 280px; }
.adm-num { text-align: right; font-variant-numeric: tabular-nums; }

/* tbody 안의 행 머리글(<th>)은 헤더가 아니라 라벨 — 헤더 톤을 벗긴다. */
.adm-table tbody th {
  background: transparent; color: var(--text-primary);
  text-transform: none; letter-spacing: 0; font-size: 14px; font-weight: 600;
}
/* 합계 행만 헤더 톤 유지 */
.adm-table tbody tr.adm-total th { background: var(--bg-subtle); color: var(--text-secondary); }

/* 인라인 필터/등록 폼 공용 */
.adm-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.adm-field { display: flex; flex-direction: column; gap: 4px; }
.adm-field label { font-size: 12px; color: var(--text-secondary); }
.adm-form input:not([type="checkbox"]):not([type="radio"]),
.adm-form select, .adm-form textarea,
.adm-field input, .adm-field select,
.adm-table td > select {
  padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-inset); color: var(--text-primary); font-size: 14px; font-family: inherit;
}
.adm-form input:focus, .adm-form select:focus, .adm-form textarea:focus,
.adm-field input:focus, .adm-field select:focus, .adm-table td > select:focus {
  outline: none; border-color: var(--primary); box-shadow: var(--ring);
}
.adm-hint { font-size: 12px; color: var(--text-secondary); margin-top: 10px; line-height: 1.6; }
.save-nudge { padding: 8px 12px; background: var(--accent-soft); border-radius: var(--radius-sm, 8px); }
.save-nudge a { color: var(--accent); font-weight: 600; text-decoration: none; }
.save-nudge a:hover { text-decoration: underline; }

/* KPI 타일 — admin/jobs_admin/auto_spec_detail 공용 */
.adm-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.adm-kpi { padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-subtle); }
.adm-kpi-label { font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; }
.adm-kpi-value { font-size: 22px; font-weight: 700; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.adm-kpi-unit { font-size: 13px; font-weight: 500; color: var(--text-secondary); margin-left: 2px; }
.adm-kpi-note { font-size: 11px; color: var(--text-secondary); margin-top: 4px; }

/* 모노 ID(잡/토큰 앞 8자리 등) */
.adm-id { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--text-secondary); }

/* 표 셀 안 인라인 액션 폼 */
.inline-form { display: inline; }

/* 필수 입력 표시(*) */
.req { color: var(--danger); }

/* 접이식 카드 제목 + 한 카드 안 두 번째 섹션 제목 */
summary.card-title { cursor: pointer; }
.card .card-title:not(:first-child) { margin-top: 20px; }

/* ── 링크형 필터 세그먼트(.seg-tabs) — 기간/상태/지평 등 GET 필터 공용 패턴.
   버튼형 .segmented(JS 모드 전환)·.chk-tabs(패널 전환)와 같은 시각 문법의 <a> 판. ── */
.seg-tabs {
  display: inline-flex; gap: 2px; background: var(--bg-subtle);
  border: 1px solid var(--border); border-radius: 6px; padding: 2px; vertical-align: middle;
}
.seg-tabs a {
  text-decoration: none; color: var(--text-secondary); font-size: 13px; font-weight: 600;
  padding: 5px 12px; border-radius: 5px; white-space: nowrap;
}
.seg-tabs a:hover { color: var(--text-primary); }
.seg-tabs a.active { background: var(--bg-surface); color: var(--primary); box-shadow: var(--shadow-sm); }
.seg-tabs a:focus-visible { outline: none; box-shadow: var(--ring); }
.seg-label { font-size: 13px; color: var(--text-secondary); margin-right: 6px; }

/* 잡 상태 배지 — jobs_admin(.job-badge) / auto_spec(.as-badge, JS가 클래스명 갱신) /
   auto_spec_detail(.asd-badge) 공용 정의. 의미색: 실행=그린 / 완료=성공 / 실패=위험 / 취소=중립. */
.job-badge, .as-badge, .asd-badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 600; border: 1px solid var(--border);
}
.job-badge.queued, .as-badge.queued, .asd-badge.queued { border-color: var(--border-strong); color: var(--text-secondary); }
.job-badge.running, .as-badge.running, .asd-badge.running { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.job-badge.done, .as-badge.done, .asd-badge.done { border-color: var(--x-border); color: var(--x-fg); background: var(--x-bg); }
.job-badge.failed, .as-badge.failed, .asd-badge.failed { border-color: var(--o-border); color: var(--o-fg); background: var(--o-bg); }
.job-badge.cancelled, .as-badge.cancelled, .asd-badge.cancelled { border-color: var(--border-strong); color: var(--text-muted); }
/* 취소 '요청됨'은 실패가 아니라 진행 중 상태 — 빨강이 아니라 경고 톤 */
.job-badge.pending-cancel { border-color: var(--y-border); color: var(--y-fg); background: var(--y-bg); }
