/* ============================================================
   PHILOSOPHY AI GENSPIRE — 디자인 시스템 (마스터 프롬프트 3번)
   ============================================================ */
:root {
  /* 라이트 모드 */
  --bg: #F6F7FB;
  --workspace: #FFFFFF;
  --surface: #EEF1F7;
  --text: #181B24;
  --text-muted: #697184;
  --border: #E2E6EE;
  --primary: #695CFF;
  --secondary: #8C5EFF;
  --blue: #397CF6;
  --success: #16A36A;
  --warning: #F2A318;
  --danger: #E14D52;

  --radius-card: 16px;
  --radius-input: 26px;
  --sidebar-w: 74px;
  --sidebar-collapsed: 74px;
  --max-content: 1440px;
  --promo-blue: #2563EB;
  --promo-orange: #F97316;

  --shadow-sm: 0 1px 2px rgba(24, 27, 36, .05), 0 1px 3px rgba(24, 27, 36, .06);
  --shadow-md: 0 4px 16px rgba(24, 27, 36, .08);
  --shadow-lg: 0 12px 40px rgba(24, 27, 36, .12);
  --grad: linear-gradient(135deg, #695CFF 0%, #8C5EFF 55%, #397CF6 100%);
  /* 사이드바 무채색 팔레트 — ChatGPT 스타일 부드러운 연회색 톤 */
  --side-logo: #2E3038;
  --side-active-bg: #ECECEE;
  --side-active-fg: #2E3038;
  --side-icon: #9A9DA6;
  --side-text: #8B8E97;
  --side-hover-bg: #F4F4F5;
}

[data-theme="dark"] {
  --bg: #0F1118;
  --workspace: #171A23;
  --surface: #1D212D;
  --text: #F5F6F8;
  --text-muted: #A9B0BF;
  --border: #303544;
  --primary: #8880FF;
  --secondary: #8C5EFF;
  --blue: #5B92F7;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow-md: 0 4px 16px rgba(0,0,0,.45);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.55);
  /* 사이드바 무채색(다크 모드) — 부드러운 연회색 톤 */
  --side-logo: #C7CAD1;
  --side-active-bg: #2A2E39;
  --side-active-fg: #ECEDF0;
  --side-icon: #7C8090;
  --side-text: #8A8E9B;
  --side-hover-bg: #21252F;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Pretendard Variable", Pretendard, "SUIT Variable", Inter, "Noto Sans KR", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background .3s ease, color .3s ease;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ---------- 유틸 ---------- */
.gs-gradient-text {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.gs-container { max-width: var(--max-content); margin: 0 auto; }

/* ---------- 버튼 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 46px; padding: 0 20px; border-radius: 12px; border: 1px solid transparent;
  font-weight: 600; font-size: 15px; transition: all .18s ease; white-space: nowrap;
}
.btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 40%, transparent); outline-offset: 2px; }
.btn-primary { background: var(--grad); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { filter: brightness(1.06); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-primary:active { transform: translateY(0); filter: brightness(.96); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface); }
.btn-ghost:active { background: color-mix(in srgb, var(--surface) 70%, var(--border)); }
.btn-soft { background: var(--surface); color: var(--text); }
.btn-soft:hover { background: color-mix(in srgb, var(--surface) 80%, var(--primary) 12%); }
.btn-soft.active { background: color-mix(in srgb, var(--primary) 15%, transparent); color: var(--primary); }
.btn-sm { height: 38px; padding: 0 14px; font-size: 14px; border-radius: 10px; }
.btn-icon { width: 42px; height: 42px; padding: 0; border-radius: 12px; }

/* ---------- 카드 / 입력 ---------- */
.card {
  background: var(--workspace); border: 1px solid var(--border);
  border-radius: var(--radius-card); box-shadow: var(--shadow-sm);
}
.input, .textarea {
  width: 100%; background: var(--workspace); color: var(--text);
  border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px;
  font-size: 15px; transition: border-color .18s, box-shadow .18s;
}
.input:focus, .textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
}
.label { font-size: 13px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; display: block; }

/* ============================================================
   앱 셸 레이아웃
   ============================================================ */
.app-shell { display: flex; min-height: 100vh; }
/* 기능 페이지가 열린 화면은 뷰포트 높이에 고정 → 내부 .feature-stage 만 스크롤,
   하단 입력 도크는 화면비 변경/생성 후에도 항상 같은 자리에 고정된다. */
.app-shell:has(.feature-page) { height: 100vh; min-height: 0; overflow: hidden; }
.app-shell:has(.feature-page) > div { min-height: 0; }

/* 코드 스튜디오도 동일하게 뷰포트 높이에 고정 (좌우 분할 IDE) */
.app-shell:has(.code-studio) { height: 100vh; min-height: 0; overflow: hidden; }
.app-shell:has(.code-studio) > div { min-height: 0; }
.content:has(.code-studio) { padding: 0; overflow: hidden; display: flex; min-height: 0; }

/* AI 시트도 뷰포트 높이에 고정 → 좌측 대화 로그만 스크롤, 입력창은 항상 하단 노출 */
.app-shell:has(.sht-wrap) { height: 100vh; min-height: 0; overflow: hidden; }
.app-shell:has(.sht-wrap) > div { min-height: 0; }
.content:has(.code-studio) > .code-studio { flex: 1; width: 100%; }

/* 사이드바 — 아이콘 전용(70px, Genspark 4.0 스타일) */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; background: var(--workspace);
  border-right: 1px solid var(--border); display: flex; flex-direction: column; align-items: center;
  position: sticky; top: 0; height: 100vh; z-index: 40;
}
.sidebar-brand {
  display: grid; place-items: center; padding: 14px 0 8px; width: 100%;
}
.sidebar-logo {
  width: 34px; height: 34px; border-radius: 10px; background: var(--side-logo);
  display: grid; place-items: center; color: #fff; font-weight: 900; flex-shrink: 0; font-size: 17px;
}
.sidebar-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 4px 0; width: 100%; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.sidebar-scroll::-webkit-scrollbar { width: 0; }
.nav-section-title { display: none; }
/* 아이콘 네비 아이템: 세로 아이콘 + 소형 라벨 */
.nav-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  width: 58px; padding: 8px 2px; border-radius: 12px;
  color: var(--side-text); font-weight: 500; font-size: 10.5px; line-height: 1.15; text-align: center;
  transition: background .15s, color .15s;
}
.nav-item i { width: auto; font-size: 19px; color: var(--side-icon); transition: color .15s; }
.nav-item span { max-width: 56px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item:hover { background: var(--side-hover-bg); color: var(--side-active-fg); }
.nav-item:hover i { color: var(--side-active-fg); }
.nav-item.active { background: var(--side-active-bg); color: var(--side-active-fg); font-weight: 600; }
.nav-item.active i { color: var(--side-active-fg); }
/* 상단 New 버튼(사이드바) */
.sidebar-new {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  width: 58px; padding: 8px 2px; border-radius: 12px; background: transparent; border: none;
  color: var(--text-muted); font-size: 10.5px; font-weight: 600;
}
.sidebar-new i { font-size: 20px; color: var(--text); }
.sidebar-new:hover { background: var(--surface); }
.sidebar-footer { padding: 8px 0 12px; width: 100%; display: grid; place-items: center; }
.sidebar-avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--side-logo); color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: 14px; border: none; cursor: pointer;
}

/* 메인 */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--workspace); }
.topbar {
  height: 56px; display: flex; align-items: center; gap: 10px; padding: 0 16px;
  position: sticky; top: 0; z-index: 30; background: var(--workspace);
}
.topbar-spacer { flex: 1; }
.topbar-title { font-size: 15px; font-weight: 700; }
.content { flex: 1; padding: 8px 24px 28px; overflow-y: auto; }
/* 기능 페이지를 담을 때는 콘텐츠가 스스로 스크롤/여백을 갖지 않고,
   내부의 .feature-stage 가 스크롤을 담당하며 도크는 하단 고정된다. */
.content:has(.feature-page) { padding: 0 24px; overflow: hidden; display: flex; min-height: 0; }
.content:has(.feature-page) > .feature-page { flex: 1; width: 100%; }
/* AI 시트: 콘텐츠 여백/스크롤을 없애고 sht-wrap 이 남은 높이를 정확히 채운다 */
.content:has(.sht-wrap) { padding: 0; overflow: hidden; display: flex; min-height: 0; }
.content:has(.sht-wrap) > .sht-wrap { flex: 1; width: 100%; }

/* 상단 아이콘 버튼(고스트, 테두리 없음) */
.top-icon {
  width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px;
  background: transparent; border: none; color: var(--text-muted); font-size: 17px; transition: background .15s, color .15s;
}
.top-icon:hover { background: var(--surface); color: var(--text); }

