:root {
  --cream: #f5f1e8;
  --paper: #fffdf8;
  --paper-strong: #ffffff;
  --navy: #142b35;
  --navy-soft: #28434c;
  --teal: #0f766e;
  --teal-dark: #0a5c56;
  --teal-pale: #e2f1ed;
  --sand: #e7dfd1;
  --line: #ded8cc;
  --muted: #6f7775;
  --danger: #a8483e;
  --warning: #966e24;
  --shadow: 0 18px 55px rgba(20, 43, 53, .12);
  --radius: 16px;
  font-family: Inter, Pretendard, "Noto Sans KR", "Apple SD Gothic Neo", system-ui, sans-serif;
  color: var(--navy);
  background: var(--cream);
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { min-width: 320px; overflow: hidden; background: var(--cream); }
button, textarea, input { font: inherit; }
button { color: inherit; }
button:focus-visible, textarea:focus-visible, input:focus-visible { outline: 3px solid rgba(15,118,110,.24); outline-offset: 2px; }
svg { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.app-shell { display: grid; grid-template-columns: 296px minmax(0, 1fr); height: 100%; }
.sidebar { display: flex; flex-direction: column; min-height: 0; overflow-y: auto; padding: 27px 24px 22px; color: #edf4f1; background: var(--navy); z-index: 20; }
.brand-row { display: flex; align-items: center; gap: 12px; padding-bottom: 24px; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid rgba(255,255,255,.2); border-radius: 11px; background: rgba(255,255,255,.06); }
.brand-mark svg { width: 23px; color: #89c8ba; }
.brand-row h1 { margin: 2px 0 0; font-size: 17px; font-weight: 650; letter-spacing: -.02em; }
.eyebrow { margin: 0; color: var(--teal); font-size: 10px; font-weight: 800; letter-spacing: .14em; }
.sidebar .eyebrow { color: #80c1b4; }
.icon-button { display: grid; place-items: center; width: 38px; height: 38px; border: 0; border-radius: 10px; background: transparent; cursor: pointer; }
.icon-button svg { width: 21px; }
.close-sidebar { display: none; margin-left: auto; color: #fff; font-size: 27px; }
.side-section { padding: 21px 0; border-top: 1px solid rgba(255,255,255,.1); }
.side-section h2 { margin: 0 0 13px; color: #dde7e3; font-size: 12px; font-weight: 650; letter-spacing: .02em; }
.section-heading { display: flex; align-items: center; justify-content: space-between; }
.section-heading h2 { margin-bottom: 13px; }
.status-dot { display: inline-block; flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; background: #76c7aa; box-shadow: 0 0 0 4px rgba(118,199,170,.1); }
.status-dot.loading { background: #d7b15d; animation: pulse 1.25s infinite; }
.status-dot.offline { background: #db8177; box-shadow: 0 0 0 4px rgba(219,129,119,.1); }
@keyframes pulse { 50% { opacity: .45; } }
.corpus-card { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; overflow: hidden; border-radius: 12px; background: rgba(255,255,255,.09); }
.corpus-number { padding: 14px; background: rgba(255,255,255,.045); }
.corpus-number strong { display: block; color: white; font-family: Georgia, serif; font-size: 25px; font-weight: 500; }
.corpus-number span { color: #9fb0ae; font-size: 11px; }
.small { font-size: 11px; line-height: 1.55; }
.muted { color: #91a3a2; }
.secondary-button { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 39px; border: 1px solid rgba(255,255,255,.16); border-radius: 10px; color: #e5efec; background: rgba(255,255,255,.06); cursor: pointer; transition: .2s; }
.secondary-button:hover { border-color: rgba(255,255,255,.28); background: rgba(255,255,255,.1); }
.secondary-button:disabled { cursor: wait; opacity: .6; }
.secondary-button svg { width: 15px; }
.secondary-button.busy svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.full { width: 100%; }
.sync-result { min-height: 0; margin: 8px 0 0; color: #a5c7c0; }
.permission-note { margin: 9px 2px 0; color: #c6d4d1; }
.mode-picker { display: grid; gap: 7px; }
.mode-picker label { display: block; cursor: pointer; }
.mode-picker input { position: absolute; opacity: 0; pointer-events: none; }
.mode-picker span { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 8px; padding: 10px 12px; border: 1px solid transparent; border-radius: 9px; color: #b9c6c4; transition: .2s; }
.mode-picker b { font-size: 12px; font-weight: 600; }
.mode-picker small { color: #7f9391; font-size: 10px; }
.mode-picker input:checked + span { border-color: rgba(112,190,174,.35); color: white; background: rgba(45,137,123,.2); }
.mode-picker input:checked + span small { color: #a8cec7; }
.mode-picker input:focus-visible + span { outline: 3px solid rgba(112,190,174,.25); }
.runtime dl { margin: 0; }
.runtime dl div { display: flex; justify-content: space-between; gap: 12px; margin: 8px 0; font-size: 11px; }
.runtime dt { color: #849795; }
.runtime dd { overflow: hidden; margin: 0; color: #dce8e5; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
.ollama-state { display: flex; align-items: center; gap: 8px; margin-top: 14px; padding: 10px 11px; border-radius: 9px; color: #bac9c6; background: rgba(255,255,255,.045); font-size: 11px; }
.text-button { border: 0; cursor: pointer; }
.evaluation-button { display: flex; align-items: center; gap: 9px; margin-top: auto; padding: 12px 4px 4px; color: #a8bab7; background: transparent; font-size: 12px; }
.evaluation-button svg { width: 17px; }
.main-content { position: relative; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-width: 0; min-height: 0; background: radial-gradient(circle at 60% 8%, rgba(255,255,255,.75), transparent 30%), var(--cream); }
.topbar { display: flex; align-items: center; min-height: 72px; padding: 14px 30px; border-bottom: 1px solid rgba(20,43,53,.08); }
.menu-button { display: none; margin-right: 10px; }
.snapshot-note { display: flex; align-items: center; gap: 10px; }
.snapshot-note svg { width: 19px; color: var(--teal); }
.snapshot-note span { display: flex; flex-direction: column; }
.snapshot-note b { font-size: 12px; font-weight: 650; }
.snapshot-note small { margin-top: 1px; color: var(--muted); font-size: 10px; }
.new-chat { display: flex; align-items: center; gap: 7px; margin-left: auto; padding: 9px 13px; border: 1px solid var(--line); border-radius: 10px; color: var(--navy-soft); background: rgba(255,255,255,.48); cursor: pointer; }
.new-chat:hover { background: white; }
.new-chat svg { width: 16px; }
.new-chat span { font-size: 12px; }
.conversation { overflow-y: auto; scroll-behavior: smooth; }
.welcome { width: min(790px, calc(100% - 44px)); margin: clamp(58px, 9vh, 110px) auto 50px; text-align: center; }
.welcome-symbol { display: grid; place-items: center; width: 62px; height: 62px; margin: 0 auto 22px; border: 1px solid #c8ddd7; border-radius: 19px; color: var(--teal); background: rgba(255,255,255,.65); box-shadow: 0 10px 35px rgba(30,94,86,.08); }
.welcome-symbol svg { width: 34px; }
.welcome h2 { margin: 10px 0 14px; font-family: Georgia, "Noto Serif KR", serif; font-size: clamp(29px, 3.3vw, 43px); font-weight: 500; line-height: 1.3; letter-spacing: -.035em; }
.welcome > p:not(.eyebrow) { max-width: 580px; margin: 0 auto; color: var(--muted); font-size: 14px; line-height: 1.75; }
.example-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 11px; margin-top: 35px; text-align: left; }
.example-question { min-height: 95px; padding: 15px 16px; border: 1px solid var(--line); border-radius: 13px; color: #31474e; background: rgba(255,253,248,.72); cursor: pointer; font-size: 12px; line-height: 1.5; transition: transform .2s, border-color .2s, background .2s; }
.example-question:hover { transform: translateY(-2px); border-color: #b7cec8; background: white; }
.example-question span { display: block; margin-bottom: 8px; color: var(--teal); font-size: 10px; font-weight: 700; }
.messages { display: none; width: min(820px, calc(100% - 44px)); margin: 0 auto; padding: 42px 0 25px; }
.messages.active { display: block; }
.message { margin-bottom: 28px; }
.message.user { display: flex; justify-content: flex-end; }
.user-bubble { max-width: 76%; padding: 13px 17px; border-radius: 18px 18px 4px 18px; color: #f5fbf9; background: var(--navy); font-size: 14px; line-height: 1.65; white-space: pre-wrap; }
.assistant-message { position: relative; padding-left: 42px; }
.assistant-avatar { position: absolute; top: 0; left: 0; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; color: white; background: var(--teal); font-family: Georgia, serif; font-size: 15px; }
.answer-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-height: 27px; margin-bottom: 8px; }
.answer-meta strong { font-size: 12px; }
.pill { padding: 4px 7px; border-radius: 999px; color: var(--teal-dark); background: var(--teal-pale); font-size: 9px; font-weight: 700; letter-spacing: .03em; }
.pill.warning { color: var(--warning); background: #f7edda; }
.latency { color: var(--muted); font-size: 10px; }
.answer-body { color: #273e46; font-size: 14px; line-height: 1.8; white-space: pre-wrap; }
.notice { margin: 12px 0 0; padding: 11px 13px; border-left: 3px solid #d5aa57; border-radius: 3px 9px 9px 3px; color: #76571b; background: #fbf4e5; font-size: 11px; line-height: 1.55; }
.notice.error { border-color: #ca6a61; color: #863c35; background: #f9e9e6; }
.loading-answer { display: inline-flex; gap: 5px; padding: 8px 0; }
.loading-answer i { width: 6px; height: 6px; border-radius: 50%; background: var(--teal); animation: dot 1.1s infinite; }
.loading-answer i:nth-child(2) { animation-delay: .15s; }.loading-answer i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 40% { transform: translateY(-5px); opacity: .5; } }
.sources { margin-top: 19px; }
.sources-head { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.sources-head h3 { margin: 0; font-size: 11px; font-weight: 700; }
.sources-count { color: var(--muted); font-size: 10px; }
.source-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.source-card { display: flex; flex-direction: column; min-width: 0; padding: 13px; border: 1px solid var(--line); border-radius: 11px; color: inherit; background: rgba(255,255,255,.58); text-align: left; cursor: pointer; transition: .2s; }
.source-card:hover { border-color: #a9c7c0; background: white; }
.source-top { display: flex; align-items: center; gap: 7px; }
.source-index { display: grid; place-items: center; flex: 0 0 auto; width: 20px; height: 20px; border-radius: 6px; color: var(--teal-dark); background: var(--teal-pale); font-size: 9px; font-weight: 800; }
.source-title { overflow: hidden; font-size: 11px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.citation-badge { flex: 0 0 auto; margin-left: auto; padding: 3px 6px; border-radius: 999px; color: var(--teal-dark); background: var(--teal-pale); font-size: 8px; font-weight: 800; }
.source-snippet { display: -webkit-box; overflow: hidden; margin: 8px 0 9px; color: #64706f; font-size: 10px; line-height: 1.55; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.validated-quotes { display: grid; gap: 5px; margin: 1px 0 10px; padding: 9px 10px; border-left: 2px solid #79aa9e; border-radius: 0 7px 7px 0; color: #3d565b; background: #edf5f2; }
.validated-quotes > span { color: var(--teal); font-size: 8px; font-weight: 800; letter-spacing: .04em; }
.validated-quotes q { font-size: 9px; line-height: 1.5; quotes: "“" "”"; }
.source-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; color: #7b8886; font-size: 9px; }
.raw-score { flex: 0 0 auto; color: #70817e; font-variant-numeric: tabular-nums; }
.feedback { display: flex; align-items: center; gap: 5px; margin-top: 14px; color: var(--muted); font-size: 10px; }
.feedback button { width: 29px; height: 29px; border: 1px solid transparent; border-radius: 8px; background: transparent; cursor: pointer; }
.feedback button:hover, .feedback button.selected { border-color: var(--line); color: var(--teal); background: white; }
.feedback svg { width: 14px; }
.composer-wrap { width: min(850px, calc(100% - 36px)); margin: 0 auto; padding: 12px 0 17px; }
.composer { display: flex; align-items: flex-end; gap: 10px; padding: 9px 9px 9px 17px; border: 1px solid #cec8bb; border-radius: 17px; background: var(--paper); box-shadow: 0 10px 32px rgba(34,52,58,.09); transition: border-color .2s, box-shadow .2s; }
.composer:focus-within { border-color: #73a99d; box-shadow: 0 10px 38px rgba(22,103,94,.13); }
.composer textarea { flex: 1; max-height: 140px; min-height: 34px; resize: none; border: 0; outline: 0; color: var(--navy); background: transparent; font-size: 14px; line-height: 1.55; }
.composer textarea::placeholder { color: #949a96; }
.send-button { display: grid; place-items: center; flex: 0 0 auto; width: 37px; height: 37px; border: 0; border-radius: 11px; color: white; background: var(--teal); cursor: pointer; }
.send-button:hover { background: var(--teal-dark); }.send-button:disabled { color: #aeb8b5; background: #e5e8e4; cursor: default; }
.send-button svg { width: 18px; }
.composer-wrap > p { margin: 7px 0 0; color: #7c817e; font-size: 9px; text-align: center; }
.modal { width: min(700px, calc(100% - 32px)); max-height: min(82vh, 780px); padding: 0; border: 1px solid var(--line); border-radius: 17px; color: var(--navy); background: var(--paper); box-shadow: var(--shadow); }
.modal::backdrop { background: rgba(10,28,34,.52); backdrop-filter: blur(3px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 19px 22px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 4px 0 0; font-family: Georgia, "Noto Serif KR", serif; font-size: 21px; font-weight: 500; }
.modal-head .icon-button { font-size: 25px; }
.modal-body { overflow: auto; max-height: calc(82vh - 82px); padding: 23px; }
.source-detail dl { display: grid; grid-template-columns: 90px 1fr; gap: 8px 14px; margin: 0 0 22px; font-size: 11px; }
.source-detail dt { color: var(--muted); }.source-detail dd { margin: 0; overflow-wrap: anywhere; }
.source-detail a { color: var(--teal); }
.source-full-text { padding: 18px; border-radius: 12px; color: #32474e; background: #f3efe6; font-size: 13px; line-height: 1.8; white-space: pre-wrap; }
.json-tree { display: grid; gap: 7px; }
.json-row { display: grid; grid-template-columns: minmax(120px, .6fr) minmax(0, 1fr); gap: 12px; padding: 10px 12px; border-radius: 9px; background: #f3efe6; font-size: 11px; }
.json-key { color: var(--muted); overflow-wrap: anywhere; }.json-value { color: var(--navy); font-weight: 600; overflow-wrap: anywhere; white-space: pre-wrap; }
.json-group { margin: 5px 0 12px; padding-left: 13px; border-left: 2px solid #c7ddd7; }
.json-group-title { margin: 12px 0 7px; color: var(--teal); font-size: 11px; font-weight: 750; overflow-wrap: anywhere; }
.evaluation-report { display: grid; gap: 19px; }
.evaluation-caveat { display: flex; align-items: flex-start; gap: 12px; padding: 13px 15px; border: 1px solid #e7d6aa; border-radius: 11px; color: #70551f; background: #fbf4e3; }
.evaluation-caveat strong { flex: 0 0 auto; font-size: 11px; }
.evaluation-caveat span { font-size: 10px; line-height: 1.55; }
.metric-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.metric-card { min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.metric-card span { display: block; margin-bottom: 7px; color: var(--muted); font-size: 9px; }
.metric-card strong { display: block; overflow: hidden; font-size: 12px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.evaluation-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 11px; }
.evaluation-table { width: 100%; min-width: 790px; border-collapse: collapse; background: #fff; font-size: 10px; }
.evaluation-table th, .evaluation-table td { padding: 11px 12px; border-bottom: 1px solid #ebe6dc; text-align: right; white-space: nowrap; }
.evaluation-table thead th { color: var(--muted); background: #f3efe6; font-size: 9px; font-weight: 650; }
.evaluation-table th:first-child { text-align: left; }
.evaluation-table tbody th { color: var(--navy); font-weight: 700; }
.evaluation-table tbody tr:last-child th, .evaluation-table tbody tr:last-child td { border-bottom: 0; }
.evaluation-caption { margin: -11px 2px 0; color: var(--muted); font-size: 9px; line-height: 1.55; }
.evaluation-limits { padding: 15px 17px; border-radius: 11px; background: #f3efe6; }
.evaluation-limits h3 { margin: 0 0 9px; font-size: 11px; }
.evaluation-limits ul { margin: 0; padding-left: 18px; color: #5e6b6c; font-size: 10px; line-height: 1.65; }
.generation-evaluation { display: grid; gap: 11px; padding-top: 2px; }
.generation-evaluation h3 { margin: 0; font-size: 12px; }
.dense-comparison { display: grid; gap: 11px; padding-top: 2px; }
.dense-comparison h3 { margin: 0; font-size: 12px; }
.evaluation-caveat.neutral { border-color: #c8dcd7; color: var(--navy-soft); background: #edf5f2; }
.generation-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.raw-evaluation { border-top: 1px solid var(--line); }
.raw-evaluation summary { padding: 15px 2px 0; color: var(--teal); font-size: 10px; font-weight: 700; cursor: pointer; }
.raw-evaluation-body { margin-top: 13px; }
.empty-state { padding: 35px 15px; color: var(--muted); font-size: 12px; text-align: center; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 100; max-width: min(380px, calc(100% - 44px)); padding: 11px 15px; border-radius: 10px; color: white; background: var(--navy); box-shadow: var(--shadow); font-size: 11px; opacity: 0; pointer-events: none; transform: translateY(10px); transition: .25s; }
.toast.show { opacity: 1; transform: translateY(0); }
.sidebar-scrim { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(316px, 88vw); transform: translateX(-101%); transition: transform .25s ease; box-shadow: var(--shadow); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-scrim { position: fixed; inset: 0; z-index: 15; background: rgba(8,24,29,.4); }
  .sidebar.open + .sidebar-scrim { display: block; }
  .close-sidebar, .menu-button { display: grid; }
}
@media (max-width: 620px) {
  .topbar { min-height: 64px; padding: 10px 14px; }
  .snapshot-note small { display: none; }
  .new-chat span { display: none; }
  .new-chat { padding: 9px; }
  .welcome { width: calc(100% - 30px); margin-top: 42px; }
  .welcome h2 { font-size: 29px; }
  .example-grid { grid-template-columns: 1fr; gap: 8px; margin-top: 26px; }
  .example-question { min-height: 68px; }
  .messages { width: calc(100% - 28px); padding-top: 27px; }
  .user-bubble { max-width: 88%; }
  .assistant-message { padding-left: 0; padding-top: 38px; }
  .source-list { grid-template-columns: 1fr; }
  .composer-wrap { width: calc(100% - 22px); padding-bottom: 10px; }
  .composer-wrap > p { display: none; }
  .json-row { grid-template-columns: 1fr; gap: 4px; }
  .metric-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .generation-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .evaluation-caveat { flex-direction: column; gap: 5px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; } }
