:root {
  --ink: #26313d; --muted: #65665f; --line: #ded7c9; --line-strong: #c9c0af;
  --surface: #fffefa; --surface-soft: #f8f5ec; --surface-warm: #f2ead6;
  --green: #31465f; --green-dark: #26394f; --green-soft: #ecefd9;
  --gold: #9a6425; --coral: #934b47; --danger: #934b47; --white: #fffaf0;
  --auth-background: #f8f5ec; --sidebar-background: #31465f; --header-background: #fffefa;
  --olive: #656a34; --selection: #596547; --success: #3f6d55; --success-soft: #e6f0e9;
  --warning-soft: #f8ecd3; --danger-soft: #fdf6f5; --sidebar-muted: #bdc6cf;
  --sidebar-line: #647589; --sidebar-hover: #3e5269; --focus-ring: rgba(119,124,61,.22);
  --focus-ring-soft: rgba(119,124,61,.12); --overlay: rgba(38,57,79,.4);
  --shadow: 0 18px 50px rgba(38,57,79,.12); --shadow-soft: 0 8px 24px rgba(38,57,79,.1);
  --toast-background: #26394f; --calculator-line: #ded7c9; --calculator-hover: #f2ead6;
  font-family: "Noto Sans KR", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
}
body { font-size: 14px; line-height: 1.65; }
h1,h2,h3,p { overflow-wrap: anywhere; }
button,input,textarea,select { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--olive); outline-offset: 3px; }
.button,.icon-button,input,textarea,select { border-radius: 9px; }
input,select { min-height: 44px; }
input[type="radio"],input[type="checkbox"] { width: 18px; min-height: 18px; accent-color: var(--olive); box-shadow: none; }
.brand-logo { border-radius: 50%; }
.brand-logo-small { width: 34px; height: 34px; }
.auth-card { border-radius: 16px; }
.app-shell,.conversation-shell { height: 100dvh; background: var(--surface-soft); }
.case-sidebar { padding: 22px 16px 14px; color: var(--white); border: 0; min-height: 0; }
.sidebar-header { height: auto; padding: 0 8px 22px; }
.case-sidebar .brand-name { color: var(--white); font-size: 20px; font-weight: 750; }
.case-sidebar .brand-subtitle { color: var(--sidebar-muted); font-size: 11px; margin-top: 3px; }
.sidebar-primary { min-height: 44px; margin: 0; background: var(--white); color: var(--green-dark); font-size: 15px; }
.sidebar-primary:hover { background: var(--surface-warm); }
.sidebar-add { width: 100%; min-height: 38px; margin-top: 8px; color: var(--white); background: transparent; border-color: var(--sidebar-line); font-size: 12px; }
.sidebar-add:hover { background: var(--sidebar-hover); }
.sidebar-add svg { width: 15px; }
.sidebar-search { position: relative; display: block; margin: 14px 0 8px; }
.sidebar-search svg { position: absolute; width: 16px; top: 12px; left: 12px; color: var(--sidebar-muted); }
.sidebar-search input { min-height: 40px; padding: 9px 10px 9px 38px; color: var(--white); background: var(--sidebar-hover); border-color: var(--sidebar-line); font-size: 12px; }
.sidebar-search input::placeholder { color: var(--sidebar-muted); }
.sidebar-scroll { min-height: 0; flex: 1; overflow-y: auto; scrollbar-width: thin; }
.recent-nav { overflow: visible; }
.nav-label { display: flex; align-items: center; justify-content: space-between; padding: 16px 8px 8px; color: var(--sidebar-muted); font-size: 11px; }
.nav-label h2,.recent-nav .nav-label h2 { font-size: 11px; margin: 0; color: inherit; }
.nav-label button { color: inherit; background: none; border: 0; font-size: 11px; padding: 4px 0; }
.folder-list,.case-list { display: grid; gap: 3px; }
.folder-item,.case-list-item { display: flex; gap: 9px; align-items: center; width: 100%; min-width: 0; min-height: 52px; padding: 9px 10px; text-align: left; border: 0; border-radius: 9px; background: transparent; color: var(--white); }
.folder-item > svg { width: 26px; height: 26px; padding: 5px; background: var(--sidebar-hover); border-radius: 7px; }
.folder-item > span,.case-list-item > span { flex: 1; min-width: 0; color: inherit; }
.folder-item strong,.case-list-item strong { display: block; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.folder-item small,.case-list-item small { display: block; color: var(--sidebar-muted); font-size: 10px; margin-top: 3px; }
.folder-item:hover,.case-row:hover,.case-list-item:hover { background: var(--sidebar-hover); }
.folder-item[aria-current="true"],.case-row.is-active { background: var(--selection); }
.case-row { display: flex; align-items: center; border-radius: 9px; min-width: 0; }
.case-list-item { flex: 1; width: auto; min-height: 58px; }
.case-move { display: grid; place-items: center; width: 32px; min-width: 32px; height: 44px; padding: 0; border: 0; border-radius: 8px; color: var(--sidebar-muted); background: transparent; }
.case-move:hover { background: var(--sidebar-hover); color: var(--white); }
.case-move svg { width: 15px; }
.case-list-empty { color: var(--sidebar-muted); font-size: 11px; margin: 12px 8px; }
.sidebar-footer { display: block; margin-top: 18px; padding-top: 16px; border-color: var(--sidebar-line); }
.org-row { display: flex; gap: 9px; align-items: center; padding: 0 8px; }
.org-row > div { flex: 1; min-width: 0; }
.org-avatar { display: grid; place-items: center; width: 32px; height: 32px; flex-shrink: 0; background: var(--surface-warm); color: var(--green); border-radius: 9px; font-size: 12px; font-weight: 800; }
.tenant-select { min-height: 26px; padding: 0; margin: 0; border: 0; background: var(--green); color: var(--white); font-size: 11px; }
.account-label { color: var(--sidebar-muted); font-size: 10px; }
.account-actions { display: flex; justify-content: flex-end; margin-top: 6px; }
.account-actions .button { color: var(--sidebar-muted); width: auto; min-height: 32px; padding: 0 6px; font-size: 11px; }
.account-actions svg { width: 13px; }
.top-header { display: flex; padding: 0 24px 0 30px; }
.conversation-title { display: block; flex: 1; min-width: 0; }
.conversation-title strong { display: block; font-size: 18px; line-height: 1.45; }
.folder-breadcrumb { display: block; color: var(--olive); font-size: 10px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-actions { display: flex; align-items: center; gap: 14px; }
.header-actions .button { min-height: 36px; font-size: 11px; padding: 0 11px; }
.header-actions .button svg { width: 14px; }
.header-actions .icon-button { width: 36px; min-height: 36px; }
#source-count { display: inline-block; min-width: 20px; margin-left: 4px; padding: 0 4px; background: var(--olive); color: var(--white); border-radius: 6px; }
.privacy-note { display: inline-flex; align-items: center; gap: 7px; font-size: 11px; color: var(--muted); }
.privacy-note svg { width: 14px; }
.conversation-shell.is-empty { grid-template-rows: 64px minmax(290px,1fr) auto minmax(60px,.7fr); }
.conversation-shell.is-empty::after { content: ""; }
.empty-state { min-height: 100%; justify-content: flex-end; padding: 32px 24px 26px; }
.empty-mascot { width: 152px; height: 152px; }
.empty-state h1 { margin: 20px 0 0; font-size: 28px; letter-spacing: -.6px; line-height: 1.4; }
.empty-state p { margin: 10px 0 0; max-width: none; }
.empty-state .empty-folder-note { color: var(--olive); font-size: 11px; }
.composer { width: min(780px,calc(100% - 48px)); margin: 10px auto 22px; border-radius: 16px; box-shadow: var(--shadow); }
.composer textarea { min-height: 62px; max-height: 180px; padding: 16px 20px 8px; font-size: 14px; line-height: 1.65; }
.composer:focus-within { outline: 2px solid var(--olive); outline-offset: 2px; }
.composer textarea:focus-visible { outline: none; }
.composer-actions { justify-content: space-between; padding: 4px 8px 8px 19px; }
.composer-privacy { font-size: 11px; }
.icon-button-send { border-radius: 11px; }
.conversation { width: min(820px,calc(100% - 48px)); padding: 30px 0 10px; }
.conversation:empty { display: none; }
.turn { margin-bottom: 30px; }
.turn-user p { max-width: 76%; padding: 13px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px 16px 4px 16px; }
.turn-assistant { display: grid; grid-template-columns: 44px minmax(0,1fr); gap: 12px; }
.turn-content { width: 100%; }
.turn-user p { color: var(--ink); }
.turn-content > .assistant-label { margin: 0 0 24px; }
.empty-mascot { margin-bottom: 0; }
.composer { padding: 0; }
.intake-summary dl div { padding: 0; border: 0; background: transparent; }
.question-field { border: 0; padding: 0; border-radius: 0; }
.calculation-status,.evidence-status { padding: 0; background: transparent; border-radius: 0; }
.confirmed-inputs dd { text-align: left; }
.expert-draft { padding: 0; border: 0; background: transparent; font-size: 14px; }
.turn-avatar { width: 36px; height: 36px; border-radius: 50%; }
.assistant-label { font-size: 13px; font-weight: 700; margin: 0 0 24px; min-height: 24px; }
.assistant-label small { font-size: 11px; font-weight: 400; color: var(--muted); margin-left: 10px; }
.intake-summary { padding: 16px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.intake-summary dl { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; }
.intake-summary dl > div { display: block; }
.clarification-form { padding: 22px 24px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.question-field { margin-bottom: 14px; }
.unknown-control { display: flex; align-items: center; gap: 7px; }
.choice-control { display: flex; flex-wrap: wrap; gap: 8px; }
.choice-control label { display: flex; align-items: center; gap: 7px; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: 9px; }
.choice-control label:has(input:checked) { color: var(--olive); border-color: var(--olive); background: var(--green-soft); }
.answer-document { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); overflow: hidden; }
.answer-summary { padding: 22px 26px; background: var(--surface-warm); }
.answer-summary .calculation-status { color: var(--olive); font-size: 11px; font-weight: 700; margin: 0 0 4px; }
.answer-summary h2 { color: var(--muted); font-size: 13px; }
.answer-summary h2 { margin: 4px 0; }
.answer-summary .calculation-status { display: block; min-height: 0; }
.answer-section h3 { font-size: 14px; margin: 0 0 12px; }
.conversation-shell:not(.is-empty) .composer textarea { height: 44px; min-height: 44px; padding-top: 10px; }
.answer-amount { font-size: 38px; font-weight: 800; letter-spacing: -1px; line-height: 1.3; margin: 10px 0; }
.answer-summary .answer-conclusion { color: var(--muted); font-size: 13px; }
.answer-section { padding: 22px 26px; border-top: 1px solid var(--line); }
.calculator-breakdown { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; margin: 0; }
.calculator-breakdown > div { display: block; padding: 12px 14px; background: var(--surface-soft); border-radius: 10px; border: 0; }
.calculator-breakdown > div:last-child { background: var(--green-soft); }
.calculator-breakdown dd { font-size: 15px; margin: 4px 0 0; }
.confirmed-inputs { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px 20px; }
.confirmed-inputs > div { display: block; }
.confirmed-inputs dd { margin: 4px 0 0; font-size: 13px; font-weight: 500; }
.answer-document > .review-section { margin: 0; padding: 18px 26px; border-top: 1px solid var(--line); }
.review-section ul { margin: 0; font-size: 13px; }
.answer-document > .turn-actions { padding: 16px 26px; margin: 0; border-top: 1px solid var(--line); justify-content: flex-end; }
.review-controls { padding: 20px 26px; border-top: 1px solid var(--line); }
.review-controls p { color: var(--muted); font-size: 12px; margin: 4px 0 14px; }
.review-controls .turn-actions { margin: 0; justify-content: flex-end; }
.approval-record { padding: 15px 20px; border-left: 3px solid var(--success); background: var(--success-soft); margin-bottom: 16px; border-radius: 7px; }
.approval-record strong,.approval-record span { display: block; }
.approval-record span { font-size: 12px; margin-top: 4px; }
.approval-record.is-changes { background: var(--warning-soft); border-color: var(--gold); }
.source-context { margin-top: 14px; color: var(--muted); font-size: 12px; }
.source-context ul { padding-left: 20px; }
.modal { width: min(520px,calc(100% - 32px)); max-height: calc(100dvh - 48px); border-radius: 16px; overflow-y: auto; background: var(--surface); }
.modal-card { padding: 26px; }
.modal-card > label { display: block; margin-top: 18px; font-size: 13px; font-weight: 700; }
.modal-card > label input { margin-top: 8px; }
.modal-actions { justify-content: flex-end; }
.dialog-header { padding: 18px 20px; margin: 0; border-bottom: 1px solid var(--line); }
.dialog-header h2 { margin: 0; }
.modal-card .dialog-header { padding: 0 0 16px; }
.dialog-body { padding: 18px 20px; overflow-y: auto; }
.side-dialog { width: 380px; max-width: 100%; height: 100dvh; max-height: 100dvh; margin: 0 0 0 auto; padding: 0; border-radius: 0; }
.side-dialog { color: var(--ink); }
.side-dialog[open] { display: grid; grid-template-rows: auto minmax(0,1fr); }
.reference-date { padding: 13px; border: 1px solid var(--line); background: var(--surface-soft); border-radius: 12px; margin: 0 0 22px; }
.reference-date > label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 8px; }
.reference-date > div { display: flex; gap: 6px; }
.reference-date input { flex: 1; min-width: 0; min-height: 36px; font-size: 11px; padding: 7px; }
.reference-date .button { font-size: 10px; padding: 0 9px; min-height: 36px; }
.reference-date p { font-size: 10px; color: var(--muted); line-height: 1.6; margin: 7px 0 0; }
.evidence-group { margin: 0 0 24px; }
.evidence-group > h3 { font-size: 12px; margin: 0 0 10px; }
.evidence-item { border: 1px solid var(--line); border-left: 3px solid var(--gold); border-radius: 11px; padding: 13px 14px; margin-top: 8px; }
.evidence-item.is-verified { border-left-color: var(--success); }
.evidence-item.is-conflict { border-left-color: var(--danger); background: var(--danger-soft); }
.evidence-item h3 { font-size: 13px; }
.evidence-item p,.evidence-item dd { font-size: 11px; color: var(--muted); line-height: 1.7; }
.evidence-item dt { font-size: 10px; font-weight: 700; color: var(--danger); }
.evidence-item dd { margin: 3px 0 8px; }
.calculation-dialog { width: min(720px,calc(100% - 32px)); }
.calculation-step { padding: 16px 0; border-bottom: 1px solid var(--line); }
.calculation-step h3 { color: var(--olive); }
.calculation-step dl > div { display: flex; justify-content: space-between; gap: 20px; margin: 8px 0; }
.calculation-step dd { font-size: 13px; text-align: right; margin: 0; }
.calculation-step p { font-size: 13px; }
.scope-note { padding: 13px 14px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 10px; font-size: 12px; color: var(--muted); }
.move-folders { margin: 18px 0; padding: 0; border: 0; display: grid; gap: 8px; max-height: 40dvh; overflow-y: auto; }
.move-folder { display: flex; gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.move-folder:has(input:checked) { border-color: var(--olive); background: var(--green-soft); }
.move-folder strong,.move-folder small { display: block; }
.move-folder small { color: var(--muted); font-size: 11px; }
.source-add-actions { display: flex; flex-wrap: wrap; gap: 7px; margin: 18px 0 12px; }
.source-add-actions .button { padding: 0 10px; min-height: 38px; font-size: 11px; }
.source-add-actions svg { width: 14px; }
.source-row { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 11px; padding: 8px; margin-top: 10px; }
.source-open { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; border: 0; background: none; text-align: left; color: var(--ink); padding: 8px; }
.source-open > span { min-width: 0; }
.source-open strong { display: block; overflow-wrap: anywhere; font-size: 12px; }
.source-open small { display: block; margin-top: 4px; font-size: 10px; color: var(--muted); }
.source-preview-body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; max-height: 55dvh; overflow-y: auto; }
.field-error:empty { display: none; }
.mobile-only { display: none; }
@media (max-width: 1100px) { .privacy-note { display: none; } .top-header { padding: 0 20px; } .calculator-breakdown { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media (max-width: 760px) {
  .mobile-only { display: inline-flex; }
  .case-sidebar { width: min(320px,calc(100% - 48px)); visibility: hidden; }
  .case-sidebar.is-open { visibility: visible; }
  .sidebar-header .icon-button { background: transparent; border: 0; color: var(--white); }
  .conversation-shell.is-empty { grid-template-rows: 58px minmax(280px,1fr) auto minmax(20px,.55fr); }
  .top-header { gap: 10px; padding: 0 12px; background: var(--green); color: var(--white); }
  .top-header .icon-button { color: var(--white); background: transparent; border-color: var(--sidebar-line); width: 34px; min-width: 34px; min-height: 34px; }
  .conversation-title strong { font-size: 14px; }
  .folder-breadcrumb { color: var(--sidebar-muted); font-size: 9px; }
  .header-actions { gap: 6px; }
  .header-actions .button { padding: 0 7px; font-size: 10px; background: transparent; border-color: var(--sidebar-line); color: var(--white); min-height: 34px; }
  .header-actions .button svg,#calculator-entry { display: none; }
  .empty-state { padding: 20px 22px 25px; }
  .empty-mascot { width: 128px; height: 128px; }
  .empty-state h1 { font-size: 22px; letter-spacing: -.5px; max-width: 300px; }
  .empty-state p { font-size: 13px; }
  .composer { margin: 8px auto max(10px,env(safe-area-inset-bottom)); border-radius: 14px; }
  .composer textarea { padding: 14px 15px 6px; font-size: 14px; }
  .composer-actions { padding-left: 14px; }
  .composer-privacy { display: block; font-size: 10px; }
  .conversation { width: calc(100% - 28px); padding-top: 22px; }
  .turn-user p { max-width: 88%; font-size: 13px; padding: 11px 13px; }
  .turn-assistant { grid-template-columns: 28px minmax(0,1fr); gap: 8px; }
  .turn-avatar { width: 28px; height: 28px; }
  .turn-content { display: contents; }
  .assistant-label { grid-column: 2; align-self: center; font-size: 12px; margin-bottom: 14px; }
  .assistant-label small { font-size: 10px; margin-left: 6px; }
  .turn-content > :not(.assistant-label) { grid-column: 1 / -1; }
  .turn-content h2 { font-size: 17px; }
  .clarification-form { margin-top: 10px; padding: 18px; }
  .intake-summary { padding: 14px; margin-top: 8px; }
  .intake-summary dl { gap: 10px; }
  .intake-summary dd { font-size: 12px; }
  .intake-summary dt { font-size: 10px; }
  .answer-summary,.answer-section,.answer-document > .review-section,.review-controls { padding: 18px; }
  .answer-summary h2 { font-size: 12px; }
  .answer-amount { font-size: 32px; }
  .calculator-breakdown > div { padding: 10px; }
  .calculator-breakdown dd { font-size: 13px; }
  .calculator-breakdown dt { font-size: 10px; }
  .answer-document > .turn-actions { padding: 14px; justify-content: stretch; }
  .turn-actions .button { font-size: 12px; padding: 0 12px; }
  .side-dialog,.calculation-dialog { width: 100%; max-width: 100%; height: 100dvh; max-height: 100dvh; border: 0; border-radius: 0; margin: 0; }
  .calculation-dialog[open] { display: grid; grid-template-rows: auto minmax(0,1fr); }
  .move-dialog { width: 100%; max-width: 100%; margin: auto 0 0; border-radius: 18px 18px 0 0; max-height: 90dvh; }
  .modal-card { padding: 22px; }
  .modal-actions .button { font-size: 12px; padding: 0 12px; }
}
@media (prefers-reduced-motion: reduce) { *,*::before,*::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
