:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #667085;
  --paper: #ffffff;
  --canvas: #f4f6fa;
  --accent: #e83d52;
  --line: #e4e7ec;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--canvas); }
.shell { width: min(1120px, 100%); min-height: 100vh; margin: 0 auto; background: var(--paper); }
.topbar { min-height: 68px; padding: 16px clamp(20px, 4vw, 48px); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.brand { color: var(--ink); font-size: 18px; font-weight: 800; text-decoration: none; }
.link-button { border: 0; background: transparent; color: var(--muted); cursor: pointer; font: inherit; }
.artifact { padding: clamp(24px, 5vw, 64px); }
.artifact-heading { margin-bottom: 28px; }
.artifact-heading h1 { margin: 6px 0 0; font-size: clamp(28px, 5vw, 46px); line-height: 1.16; }
.eyebrow { margin: 0; color: var(--accent); font-size: 13px; font-weight: 800; letter-spacing: .08em; }
.version-toolbar { margin: -10px 0 24px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.version-caption { color: var(--muted); font-size: 14px; font-weight: 700; }
.version-badge, .version-menu summary { min-height: 42px; padding: 0 14px; border: 1px solid var(--line); border-radius: 11px; display: inline-flex; align-items: center; color: var(--ink); background: #f8fafc; font-weight: 800; }
.version-menu { position: relative; }
.version-menu summary { cursor: pointer; list-style: none; }
.version-menu summary::-webkit-details-marker { display: none; }
.version-menu summary::after { margin-left: 12px; color: var(--muted); content: "▾"; }
.version-menu[open] summary::after { content: "▴"; }
.version-options { position: absolute; z-index: 10; top: calc(100% + 7px); left: 0; min-width: 190px; padding: 7px; border: 1px solid var(--line); border-radius: 12px; display: grid; gap: 2px; background: white; box-shadow: 0 12px 30px rgb(23 32 51 / 14%); }
.version-options a { padding: 10px 12px; border-radius: 8px; color: var(--ink); font-weight: 700; text-decoration: none; white-space: nowrap; }
.version-options a:hover, .version-options a:focus-visible, .version-options a[aria-current="page"] { background: #f2f4f7; }
.latest-version-link { color: #175cd3; font-size: 14px; font-weight: 800; text-decoration: none; }
.preview-panel { width: 100%; height: min(72vh, 760px); overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: #eef1f6; }
.preview-panel iframe { width: 100%; height: 100%; border: 0; }
.file-card { min-height: 260px; padding: 32px; border: 1px solid var(--line); border-radius: 18px; background: linear-gradient(145deg, #fff, #f7f8fb); display: flex; align-items: center; justify-content: center; gap: 20px; }
.file-card p { margin: 7px 0 0; color: var(--muted); }
.file-icon { width: 72px; height: 86px; border-radius: 10px; background: var(--accent); color: white; display: grid; place-items: center; font-size: 12px; font-weight: 900; }
.metadata { margin: 28px 0; display: grid; gap: 12px; }
.metadata div { display: grid; grid-template-columns: 92px 1fr; gap: 14px; }
.metadata dt { color: var(--muted); }
.metadata dd { margin: 0; overflow-wrap: anywhere; }
.artifact-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.action-button { min-height: 48px; padding: 0 22px; border: 1px solid var(--line); border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; color: var(--ink); background: white; cursor: pointer; font: inherit; font-weight: 800; text-decoration: none; }
.action-button:disabled { cursor: wait; opacity: .58; }
.download { border-color: var(--accent); color: white; background: var(--accent); }
.drive-action { color: #344054; background: #f8fafc; }
.drive-result { min-height: 28px; margin-top: 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; color: var(--muted); }
.drive-result a { color: #175cd3; font-weight: 800; }
.drive-result-success { color: #067647; }
.drive-result-error { color: #b42318; }
.empty-state { min-height: calc(100vh - 68px); padding: 40px 24px; display: grid; place-content: center; text-align: center; }
.empty-state h1 { margin: 8px 0; }
.empty-state p { color: var(--muted); }
.error-code { color: var(--accent) !important; font-weight: 900; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.workspace-shell { width: min(1600px, 100%); }
.workspace { min-height: calc(100vh - 68px); }
.workspace-tabs { display: none; }
.workspace-grid { height: calc(100vh - 68px); display: grid; grid-template-columns: minmax(320px, 38%) minmax(0, 1fr); overflow: hidden; }
.chat-pane, .document-pane { min-width: 0; min-height: 0; background: var(--paper); }
.chat-pane { border-right: 1px solid var(--line); display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto; }
.document-pane { overflow: auto; }
.pane-heading { padding: 22px 24px 18px; border-bottom: 1px solid var(--line); }
.pane-heading h1 { margin: 0; font-size: 20px; }
.pane-heading p { margin: 5px 0 0; color: var(--muted); font-size: 14px; }
.chat-messages { padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; scroll-behavior: smooth; }
.chat-empty { margin: auto; color: var(--muted); text-align: center; }
.chat-message { max-width: 88%; padding: 11px 14px; border-radius: 15px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; }
.chat-message-user { align-self: flex-end; color: white; background: var(--accent); border-bottom-right-radius: 5px; }
.chat-message-assistant { align-self: flex-start; background: #f2f4f7; border-bottom-left-radius: 5px; }
.chat-progress { min-height: 38px; padding: 9px 20px; color: var(--muted); border-top: 1px solid var(--line); font-size: 14px; }
.chat-composer { padding: 14px 16px 18px; border-top: 1px solid var(--line); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: end; background: white; }
.chat-composer textarea { width: 100%; max-height: 160px; resize: vertical; padding: 12px 14px; border: 1px solid #cfd4dc; border-radius: 12px; color: var(--ink); background: white; font: inherit; line-height: 1.45; }
.chat-composer button { min-height: 46px; padding: 0 18px; border: 0; border-radius: 12px; color: white; background: var(--accent); cursor: pointer; font: inherit; font-weight: 800; }
.chat-composer button:disabled, .chat-composer textarea:disabled { cursor: not-allowed; opacity: .58; }
.chat-composer textarea:focus-visible, .chat-composer button:focus-visible, .workspace-tabs button:focus-visible, .action-button:focus-visible, .link-button:focus-visible { outline: 3px solid rgb(23 92 211 / 35%); outline-offset: 2px; }
.document-pane .artifact { padding: clamp(22px, 3.5vw, 48px); }
.document-empty { min-height: 100%; display: grid; place-content: center; color: var(--muted); text-align: center; }
.tab-update { margin-left: 7px; padding: 2px 7px; border-radius: 999px; color: white; background: var(--accent); font-size: 11px; font-weight: 900; }

@media (max-width: 680px) {
  .workspace-topbar { min-height: 58px; padding: 12px 18px; }
  .workspace { min-height: calc(100vh - 58px); }
  .workspace-tabs { height: 48px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr 1fr; background: white; }
  .workspace-tabs button { border: 0; border-bottom: 3px solid transparent; color: var(--muted); background: white; font: inherit; font-weight: 800; cursor: pointer; }
  .workspace-tabs button[aria-selected="true"] { border-bottom-color: var(--accent); color: var(--ink); }
  .workspace-grid { height: calc(100vh - 106px); display: block; }
  .chat-pane, .document-pane { height: 100%; }
  .chat-pane { border-right: 0; }
  .workspace[data-active-tab="chat"] .document-pane,
  .workspace[data-active-tab="document"] .chat-pane { display: none; }
  .pane-heading { padding: 15px 18px 12px; }
  .chat-messages { padding: 16px; }
  .chat-composer { padding: 10px 12px max(12px, env(safe-area-inset-bottom)); }
  .artifact { padding: 24px 18px 40px; }
  .version-toolbar { align-items: stretch; }
  .version-caption { width: 100%; }
  .version-menu { width: 100%; }
  .version-menu summary { width: 100%; justify-content: space-between; }
  .version-options { width: 100%; min-width: 0; }
  .preview-panel { height: 62vh; border-radius: 12px; }
  .file-card { min-height: 220px; padding: 24px; flex-direction: column; text-align: center; }
  .metadata div { grid-template-columns: 74px 1fr; }
  .artifact-actions { display: grid; grid-template-columns: 1fr; }
  .action-button { width: 100%; }
}