/* 50% 할인 프로모 배지 */
.promo-badge {
  display: inline-flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 5px 14px; border-radius: 12px; background: color-mix(in srgb, var(--promo-blue) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--promo-blue) 30%, transparent); line-height: 1;
}
.promo-badge .pb-main { font-size: 15px; font-weight: 900; color: var(--promo-blue); }
.promo-badge .pb-main b { color: var(--promo-orange); }
.promo-badge .pb-sub { font-size: 9px; font-weight: 700; color: #fff; background: var(--promo-blue); padding: 2px 7px; border-radius: 6px; }

/* 크레딧 pill */
.credit-pill {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 999px;
  background: var(--surface); color: var(--text); font-weight: 700; font-size: 13px; border: none;
}
.credit-pill i { color: var(--warning); }

/* 우측 패널 */
.right-panel {
  width: 320px; flex-shrink: 0; border-left: 1px solid var(--border);
  background: var(--workspace); padding: 20px; overflow-y: auto;
}

/* ---------- 홈 통합 입력창 (Genspark 4.0) ---------- */
.home-hero { max-width: 720px; margin: 9vh auto 0; text-align: center; padding: 0 16px; }
.home-title { font-size: clamp(26px, 4vw, 34px); font-weight: 800; letter-spacing: -.02em; margin: 0 0 24px; }
.home-sub { color: var(--text-muted); font-size: 15px; margin: 0 0 24px; }

/* 넓은 둥근 프롬프트바 */
.prompt-box {
  background: var(--workspace); border: 1px solid var(--border); border-radius: var(--radius-input);
  box-shadow: var(--shadow-md); padding: 16px 18px 12px; text-align: left; transition: border-color .18s, box-shadow .18s;
}
.prompt-box:focus-within { border-color: color-mix(in srgb, var(--primary) 55%, var(--border)); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 12%, transparent), var(--shadow-md); }
.prompt-textarea {
  width: 100%; border: none; outline: none; resize: none; background: transparent; color: var(--text);
  font-size: 15px; line-height: 1.6; min-height: 26px; max-height: 260px; font-family: inherit;
}
.prompt-textarea::placeholder { color: var(--text-muted); }
.prompt-toolbar { display: flex; align-items: center; gap: 8px; margin-top: 10px; }

/* 파일 첨부(+) 버튼 */
.attach-btn { width: 36px; height: 36px; border-radius: 999px; border: 1px solid var(--border); background: var(--workspace); color: var(--text); display: grid; place-items: center; font-size: 15px; cursor: pointer; transition: background .15s, border-color .15s; }
.attach-btn:hover { background: var(--surface); border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); }
.attach-btn:disabled { opacity: .55; cursor: default; }
/* 첨부 미리보기 (프롬프트 상단) */
.cs-attach { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.cs-attach-inner { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cs-attach-thumb { width: 46px; height: 46px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.cs-attach-doc { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text); overflow: hidden; }
.cs-attach-doc i { color: var(--primary); }
.cs-attach-doc #cs-attach-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.cs-attach-x { border: none; background: transparent; color: var(--text-muted); cursor: pointer; padding: 4px 6px; border-radius: 6px; }
.cs-attach-x:hover { color: var(--danger, #E14D52); background: color-mix(in srgb, var(--danger, #E14D52) 10%, transparent); }

/* 프롬프트바 내부 pill 버튼(+ / Standard / 커넥터) */
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--workspace); color: var(--text); font-size: 13px; font-weight: 600;
  transition: background .15s, border-color .15s;
}
.pill:hover { background: var(--surface); }
.pill.active, .pill.pill-accent { border-color: color-mix(in srgb, var(--blue) 45%, transparent); color: var(--blue); background: color-mix(in srgb, var(--blue) 8%, transparent); }
.pill-round { width: 34px; padding: 0; justify-content: center; }
.pill i { font-size: 13px; }
/* 검은 대화/전송 pill */
.pill-dark {
  display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 16px; border-radius: 999px;
  background: #111318; color: #fff; font-size: 13px; font-weight: 700; border: none;
}
[data-theme="dark"] .pill-dark { background: #2A2F3D; }
.pill-dark:hover { filter: brightness(1.12); }
.send-btn { width: 36px; height: 36px; border-radius: 999px; background: var(--surface); color: var(--text-muted); border: none; display: grid; place-items: center; font-size: 14px; }
.send-btn.ready { background: #111318; color: #fff; }
[data-theme="dark"] .send-btn.ready { background: var(--primary); }

/* ---------- 홈 카테고리 (전체 한 줄 배열, 작은 플랫 아이콘) ---------- */
/* AI-LMS 시스템 바로가기 버튼 3종 */
.lms-links { display: flex; justify-content: center; flex-wrap: wrap; gap: 16px; max-width: 1000px; margin: 40px auto 0; padding: 0 16px; }
.lms-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 240px; padding: 15px 26px;
  border: 1.5px solid var(--border); border-radius: 16px;
  background: var(--surface); color: var(--text);
  font-size: 16px; font-weight: 700; text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease, background .15s ease;
}
.lms-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(0,0,0,.08); }
.lms-btn-school { color: #F97316; border-color: color-mix(in srgb, #F97316 45%, var(--border)); }
.lms-btn-school:hover { background: color-mix(in srgb, #F97316 8%, var(--surface)); border-color: #F97316; }
.lms-btn-univ { color: var(--blue); border-color: color-mix(in srgb, var(--blue) 45%, var(--border)); }
.lms-btn-univ:hover { background: color-mix(in srgb, var(--blue) 8%, var(--surface)); border-color: var(--blue); }
.lms-btn-b2b { color: #E14D52; border-color: color-mix(in srgb, #E14D52 45%, var(--border)); }
.lms-btn-b2b:hover { background: color-mix(in srgb, #E14D52 8%, var(--surface)); border-color: #E14D52; }
/* 최근 항목 위 가로 구분선 */
.home-divider { max-width: 1000px; margin: 40px auto 0; border: none; border-top: 1px solid var(--border); }
@media (max-width: 640px) {
  .lms-btn { min-width: 0; flex: 1 1 100%; font-size: 15px; padding: 13px 18px; }
}

.cat-groups { display: flex; justify-content: center; gap: 0; margin: 40px auto 0; max-width: 1040px; }
/* 데스크톱: 한 줄 고정(줄바꿈 없음) */
.cat-row { flex-wrap: nowrap; align-items: flex-start; }
.cat-group { padding: 0 20px; border-right: 1px solid var(--border); flex: 0 0 auto; }
.cat-group:last-child { border-right: none; }
.cat-group-title { font-size: 11px; font-weight: 600; color: var(--text-muted); text-align: center; margin-bottom: 14px; display: flex; align-items: center; justify-content: center; gap: 4px; white-space: nowrap; }
.cat-caret { font-size: 8px; opacity: .6; }
.cat-items { display: flex; gap: 18px; }
.cat-item { display: flex; flex-direction: column; align-items: center; gap: 7px; width: 52px; background: none; border: none; color: var(--text); }
/* 배경 없는 컬러 텍스트 아이콘 (참고 이미지 스타일) */
.cat-item .cat-ic-flat { font-size: 20px; line-height: 1; transition: transform .15s; }
.cat-item:hover .cat-ic-flat { transform: translateY(-2px); }
.cat-item .cat-label { font-size: 11px; font-weight: 500; line-height: 1.25; text-align: center; color: var(--text-muted); white-space: nowrap; }
.cat-item:hover .cat-label { color: var(--text); }

/* 기존 type-chip / suggest (구형 홈 하위호환) */
.type-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 18px 0 0; }
.type-chip { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--workspace); color: var(--text-muted); font-size: 14px; font-weight: 500; }
.type-chip.active { background: var(--grad); color: #fff; border-color: transparent; font-weight: 600; }
.suggest-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-top: 14px; }
.suggest-card { background: var(--workspace); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 18px; text-align: left; transition: all .18s; }
.suggest-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); }
.suggest-icon { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; font-size: 18px; color: #fff; margin-bottom: 12px; }

/* 프로필 드롭다운 */
.profile-menu { position: fixed; left: 12px; bottom: 12px; width: 250px; background: var(--workspace); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 8px; z-index: 70; display: none; }
.profile-menu.show { display: block; }
.profile-head { display: flex; align-items: center; gap: 10px; padding: 8px 8px 10px; }
.profile-head .pm-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--grad); color: #fff; display: grid; place-items: center; font-weight: 800; }
.profile-credit { color: var(--blue); font-weight: 700; font-size: 13px; padding: 4px 10px 10px; border-bottom: 1px solid var(--border); }
.profile-item { display: flex; align-items: center; gap: 10px; padding: 10px 10px; border-radius: 10px; color: var(--text); font-size: 14px; font-weight: 500; background: none; border: none; width: 100%; text-align: left; }
.profile-item i { width: 18px; text-align: center; color: var(--text-muted); }
.profile-item:hover { background: var(--surface); }

/* 기능 페이지 빈 상태 + 하단 입력 */
/* 기능 페이지: 상단=스크롤 결과영역(넓게), 하단=고정 입력 도크 */
.feature-page { display: flex; flex-direction: column; height: 100%; min-height: 0; }
/* 결과/빈상태가 함께 놓이는 위쪽 넓은 영역 — 내부 스크롤, 도크는 밀리지 않음 */
.feature-stage { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; }
.feature-stage::-webkit-scrollbar { width: 8px; }
.feature-stage::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }
.feature-empty { flex: 1 0 auto; display: grid; place-items: center; text-align: center; padding: 20px; }
.feature-empty h2 { font-size: clamp(20px, 3vw, 26px); font-weight: 800; margin: 0; }
.feature-empty p { color: var(--text-muted); margin-top: 10px; }
/* 하단 고정 입력 도크 — 화면비 변경/생성 후에도 제자리 유지 */
.feature-dock { flex: 0 0 auto; max-width: 760px; width: 100%; margin: 0 auto; padding: 12px 0 16px; background: var(--bg); }
.dock-tools { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 10px; }
.feature-hero-ic { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; color: #fff; font-size: 26px; margin: 0 auto 18px; }

/* ---------- AI 문서(텍스트 AI) ---------- */
.text-tabs { display: flex; align-items: center; gap: 8px; max-width: 900px; width: 100%; margin: 4px auto 14px; flex: 0 0 auto; }
/* 텍스트 AI: 대화/문서 보기 영역이 남는 높이를 채우고 내부 스크롤 → 하단 도크 고정 */
#chat-view, #doc-view { min-height: 0; }
#doc-view { overflow-y: auto; }
.text-doc-tools { display: flex; gap: 4px; }
.pill-sm { height: 30px; padding: 0 11px; font-size: 12.5px; }
.text-chat { flex: 1; max-width: 860px; width: 100%; margin: 0 auto; overflow-y: auto; scroll-behavior: smooth; padding: 8px 4px 4px; }
.text-chat:empty { min-height: 0; }

/* ChatGPT 스타일 대화 메시지 */
.chat-msg { display: flex; gap: 12px; margin-bottom: 18px; align-items: flex-start; }
.chat-msg.chat-user { flex-direction: row-reverse; }
.chat-avatar { width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0; display: grid; place-items: center; font-size: 14px; }
.chat-avatar.is-ai { background: var(--grad); color: #fff; }
.chat-avatar.is-user { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.chat-col { display: flex; flex-direction: column; align-items: flex-start; max-width: 78%; min-width: 0; }
.chat-msg.chat-user .chat-col { align-items: flex-end; }
.chat-bubble { padding: 13px 16px; line-height: 1.75; font-size: 15px; white-space: pre-wrap; word-break: break-word; border-radius: 14px; }
.chat-msg.chat-user .chat-bubble { background: var(--surface); }
/* 타이핑 커서 */
.chat-bubble.typing::after { content: '▍'; display: inline; margin-left: 1px; color: var(--primary); animation: gs-caret 1s steps(1) infinite; font-weight: 400; }
@keyframes gs-caret { 0%,50% { opacity: 1; } 50.01%,100% { opacity: 0; } }
/* 메시지별 복사 버튼 */
.chat-copy { margin-top: 6px; display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px; border-radius: 8px; border: 1px solid var(--border); background: transparent; color: var(--text-muted); font-size: 12.5px; font-weight: 500; cursor: pointer; transition: background .15s, color .15s, border-color .15s; }
.chat-copy:hover { background: var(--surface); color: var(--text); }
.chat-copy.copied { color: var(--success); border-color: var(--success); }
.chat-copy i { font-size: 12px; }
/* 생각 중 점 애니메이션 */
.chat-bubble.chat-thinking { display: inline-flex; align-items: center; gap: 5px; padding: 16px 18px; }
.chat-bubble.chat-thinking .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-muted); opacity: .4; animation: gs-think 1.2s infinite ease-in-out; }
.chat-bubble.chat-thinking .dot:nth-child(2) { animation-delay: .2s; }
.chat-bubble.chat-thinking .dot:nth-child(3) { animation-delay: .4s; }
@keyframes gs-think { 0%,80%,100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.doc-title-input { font-size: 20px; font-weight: 700; border: none; background: transparent; color: var(--text); padding: 8px 0; margin-bottom: 8px; width: 100%; outline: none; }
.doc-refine-bar { max-width: 900px; width: 100%; margin: 0 auto; padding: 10px 0 24px; display: flex; align-items: center; gap: 10px; }
.doc-refine-bar .input { flex: 1; height: 44px; border-radius: 999px; padding: 0 18px; }
.sel-menu { position: absolute; z-index: 70; background: var(--workspace); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; display: flex; gap: 4px; flex-wrap: wrap; max-width: 340px; }

/* 작업 카드 */
.work-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.work-card { background: var(--workspace); border: 1px solid var(--border); border-radius: var(--radius-card); overflow: hidden; transition: all .18s; }
.work-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.work-thumb { aspect-ratio: 16/10; background: var(--surface); display: grid; place-items: center; color: var(--text-muted); font-size: 28px; }
.work-body { padding: 12px 14px; }

/* 배지 */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-text { background: color-mix(in srgb, var(--blue) 15%, transparent); color: var(--blue); }
.badge-image { background: color-mix(in srgb, var(--secondary) 15%, transparent); color: var(--secondary); }
.badge-video { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); }
.badge-app { background: color-mix(in srgb, var(--success) 15%, transparent); color: var(--success); }
.badge-html { background: color-mix(in srgb, var(--warning) 15%, transparent); color: var(--warning); }
.badge-demo { background: color-mix(in srgb, var(--warning) 20%, transparent); color: var(--warning); }

/* 실행 패널 (작업 과정 표시) */
.exec-step { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.exec-step:last-child { border-bottom: none; }
.exec-dot { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; font-size: 11px; }
.exec-dot.wait { background: var(--surface); color: var(--text-muted); }
.exec-dot.run { background: color-mix(in srgb, var(--primary) 20%, transparent); color: var(--primary); }
.exec-dot.done { background: var(--success); color: #fff; }
.exec-dot.fail { background: var(--danger); color: #fff; }

/* 토스트 */
.toast-wrap { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--workspace); border: 1px solid var(--border); border-left: 4px solid var(--primary);
  border-radius: 10px; padding: 12px 16px; box-shadow: var(--shadow-lg); min-width: 260px; max-width: 380px;
  animation: toastIn .25s ease;
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

/* 스피너 */
.spinner { width: 16px; height: 16px; border: 2px solid color-mix(in srgb, var(--primary) 30%, transparent); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 모바일 오버레이 */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 39; display: none; }
.overlay.show { display: block; }
.mobile-only { display: none; }

/* ============================================================
   반응형
   ============================================================ */
@media (max-width: 1024px) {
  .right-panel { display: none; }
  /* 태블릿: 한 줄 유지하되 넘치면 가로 스크롤로 전환 */
  .cat-row {
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 10px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
  .cat-row::-webkit-scrollbar { height: 5px; }
  .cat-row::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
  .cat-group { padding: 0 16px; }
}
@media (max-width: 768px) {
  .content { padding: 0 14px 20px; }
  .work-grid, .suggest-grid { grid-template-columns: 1fr 1fr; }
  /* 모바일: 아이콘·글자 더 작게, 가로 스크롤 프레임 */
  .cat-group { padding: 0 13px; }
  .cat-items { gap: 14px; }
  .cat-item { width: 46px; }
  .cat-item .cat-ic-flat { font-size: 18px; }
  .cat-item .cat-label { font-size: 10px; }
  .promo-badge { display: none; }
}
@media (max-width: 480px) {
  .work-grid, .suggest-grid { grid-template-columns: 1fr; }
  .home-hero { margin-top: 4vh; }
  :root { --sidebar-w: 62px; --sidebar-collapsed: 62px; }
  .nav-item, .sidebar-new { width: 52px; font-size: 9.5px; }
}

/* 인증 페이지 */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: 100%; max-width: 420px; padding: 36px 32px; }
.auth-logo { display: flex; align-items: center; gap: 10px; justify-content: center; font-weight: 800; font-size: 22px; margin-bottom: 8px; }
.field { margin-bottom: 16px; }
.demo-hint { background: var(--surface); border-radius: 10px; padding: 12px 14px; font-size: 13px; color: var(--text-muted); margin-top: 18px; }

/* ========================================================================
   마스터 게이트 모달
   ===================================================================== */
.master-gate { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; }
.mg-backdrop { position: absolute; inset: 0; background: rgba(10,12,18,.6); backdrop-filter: blur(3px); }
.mg-card {
  position: relative; width: min(380px, 92vw); background: var(--workspace); border: 1px solid var(--border);
  border-radius: 18px; padding: 28px 26px; box-shadow: var(--shadow-lg); text-align: center;
}
.mg-icon { width: 52px; height: 52px; border-radius: 14px; background: #181B24; color: #fff; display: grid; place-items: center; font-size: 22px; margin: 0 auto 14px; }
.mg-card h3 { margin: 0 0 4px; font-size: 18px; }
.mg-card p { margin: 0 0 16px; color: var(--text-muted); font-size: 13px; }
.mg-input {
  width: 100%; text-align: center; letter-spacing: .5em; font-size: 22px; font-weight: 700;
  padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text);
}
.mg-input:focus { outline: none; border-color: #181B24; }
.mg-error { color: var(--danger); font-size: 13px; min-height: 18px; margin: 8px 0; }
.mg-actions { display: flex; gap: 10px; }
.mg-btn { flex: 1; padding: 11px; border-radius: 11px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 600; cursor: pointer; }
.mg-primary { background: #181B24; color: #fff; border-color: #181B24; }
.mg-btn:hover { opacity: .9; }

/* ========================================================================
   마스터 관리자 콘솔 (독립 레이아웃, 흑백 테마)
   ===================================================================== */
.mc-root { display: flex; min-height: 100vh; background: #0F1116; color: #E8EAF0; }
.mc-side { width: 220px; flex-shrink: 0; background: #15181F; border-right: 1px solid #262B36; display: flex; flex-direction: column; padding: 18px 14px; }
.mc-brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 16px; padding: 6px 8px 18px; color: #fff; }
.mc-brand i { color: #fff; }
.mc-nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.mc-navitem { display: flex; align-items: center; gap: 11px; padding: 11px 12px; border-radius: 10px; background: transparent; border: none; color: #A2A9B8; font-size: 14px; font-weight: 500; text-align: left; cursor: pointer; transition: background .15s, color .15s; }
.mc-navitem i { width: 18px; text-align: center; }
.mc-navitem:hover { background: #1E232E; color: #fff; }
.mc-navitem.active { background: #2A303D; color: #fff; font-weight: 700; }
.mc-side-foot { display: flex; flex-direction: column; gap: 8px; padding-top: 14px; border-top: 1px solid #262B36; }
.mc-back, .mc-exit { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 9px; font-size: 13px; color: #A2A9B8; background: transparent; border: none; cursor: pointer; text-decoration: none; }
.mc-back:hover { color: #fff; background: #1E232E; }
.mc-exit:hover { color: #FF6B6B; background: #1E232E; }

.mc-main { flex: 1; padding: 26px 30px; overflow-y: auto; max-height: 100vh; }
.mc-top { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.mc-top h1 { font-size: 22px; margin: 0; color: #fff; }
.mc-tag { font-size: 11px; font-weight: 700; letter-spacing: .08em; color: #0F1116; background: #E8EAF0; padding: 3px 9px; border-radius: 6px; }

.mc-card { background: #171B23; border: 1px solid #262B36; border-radius: 14px; padding: 18px; margin-bottom: 16px; }
.mc-card h3 { margin: 0 0 12px; font-size: 15px; color: #fff; }
.mc-hint { color: #9098A8; font-size: 13px; margin: 0 0 16px; }
.mc-hint b { color: #fff; }
.mc-muted { color: #6B7280; }

.mc-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.mc-stat { display: flex; align-items: center; gap: 12px; background: #171B23; border: 1px solid #262B36; border-radius: 12px; padding: 16px; }
.mc-stat i { font-size: 20px; color: #7C8698; width: 26px; text-align: center; }
.mc-stat-v { font-size: 22px; font-weight: 800; color: #fff; line-height: 1; }
.mc-stat-l { font-size: 12px; color: #9098A8; margin-top: 4px; }
.mc-bytype { display: flex; flex-wrap: wrap; gap: 8px; }
.mc-chip { background: #1E232E; border: 1px solid #2E3542; border-radius: 8px; padding: 6px 12px; font-size: 13px; color: #C4CAD6; }
.mc-chip b { color: #fff; margin-left: 4px; }

.mc-toolbar { display: flex; gap: 10px; margin-bottom: 14px; }
.mc-input { background: #10141B; border: 1px solid #2E3542; border-radius: 9px; padding: 10px 12px; color: #E8EAF0; font-size: 14px; flex: 1; min-width: 0; }
.mc-input:focus { outline: none; border-color: #4B5568; }
.mc-btn { background: #232936; border: 1px solid #333B4A; border-radius: 9px; padding: 10px 16px; color: #E8EAF0; font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap; }
.mc-btn:hover { background: #2C3342; }
.mc-btn-primary { background: #E8EAF0; color: #0F1116; border-color: #E8EAF0; }
.mc-btn-primary:hover { background: #fff; }

.mc-table-wrap { overflow-x: auto; border: 1px solid #262B36; border-radius: 12px; }
.mc-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.mc-table th { text-align: left; padding: 11px 12px; background: #1A1F28; color: #8891A2; font-weight: 600; border-bottom: 1px solid #262B36; white-space: nowrap; }
.mc-table td { padding: 10px 12px; border-bottom: 1px solid #20252F; color: #D4D9E2; }
.mc-table tr:last-child td { border-bottom: none; }
.mc-actions { display: flex; gap: 5px; flex-wrap: wrap; }
.mc-mini { background: #232936; border: 1px solid #333B4A; border-radius: 7px; padding: 5px 9px; color: #C4CAD6; font-size: 12px; cursor: pointer; }
.mc-mini:hover { background: #2C3342; color: #fff; }
.mc-mini.ok { border-color: #1E5C3E; color: #4ADE80; }

.mc-badge { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 600; background: #262B36; color: #9098A8; }
.mc-badge.ok { background: #10331F; color: #4ADE80; }
.mc-badge.bad { background: #3A1416; color: #FF7B7B; }
.mc-badge.admin { background: #2A2140; color: #B79CFF; }

.mc-apis { display: grid; gap: 14px; margin-bottom: 20px; }
.mc-api-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; font-size: 15px; }
.mc-form-row { display: flex; gap: 10px; margin-bottom: 10px; }
.mc-api-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 4px; }
.mc-model-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.mc-model-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.mc-model-label { font-size: 12px; color: #9AA3B2; font-weight: 600; }
.mc-model-field select.mc-input { width: 100%; max-width: 100%; }
@media (max-width: 720px) { .mc-model-grid { grid-template-columns: 1fr; } }
.mc-switch { display: flex; align-items: center; gap: 6px; font-size: 13px; color: #C4CAD6; }
.mc-add-api { border-style: dashed; }
.k-result { font-size: 12px; }

@media (max-width: 720px) {
  .mc-side { width: 62px; padding: 14px 8px; }
  .mc-brand span, .mc-navitem span, .mc-back span, .mc-exit { display: none; }
  .mc-navitem { justify-content: center; }
  .mc-form-row { flex-direction: column; }
}

/* ===== 기능 페이지 생성 결과 표시 ===== */
.feature-result { max-width: 860px; width: 100%; margin: 8px auto 12px; flex: 0 0 auto; }
.fr-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.fr-prompt { font-size: 15px; font-weight: 600; color: var(--text); }
.fr-body { background: var(--workspace); border: 1px solid var(--border); border-radius: 16px; padding: 16px; }
.fr-loading { display: flex; align-items: center; gap: 10px; color: var(--text-muted); font-size: 14px; }
.fr-image { width: 100%; max-height: 560px; object-fit: contain; border-radius: 12px; background: #0d0f14; display: block; }
.fr-video { width: 100%; max-height: 560px; border-radius: 12px; background: #000; display: block; }
.fr-frame { width: 100%; height: 460px; border: none; border-radius: 12px; background: #fff; }
.fr-code { background: #0f1116; color: #e6e8ee; border-radius: 12px; padding: 16px; overflow: auto; max-height: 460px; font-size: 13px; line-height: 1.6; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre; margin: 0; }
.fr-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.fr-note { color: var(--text-muted); font-size: 14px; padding: 12px; }
/* 다중 이미지 그리드 */
.fr-imgs.fr-image-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fr-img-cell { display: block; }
.fr-image-grid .fr-image { max-height: 320px; }

/* ---------- 하단 도크 옵션 pill + 팝오버 ---------- */
.pill-model { cursor: default; opacity: .95; }
.opt-pill-wrap { position: relative; }
.opt-pill { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.opt-pill .opt-label { color: var(--text-muted); }
.opt-pill .opt-value { font-weight: 600; color: var(--text); }
.opt-pill .opt-caret { font-size: 9px; opacity: .55; margin-left: 2px; }
.opt-menu {
  position: absolute; bottom: calc(100% + 8px); left: 0; z-index: 40;
  min-width: 200px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow-lg, 0 12px 40px rgba(0,0,0,.18));
  padding: 6px; display: none; max-height: 320px; overflow-y: auto;
}
.opt-menu.open { display: block; animation: opt-pop .14s ease; }
@keyframes opt-pop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.opt-choice {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 10px;
  border: none; background: none; border-radius: 10px; cursor: pointer;
  font-size: 13.5px; color: var(--text); text-align: left;
}
.opt-choice i:first-child { width: 16px; text-align: center; color: var(--text-muted); }
.opt-choice span { flex: 1; }
.opt-choice .opt-check { opacity: 0; color: var(--primary); font-size: 12px; }
.opt-choice:hover { background: var(--side-hover-bg, rgba(0,0,0,.04)); }
.opt-choice.is-active { color: var(--primary); font-weight: 600; }
.opt-choice.is-active .opt-check { opacity: 1; }
.opt-choice.is-active i:first-child { color: var(--primary); }

/* 모델 선택 메뉴 (풍부한 카탈로그 뷰) */
.opt-menu-model { min-width: 320px; max-width: 380px; }
.opt-menu-loading { padding: 14px 12px; color: var(--text-muted); font-size: 13px; text-align: center; }
.cs-model-choice { align-items: flex-start; padding: 10px 12px; }
.cs-model-choice .opt-check { margin-top: 3px; align-self: flex-start; }
.cs-model-main { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cs-model-name { font-weight: 600; color: var(--text); display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cs-model-rec { font-size: 10px; font-weight: 700; color: #fff; background: var(--primary, #4f46e5); padding: 1px 7px; border-radius: 999px; }
.cs-model-desc { font-size: 12px; color: var(--text-muted); font-weight: 400; line-height: 1.4; white-space: normal; }
.cs-model-tags { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; margin-top: 2px; }
.cs-model-badge { font-size: 10.5px; color: var(--text-muted); background: var(--workspace, rgba(0,0,0,.05)); border: 1px solid var(--border); padding: 1px 7px; border-radius: 999px; }
.cs-model-price { font-size: 10.5px; color: var(--text-muted); font-weight: 500; }
.cs-model-choice.is-active .cs-model-name { color: var(--primary); }

/* ============================================================
   코드 스튜디오 (좌우 분할 IDE) — Genspark 스타일
   ============================================================ */
.code-studio { display: flex; width: 100%; height: 100%; min-height: 0; }

/* 대학교 AI-LMS '큰 창 모드' embed: iframe 안에서 사이드바 없이 스튜디오만 꽉 채움 */
.app-shell.studio-embed { min-height: 100vh; height: 100vh; }
.app-shell.studio-embed > .main { height: 100vh; min-height: 0; }
.app-shell.studio-embed .studio,
.app-shell.studio-embed .code-studio { height: 100%; }

/* 대학교 AI-LMS: 학생이 클래스 안에서 AI 사용 시 외곽 테두리만 클래스 컬러로 차별화 (요구사항 #7) */
.studio.studio-lms-framed {
  position: relative;
  border: 4px solid var(--lms-class-color, #397CF6);
  border-radius: 14px;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--lms-class-color, #397CF6) 30%, transparent);
  overflow: hidden;
}
.studio-lms-badge {
  position: absolute;
  top: 10px; right: 14px;
  z-index: 40;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px; font-weight: 700;
  color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
  pointer-events: none;
}
.studio-lms-badge i { font-size: 11px; }

/* 왼쪽: 대화/명령 패널 */
.cs-left {
  display: flex; flex-direction: column; min-height: 0;
  width: 42%; min-width: 340px; max-width: 560px;
  border-right: 1px solid var(--border); background: var(--bg);
}
.cs-left-head {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.cs-left-title { font-weight: 700; font-size: 15px; display: inline-flex; align-items: center; gap: 8px; }
.cs-conversation { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 14px; }

/* 환영/빈 상태 */
.cs-welcome { margin: auto; text-align: center; max-width: 340px; }
.cs-welcome-icon { width: 60px; height: 60px; border-radius: 18px; background: var(--blue); color: #fff; display: grid; place-items: center; font-size: 24px; margin: 0 auto 16px; }
.cs-welcome h2 { font-size: 22px; margin-bottom: 8px; }
.cs-welcome p { color: var(--text-muted); font-size: 14px; line-height: 1.6; }
.cs-samples { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; }
.cs-sample { padding: 10px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--workspace); color: var(--text); font-size: 13.5px; text-align: left; cursor: pointer; transition: .12s; }
.cs-sample:hover { border-color: var(--blue); color: var(--blue); }

/* 대화 메시지 */
.cs-msg { display: flex; gap: 10px; align-items: flex-start; }
.cs-msg-user { justify-content: flex-end; }
.cs-msg-user .cs-bubble { background: var(--blue); color: #fff; border-radius: 14px 14px 4px 14px; max-width: 85%; }
.cs-msg-ai .cs-bubble { background: var(--workspace); border: 1px solid var(--border); border-radius: 14px 14px 14px 4px; max-width: 90%; }
.cs-bubble { padding: 11px 14px; font-size: 14px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.cs-ai-avatar { flex: 0 0 auto; width: 28px; height: 28px; border-radius: 8px; background: var(--grad); color: #fff; font-weight: 800; font-size: 13px; display: grid; place-items: center; }
.cs-done { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.cs-model-tag { font-size: 11px; color: var(--text-muted); background: var(--surface); padding: 2px 8px; border-radius: 999px; font-weight: 500; }
.cs-done-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.cs-share-note { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.cs-share-link { display: flex; gap: 8px; margin-top: 10px; align-items: center; }
.cs-share-link input { flex: 1; min-width: 0; padding: 7px 10px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); font-size: 12.5px; color: var(--text); }

/* 왼쪽 하단 고정 도크 */
.cs-dock { flex: 0 0 auto; padding: 12px 16px 16px; background: var(--bg); border-top: 1px solid var(--border); }
.cs-dock-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }

/* 오른쪽: 미리보기/코드 */
.cs-right { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; background: var(--workspace); }
.cs-right-head { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 14px; border-bottom: 1px solid var(--border); }
.cs-tabs { display: flex; gap: 4px; background: var(--surface); padding: 4px; border-radius: 10px; }
.cs-tab { border: none; background: transparent; color: var(--text-muted); font-size: 13px; font-weight: 600; padding: 7px 14px; border-radius: 7px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.cs-tab.is-active { background: var(--workspace); color: var(--text); box-shadow: var(--shadow-sm); }
.cs-right-actions { display: flex; gap: 2px; }

.cs-right-body { flex: 1 1 auto; min-height: 0; position: relative; }
.cs-pane { position: absolute; inset: 0; display: none; }
.cs-pane.is-active { display: block; }
.cs-frame { width: 100%; height: 100%; border: 0; background: #fff; }
.cs-preview-empty { width: 100%; height: 100%; display: grid; place-items: center; color: var(--text-muted); text-align: center; }
.cs-preview-empty i { font-size: 34px; opacity: .4; margin-bottom: 12px; display: block; }
.cs-preview-empty p { font-size: 14px; }
.cs-preview-note { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--text-muted); padding: 24px; text-align: center; }
.cs-code { width: 100%; height: 100%; margin: 0; overflow: auto; padding: 18px; background: #0d1117; color: #e6edf3; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13px; line-height: 1.6; white-space: pre; }
.cs-code code { white-space: pre; }

/* ===== 유형별 결과물(이미지/영상/문서) ===== */
.cs-result { width: 100%; height: 100%; overflow: auto; }
.cs-note { padding: 24px; color: var(--text-muted); text-align: center; }
.cs-muted { color: var(--text-muted); }

/* 이미지 결과 */
.cs-imgs { width: 100%; height: 100%; display: grid; place-items: center; padding: 20px; box-sizing: border-box; }
.cs-imgs.cs-img-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; align-content: center; }
.cs-img-cell { display: block; max-width: 100%; max-height: 100%; border-radius: 12px; overflow: hidden; box-shadow: var(--shadow-sm); }
.cs-img-cell img { display: block; max-width: 100%; max-height: calc(100vh - 160px); object-fit: contain; border-radius: 12px; }
.cs-img-grid .cs-img-cell img { max-height: 42vh; }

/* 영상 결과 */
.cs-video { width: 100%; height: 100%; max-height: 100%; background: #000; object-fit: contain; }

/* 문서(텍스트) 결과 — 오른쪽 미리보기에 렌더 */
.cs-doc { padding: 32px 40px; max-width: 820px; margin: 0 auto; line-height: 1.75; color: var(--text); }
.cs-doc h1 { font-size: 26px; margin: 18px 0 12px; }
.cs-doc h2 { font-size: 21px; margin: 20px 0 10px; }
.cs-doc h3 { font-size: 17px; margin: 16px 0 8px; }
.cs-doc h4 { font-size: 15px; margin: 14px 0 6px; }
.cs-doc p { margin: 10px 0; font-size: 15px; }
.cs-doc ul, .cs-doc ol { margin: 10px 0 10px 22px; }
.cs-doc li { margin: 4px 0; font-size: 15px; }
.cs-doc code { background: var(--surface); padding: 2px 6px; border-radius: 6px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
.cs-doc strong { font-weight: 700; }

/* 반응형: 좁은 화면은 상하 분할 */
@media (max-width: 900px) {
  .code-studio { flex-direction: column; }
  .cs-left { width: 100%; max-width: none; min-width: 0; height: 50%; border-right: 0; border-bottom: 1px solid var(--border); }
  .cs-right { height: 50%; }
}

/* ============================================================
   공개 공유 열람 페이지 (/s/:token)
   ============================================================ */
.shared-wrap { min-height: 100vh; background: var(--workspace, #f5f6f8); display: flex; flex-direction: column; }
.shared-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 22px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.shared-brand { font-weight: 800; font-size: 17px; color: var(--text); text-decoration: none; display: inline-flex; align-items: center; gap: 9px; }
.shared-logo { width: 28px; height: 28px; border-radius: 8px; background: var(--grad, linear-gradient(135deg,#6366f1,#8b5cf6)); color: #fff; display: grid; place-items: center; font-weight: 900; }
.shared-main { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 32px 16px 48px; }
.shared-card { width: 100%; max-width: 860px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: 0 6px 30px rgba(0,0,0,.06); overflow: hidden; }
.shared-meta { padding: 26px 28px 18px; border-bottom: 1px solid var(--border); }
.shared-type { display: inline-flex; align-items: center; gap: 6px; color: #fff; font-size: 12px; font-weight: 700; padding: 4px 11px; border-radius: 999px; }
.shared-title { font-size: 22px; margin: 12px 0 6px; }
.shared-prompt { color: var(--text-muted); font-size: 14px; line-height: 1.5; margin: 6px 0; }
.shared-model { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); background: var(--workspace); border: 1px solid var(--border); padding: 3px 10px; border-radius: 999px; margin-top: 6px; }
.shared-body { padding: 22px 28px; }
.shared-images { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px,1fr)); gap: 12px; }
.shared-images img { width: 100%; border-radius: 12px; border: 1px solid var(--border); display: block; }
.shared-video { width: 100%; border-radius: 12px; background: #000; }
.shared-frame { width: 100%; height: 540px; border: 1px solid var(--border); border-radius: 12px; background: #fff; }
.shared-code-toggle { margin-top: 14px; }
.shared-code-toggle summary { cursor: pointer; font-weight: 600; color: var(--primary); font-size: 13.5px; }
.shared-code { margin-top: 10px; background: #0f172a; color: #e2e8f0; padding: 16px; border-radius: 12px; overflow: auto; max-height: 420px; font-size: 12.5px; line-height: 1.5; }
.shared-doc { font-size: 15px; line-height: 1.75; color: var(--text); }
.shared-doc h1 { font-size: 24px; margin: 18px 0 10px; } .shared-doc h2 { font-size: 20px; margin: 16px 0 8px; }
.shared-doc h3 { font-size: 17px; margin: 14px 0 6px; } .shared-doc h4 { font-size: 15px; margin: 12px 0 6px; }
.shared-doc p { margin: 8px 0; } .shared-doc ul, .shared-doc ol { margin: 8px 0 8px 22px; } .shared-doc li { margin: 4px 0; }
.shared-doc code { background: var(--workspace); padding: 2px 6px; border-radius: 5px; font-size: .9em; }
.shared-actions { display: flex; gap: 10px; padding: 16px 28px 24px; border-top: 1px solid var(--border); }
.shared-footer { color: var(--text-muted); font-size: 12.5px; margin-top: 18px; text-align: center; }
@media (max-width: 640px) { .shared-frame { height: 400px; } .shared-meta, .shared-body, .shared-actions { padding-left: 18px; padding-right: 18px; } }

/* ============================================================
   AI 회의록 (STT) — meeting.tsx
   ============================================================ */
.mtg-wrap { max-width: 1180px; margin: 0 auto; padding: 18px 20px 40px; }
.mtg-header { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.mtg-head-left { display: flex; align-items: center; gap: 14px; }
.mtg-logo { width: 46px; height: 46px; border-radius: 13px; background: linear-gradient(135deg, #16A36A, #0EA5A0); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 20px; box-shadow: 0 6px 16px rgba(22,163,106,.32); }
.mtg-title { font-size: 20px; font-weight: 800; margin: 0; letter-spacing: -.02em; }
.mtg-sub { font-size: 12.5px; color: var(--text-muted); margin: 2px 0 0; }
.mtg-head-right { display: flex; align-items: center; gap: 12px; }
.mtg-timer { font-variant-numeric: tabular-nums; font-size: 22px; font-weight: 800; letter-spacing: .02em; color: var(--text); }
.mtg-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); }
.mtg-chip i { font-size: 8px; }
.mtg-chip-idle { color: var(--text-muted); }
.mtg-chip-ready { color: #16A36A; border-color: color-mix(in srgb, #16A36A 40%, var(--border)); background: color-mix(in srgb, #16A36A 10%, transparent); }
.mtg-chip-rec { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); background: color-mix(in srgb, var(--danger) 10%, transparent); }
.mtg-chip-rec i { animation: mtgBlink 1s infinite; }
.mtg-chip-paused { color: #F97316; }
.mtg-chip-done { color: var(--blue); }
.mtg-chip-denied { color: var(--danger); }
@keyframes mtgBlink { 0%,100% { opacity: 1; } 50% { opacity: .25; } }

.mtg-titlebar { display: flex; align-items: center; gap: 10px; background: var(--workspace, #fff); border: 1px solid var(--border); border-radius: 12px; padding: 0 14px; margin-bottom: 16px; }
.mtg-titlebar > i { color: var(--text-muted); font-size: 13px; }
.mtg-title-input { flex: 1; border: none; background: transparent; padding: 13px 0; font-size: 15px; font-weight: 600; color: var(--text); outline: none; }
.mtg-title-input::placeholder { color: var(--text-muted); font-weight: 500; }

.mtg-body { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.mtg-panel { background: var(--workspace, #fff); border: 1px solid var(--border); border-radius: var(--radius-card, 16px); padding: 16px; display: flex; flex-direction: column; min-height: 520px; }
.mtg-panel-head { display: flex; justify-content: space-between; align-items: center; font-size: 13.5px; font-weight: 700; margin-bottom: 12px; }
.mtg-panel-head > span:first-child { display: inline-flex; align-items: center; gap: 8px; }
.mtg-panel-head i { color: var(--primary); }
.mtg-live { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 800; color: var(--danger); }
.mtg-live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); animation: mtgBlink 1s infinite; }

.mtg-wave-box { position: relative; height: 120px; border-radius: 12px; background: color-mix(in srgb, var(--bg) 60%, transparent); border: 1px solid var(--border); overflow: hidden; margin-bottom: 12px; }
.mtg-wave { width: 100%; height: 100%; display: block; }
.mtg-wave-hint { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--text-muted); font-size: 12.5px; }
.mtg-wave-hint i { font-size: 22px; opacity: .5; }

.mtg-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.mtg-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 14px; border-radius: 11px; font-size: 13.5px; font-weight: 700; border: 1px solid var(--border); cursor: pointer; transition: transform .05s, background .15s, opacity .15s; background: var(--workspace, #fff); color: var(--text); }
.mtg-btn:active { transform: scale(.98); }
.mtg-btn:disabled { opacity: .45; cursor: not-allowed; }
.mtg-btn-prepare { background: color-mix(in srgb, #16A36A 12%, transparent); color: #16A36A; border-color: color-mix(in srgb, #16A36A 35%, var(--border)); }
.mtg-btn-record { grid-column: 1 / -1; background: var(--danger); color: #fff; border-color: var(--danger); font-size: 14.5px; padding: 13px; }
.mtg-btn-record:not(:disabled):hover { background: color-mix(in srgb, var(--danger) 88%, #000); }
.mtg-btn-record i { color: #fff; }
.mtg-btn-stop { background: #1F2430; color: #fff; border-color: #1F2430; }
.mtg-btn-ghost { background: transparent; }
.mtg-btn-ghost:not(:disabled):hover { background: color-mix(in srgb, var(--primary) 8%, transparent); }
.mtg-btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.mtg-btn-primary:not(:disabled):hover { background: color-mix(in srgb, var(--primary) 88%, #000); }
.mtg-btn-accent { background: #8C5EFF; color: #fff; border-color: #8C5EFF; }
.mtg-btn-accent:not(:disabled):hover { background: color-mix(in srgb, #8C5EFF 88%, #000); }

.mtg-transcript-head { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; font-weight: 700; color: var(--text-muted); margin-bottom: 8px; }
.mtg-transcript-head > span { display: inline-flex; align-items: center; gap: 7px; }
.mtg-mini { border: 1px solid var(--border); background: transparent; color: var(--text-muted); border-radius: 8px; padding: 4px 9px; font-size: 11.5px; font-weight: 600; cursor: pointer; }
.mtg-mini:hover { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.mtg-transcript { flex: 1; overflow-y: auto; border: 1px solid var(--border); border-radius: 12px; padding: 14px; font-size: 14.5px; line-height: 1.75; min-height: 150px; background: color-mix(in srgb, var(--bg) 40%, transparent); }
.mtg-final { color: var(--text); white-space: pre-wrap; word-break: break-word; }
.mtg-interim { color: var(--text-muted); font-style: italic; }
.mtg-audio { width: 100%; margin-top: 12px; }

.mtg-result-tabs { display: inline-flex; gap: 4px; background: color-mix(in srgb, var(--bg) 70%, transparent); border-radius: 10px; padding: 3px; }
.mtg-tab { border: none; background: transparent; padding: 6px 14px; border-radius: 8px; font-size: 12.5px; font-weight: 700; color: var(--text-muted); cursor: pointer; }
.mtg-tab.active { background: var(--workspace, #fff); color: var(--primary); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.mtg-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.mtg-actions-3 { grid-template-columns: 1fr 1fr 1fr; }
.mtg-actions-3 .mtg-btn { font-size: 12.5px; padding: 10px 8px; }
.mtg-btn-neutral { background: color-mix(in srgb, var(--text) 6%, transparent); color: var(--text); border-color: var(--border); }
.mtg-btn-neutral:not(:disabled):hover { background: color-mix(in srgb, var(--text) 12%, transparent); }
.mtg-result { flex: 1; overflow-y: auto; border: 1px solid var(--border); border-radius: 12px; padding: 18px; min-height: 200px; background: color-mix(in srgb, var(--bg) 40%, transparent); }
.mtg-original-pre { margin: 0; white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere; font-family: inherit; font-size: 14px; line-height: 1.85; color: var(--text); }
.mtg-result-body { font-size: 14.5px; line-height: 1.8; color: var(--text); }
.mtg-result-body h2 { font-size: 17px; font-weight: 800; margin: 18px 0 10px; }
.mtg-result-body h3 { font-size: 15px; font-weight: 800; margin: 16px 0 8px; color: var(--primary); }
.mtg-result-body h2:first-child, .mtg-result-body h3:first-child { margin-top: 0; }
.mtg-result-body p { margin: 0 0 10px; }
.mtg-result-body ul { margin: 0 0 12px; padding-left: 20px; }
.mtg-result-body li { margin: 4px 0; }
.mtg-result-body ul.mtg-checklist { list-style: none; padding-left: 4px; }
.mtg-result-body code { background: color-mix(in srgb, var(--primary) 12%, transparent); padding: 1px 6px; border-radius: 5px; font-size: 13px; }

.mtg-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; color: var(--text-muted); padding: 40px 20px; height: 100%; }
.mtg-empty i { font-size: 30px; opacity: .4; }
.mtg-empty p { font-size: 13.5px; margin: 0; }

.mtg-file-actions { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 14px; }
.mtg-file-actions-4 { grid-template-columns: 1fr 1fr; }
.mtg-file-actions-4 .mtg-btn { font-size: 12.5px; padding: 10px 10px; }
@media (max-width: 520px) { .mtg-file-actions-4 { grid-template-columns: 1fr; } .mtg-actions-3 { grid-template-columns: 1fr; } }

.mtg-overlay { position: fixed; inset: 0; z-index: 80; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(3px); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; }
.mtg-overlay p { font-size: 15px; font-weight: 700; color: var(--text); }
.mtg-spinner { width: 46px; height: 46px; border: 4px solid color-mix(in srgb, var(--primary) 25%, transparent); border-top-color: var(--primary); border-radius: 50%; animation: mtgSpin .8s linear infinite; }
@keyframes mtgSpin { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
  .mtg-body { grid-template-columns: 1fr; }
  .mtg-panel { min-height: auto; }
  .mtg-transcript { min-height: 200px; }
}

/* ================= AI 시트 (스프레드시트) ================= */
.sht-wrap { display: grid; grid-template-columns: 765px 1fr; height: 100%; min-height: 0; background: var(--bg); overflow: hidden; }
.sht-wrap.full { position: fixed; inset: 0; z-index: 60; grid-template-columns: 1fr; }
.sht-wrap.full .sht-left { display: none; }

/* ---- 좌측 요청 패널 ---- */
.sht-left { display: flex; flex-direction: column; gap: 12px; padding: 18px 16px; border-right: 1px solid var(--border); background: var(--workspace); overflow: hidden; min-height: 0; }
/* 상단 소개/가이드는 고정, 대화 로그(sht-chat)만 스크롤, 입력 도크(sht-dock)는 항상 하단 고정 */
.sht-left-head, .sht-points, .sht-dock { flex: none; }
/* 입력 도크: 대화가 많아도 항상 좌측 패널 최하단에 고정되어 밀려나지 않음 */
.sht-dock { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding-top: 10px; border-top: 1px solid var(--border); background: var(--workspace); }
.sht-left-head { display: flex; align-items: center; gap: 11px; }
.sht-logo { width: 40px; height: 40px; border-radius: 11px; background: linear-gradient(135deg, #16A36A, #12B981); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 18px; flex: none; }
.sht-title { font-size: 18px; font-weight: 800; margin: 0; color: var(--text); }
.sht-sub { font-size: 12px; color: var(--text-muted); margin: 2px 0 0; }
.sht-points { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.sht-points li { font-size: 12.5px; color: var(--text-muted); line-height: 1.55; display: flex; gap: 8px; }
.sht-points li i { color: #16A36A; margin-top: 3px; flex: none; }
.sht-points b { color: var(--text); font-weight: 700; }

.sht-chat { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; padding: 4px 2px; }
.sht-msg { display: flex; gap: 8px; font-size: 12.5px; line-height: 1.5; padding: 9px 11px; border-radius: 11px; }
.sht-msg i { margin-top: 2px; flex: none; opacity: .7; }
.sht-msg-user { background: color-mix(in srgb, var(--primary) 10%, transparent); color: var(--text); align-self: flex-end; max-width: 92%; }
.sht-msg-ai { background: color-mix(in srgb, var(--text) 5%, transparent); color: var(--text); max-width: 96%; }

.sht-file-chip { display: flex; align-items: center; gap: 8px; padding: 8px 11px; border: 1px solid var(--border); border-radius: 9px; background: var(--bg); font-size: 12px; color: var(--text); }
.sht-file-chip i { color: #16A36A; }
.sht-file-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sht-file-x { border: none; background: transparent; color: var(--text-muted); cursor: pointer; padding: 2px; }
.sht-file-x:hover { color: var(--danger, #E14D52); }

.sht-composer { border: 1px solid var(--border); border-radius: 14px; background: var(--bg); padding: 10px 12px; }
.sht-composer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }

/* ---- AI 시트 모델 선택 드롭다운 ---- */
.sht-model-select { position: relative; }
.sht-model-btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--workspace); color: var(--text); border-radius: 8px; padding: 5px 10px; font-size: 12px; font-weight: 700; cursor: pointer; max-width: 260px; }
.sht-model-btn:hover { border-color: #16A36A; }
.sht-model-btn > i:first-child { color: #16A36A; }
.sht-model-btn #sht-model-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sht-model-btn .fa-chevron-down { font-size: 10px; color: var(--text-muted); margin-left: 2px; }
.sht-model-menu { position: absolute; bottom: calc(100% + 6px); left: 0; z-index: 40; width: 320px; max-height: 340px; overflow-y: auto; background: var(--workspace); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 10px 34px rgba(0,0,0,.18); padding: 6px; }
.sht-model-loading { padding: 14px; font-size: 12.5px; color: var(--text-muted); text-align: center; }
.sht-model-item { position: relative; display: block; width: 100%; text-align: left; border: 1px solid transparent; background: transparent; border-radius: 9px; padding: 9px 30px 9px 11px; cursor: pointer; color: var(--text); }
.sht-model-item:hover { background: color-mix(in srgb, #16A36A 8%, transparent); }
.sht-model-item.is-active { background: color-mix(in srgb, #16A36A 12%, transparent); border-color: color-mix(in srgb, #16A36A 30%, transparent); }
.sht-model-item-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sht-model-item-name { font-size: 13px; font-weight: 700; display: inline-flex; align-items: center; gap: 6px; }
.sht-model-rec { font-size: 10px; font-weight: 700; color: #fff; background: #16A36A; border-radius: 5px; padding: 1px 5px; }
.sht-model-price { font-size: 11px; color: #16A36A; font-weight: 700; }
.sht-model-item-desc { font-size: 11.5px; color: var(--text-muted); margin-top: 3px; line-height: 1.45; }
.sht-model-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.sht-model-tag { font-size: 10px; color: var(--text-muted); background: color-mix(in srgb, var(--text) 7%, transparent); border-radius: 5px; padding: 1px 6px; }
.sht-model-check { position: absolute; right: 11px; top: 12px; color: #16A36A; font-size: 12px; opacity: 0; }
.sht-model-item.is-active .sht-model-check { opacity: 1; }
.sht-mode { font-size: 12px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 6px; }
.sht-mode i { color: #16A36A; }
.sht-balance { font-size: 11px; color: var(--text-muted); }
.sht-input { width: 100%; border: none; background: transparent; resize: none; font-size: 13px; color: var(--text); outline: none; font-family: inherit; line-height: 1.5; }
.sht-composer-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.sht-composer-left { display: flex; align-items: center; gap: 10px; }
.sht-icon-btn { width: 30px; height: 30px; border-radius: 9px; border: 1px solid var(--border); background: var(--workspace); color: var(--text); cursor: pointer; }
.sht-icon-btn:hover { background: color-mix(in srgb, var(--primary) 8%, transparent); }
.sht-conn { font-size: 11.5px; color: var(--text-muted); display: flex; align-items: center; gap: 5px; }
.sht-send { width: 34px; height: 34px; border-radius: 10px; border: none; background: #16A36A; color: #fff; cursor: pointer; font-size: 14px; }
.sht-send:hover { background: #12905d; }
.sht-send:disabled { opacity: .5; cursor: default; }

.sht-summary { flex: none; font-size: 12px; color: var(--text-muted); line-height: 1.6; background: color-mix(in srgb, #16A36A 8%, transparent); border: 1px solid color-mix(in srgb, #16A36A 20%, transparent); border-radius: 10px; padding: 10px 12px; max-height: 18vh; overflow-y: auto; }
.sht-file-chip { flex: none; }
.sht-summary i { color: #16A36A; margin-right: 5px; }

/* ---- 우측 스프레드시트 ---- */
.sht-right { display: flex; flex-direction: column; min-width: 0; background: var(--workspace); }
.sht-topbar { display: flex; align-items: center; justify-content: space-between; padding: 9px 14px; border-bottom: 1px solid var(--border); }
.sht-topbar-left { display: flex; align-items: center; gap: 10px; }
.sht-file-open { background: #16A36A; color: #fff; border: none; padding: 7px 14px; border-radius: 8px; font-size: 12.5px; font-weight: 700; cursor: pointer; }
.sht-file-open:hover { background: #12905d; }
.sht-export { position: relative; }
.sht-export-btn { background: var(--bg); color: var(--text); border: 1px solid var(--border); padding: 7px 12px; border-radius: 8px; font-size: 12.5px; cursor: pointer; }
.sht-export-menu { position: absolute; top: 38px; left: 0; z-index: 20; background: var(--workspace); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 28px rgba(0,0,0,.15); padding: 6px; min-width: 210px; }
.sht-export-menu button { display: flex; align-items: center; gap: 9px; width: 100%; text-align: left; border: none; background: transparent; padding: 9px 11px; border-radius: 7px; font-size: 12.5px; color: var(--text); cursor: pointer; }
.sht-export-menu button:hover { background: color-mix(in srgb, var(--primary) 8%, transparent); }
.sht-export-menu i { width: 16px; color: #16A36A; }
.sht-fullscreen { background: transparent; border: 1px solid var(--border); color: var(--text); padding: 7px 12px; border-radius: 8px; font-size: 12.5px; cursor: pointer; }

.sht-ribbon-tabs { display: flex; gap: 2px; padding: 0 14px; border-bottom: 1px solid var(--border); background: var(--bg); }
.sht-rtab { font-size: 12.5px; padding: 8px 12px; color: var(--text-muted); cursor: default; border-bottom: 2px solid transparent; }
.sht-rtab.active { color: #16A36A; border-bottom-color: #16A36A; font-weight: 700; }

.sht-ribbon { display: flex; align-items: stretch; gap: 0; padding: 8px 12px; border-bottom: 1px solid var(--border); background: var(--workspace); overflow-x: auto; }
.sht-ribbon-group { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 0 10px; position: relative; padding-bottom: 16px; }
.sht-ribbon-sep { width: 1px; background: var(--border); margin: 2px 0; }
.sht-ribbon-label { position: absolute; bottom: 0; left: 0; right: 0; text-align: center; font-size: 10px; color: var(--text-muted); }
.sht-tool { min-width: 30px; height: 30px; padding: 0 8px; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--text); cursor: pointer; font-size: 13px; display: inline-flex; align-items: center; gap: 4px; }
.sht-tool:hover { background: color-mix(in srgb, var(--primary) 10%, transparent); border-color: var(--border); }
.sht-tool-danger:hover { background: color-mix(in srgb, var(--danger, #E14D52) 12%, transparent); color: var(--danger, #E14D52); }

.sht-formula-bar { display: flex; align-items: center; gap: 0; border-bottom: 1px solid var(--border); background: var(--workspace); }
.sht-cellref { width: 80px; text-align: center; font-size: 12.5px; color: var(--text); padding: 6px 8px; border-right: 1px solid var(--border); }
.sht-fx { padding: 0 10px; color: var(--text-muted); font-style: italic; border-right: 1px solid var(--border); font-size: 13px; }
.sht-formula-input { flex: 1; border: none; background: transparent; padding: 7px 12px; font-size: 13px; color: var(--text); outline: none; font-family: inherit; }

/* ---- 그리드 시인성 강화용 변수 (테마별 대비 최적화) ---- */
.sht-right {
  --sht-gridline: #C7CDD9;        /* 격자선(뚜렷) */
  --sht-cell-bg: #FFFFFF;         /* 데이터 셀 배경 */
  --sht-cell-alt: #F7F9FC;        /* 짝수 행 얼룩무늬 */
  --sht-head-bg: #EEF1F6;         /* 행/열 헤더 배경 */
  --sht-head-text: #47506B;       /* 헤더 글자 */
  --sht-head-line: #B4BCCC;       /* 헤더 경계선(진하게) */
  --sht-cell-text: #1B2233;       /* 셀 글자(진한 대비) */
  --sht-hover: #E8F5EE;           /* hover 하이라이트 */
  --sht-sel: #16A36A;             /* 선택 강조 */
  --sht-sel-fill: rgba(22,163,106,.10);
  --sht-headhi: rgba(22,163,106,.18); /* 선택 셀의 행/열 헤더 강조 */
}
[data-theme="dark"] .sht-right {
  --sht-gridline: #3A4152;
  --sht-cell-bg: #1C2130;
  --sht-cell-alt: #20263A;
  --sht-head-bg: #2A3142;
  --sht-head-text: #B9C2D6;
  --sht-head-line: #454E63;
  --sht-cell-text: #EAEEF7;
  --sht-hover: #223b30;
  --sht-sel: #29C084;
  --sht-sel-fill: rgba(41,192,132,.16);
  --sht-headhi: rgba(41,192,132,.30);
}

.sht-grid-scroll { flex: 1; overflow: auto; position: relative; background: var(--sht-cell-bg); }
.sht-grid { border-collapse: separate; border-spacing: 0; table-layout: fixed; font-size: 13px; }
/* 모든 칸에 오른쪽/아래 격자선을 그려 칸 구분을 또렷하게 */
.sht-grid th, .sht-grid td { border-right: 1px solid var(--sht-gridline); border-bottom: 1px solid var(--sht-gridline); }
.sht-grid thead th { position: sticky; top: 0; z-index: 3; background: var(--sht-head-bg); color: var(--sht-head-text); font-weight: 700; height: 30px; text-align: center; font-size: 12px; border-bottom: 2px solid var(--sht-head-line); }
.sht-corner { position: sticky; left: 0; top: 0; z-index: 5 !important; width: 46px; min-width: 46px; background: var(--sht-head-bg); border-right: 2px solid var(--sht-head-line) !important; }
.sht-colh { user-select: none; }
.sht-colh.hl { background: var(--sht-headhi); color: var(--sht-sel); }
.sht-rowh { position: sticky; left: 0; z-index: 2; background: var(--sht-head-bg); color: var(--sht-head-text); width: 46px; min-width: 46px; text-align: center; font-weight: 700; font-size: 12px; border-right: 2px solid var(--sht-head-line); }
.sht-rowh.hl { background: var(--sht-headhi); color: var(--sht-sel); }
.sht-cell { height: 30px; padding: 3px 9px; color: var(--sht-cell-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 320px; cursor: cell; background: var(--sht-cell-bg); }
/* 짝수 행 얼룩무늬 — 값이 있든 없든 모든 셀에 적용 */
.sht-grid tbody tr:nth-child(even) .sht-cell { background: var(--sht-cell-alt); }
.sht-cell:hover { background: var(--sht-hover); }
.sht-cell.b { font-weight: 700; }
.sht-cell.a-left { text-align: left; }
.sht-cell.a-center { text-align: center; }
.sht-cell.a-right { text-align: right; }
.sht-cell.sel { outline: 2.5px solid var(--sht-sel); outline-offset: -2px; background: var(--sht-sel-fill) !important; box-shadow: inset 0 0 0 9999px var(--sht-sel-fill); position: relative; z-index: 1; }
.sht-cell-edit { width: 100%; border: none; outline: none; background: var(--sht-cell-bg); color: var(--sht-cell-text); font-size: 13px; font-family: inherit; padding: 2px; }

.sht-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center; color: var(--text-muted); pointer-events: none; }
.sht-empty i { font-size: 42px; opacity: .3; }
.sht-empty p { font-size: 13.5px; line-height: 1.6; margin: 0; }
.sht-empty b { color: #16A36A; }

.sht-tabbar { display: flex; align-items: center; gap: 8px; padding: 5px 14px; border-top: 1px solid var(--border); background: var(--bg); font-size: 12px; color: var(--text-muted); }
.sht-sheet-tab { padding: 4px 14px; border: 1px solid var(--border); border-bottom: none; border-radius: 6px 6px 0 0; background: var(--workspace); color: var(--text); font-weight: 600; }
.sht-sheet-tab.active { color: #16A36A; }
.sht-sheet-add { border: none; background: transparent; color: var(--text-muted); cursor: pointer; }
.sht-status { margin-left: auto; }
.sht-zoom { padding-left: 10px; }

.sht-overlay { position: fixed; inset: 0; z-index: 90; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(3px); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; }
.sht-overlay p { font-size: 15px; font-weight: 700; color: var(--text); }
.sht-spinner { width: 46px; height: 46px; border: 4px solid color-mix(in srgb, #16A36A 25%, transparent); border-top-color: #16A36A; border-radius: 50%; animation: mtgSpin .8s linear infinite; }

@media (max-width: 960px) {
  .sht-wrap { grid-template-columns: 1fr; height: auto; overflow: visible; }
  .content:has(.sht-wrap) { overflow-y: auto; }
  .sht-left { border-right: none; border-bottom: 1px solid var(--border); max-height: 52vh; }
  .sht-right { min-height: 60vh; }
}

@media print {
  .sht-left, .sht-topbar, .sht-ribbon-tabs, .sht-ribbon, .sht-formula-bar, .sht-tabbar, .app-nav, .app-sidebar { display: none !important; }
  .sht-wrap { grid-template-columns: 1fr; }
  .sht-grid th, .sht-grid td { border: 1px solid #999; }
}
