:root {
  --ink: #17211e;
  --ink-soft: #28342f;
  --muted: #69746f;
  --line: #dce3dd;
  --paper: #f2f4ef;
  --surface: #fff;
  --green: #1d6a49;
  --green-deep: #124b34;
  --green-soft: #eaf3ec;
  --lime: #d8f26e;
  --amber: #c77c38;
  --shadow: 0 20px 55px rgba(27, 48, 39, .075);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: Inter, Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
button, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.ambient-orb { position: fixed; z-index: -1; top: -220px; right: -180px; width: 640px; height: 640px; border-radius: 50%; background: radial-gradient(circle, rgba(216, 242, 110, .28), rgba(216, 242, 110, 0) 67%); pointer-events: none; }
.page-shell { width: min(1720px, 100%); margin: 0 auto; padding: 0 44px; }

.topbar { position: relative; height: 66px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 28px; align-items: center; border-bottom: 1px solid rgba(23, 33, 30, .12); }
.brand { display: inline-flex; width: max-content; gap: 11px; align-items: center; color: var(--ink); text-decoration: none; }
.brand-mark { width: 36px; height: 36px; display: grid; place-items: center; background: var(--ink); color: var(--lime); border-radius: 11px 11px 11px 3px; font: 600 18px Georgia, serif; box-shadow: 0 8px 18px rgba(23, 33, 30, .14); }
.brand-copy { display: flex; flex-direction: column; gap: 2px; }
.brand-copy b { font-size: 17px; letter-spacing: -.04em; }
.brand-copy small { color: var(--muted); font-size: 7px; font-weight: 800; letter-spacing: .18em; }
.main-tabs { width: max-content; justify-self: start; display: flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,255,255,.58); }
.tab-button { border: 0; padding: 10px 18px; border-radius: 7px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 720; transition: .2s ease; }
.tab-button:hover { color: var(--ink); }
.tab-button.active { color: white; background: #347457; box-shadow: 0 4px 12px rgba(52,116,87,.2); }
.topbar-actions { position: relative; justify-self: end; display: flex; gap: 9px; align-items: center; }
.topbar-demo-label { margin-left: 12px; color: #a4632d; font-size: 20px; letter-spacing: -.04em; }
.options-button { padding: 10px 16px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink); font-size: 12px; font-weight: 760; text-decoration: none; }
.options-button:hover, .options-button.active { border-color: #347457; background: #347457; color: white; }
.option-tabs { display: flex; gap: 4px; margin-top: 22px; padding: 5px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,255,255,.58); }
.option-tabs button { flex: 1; border: 0; border-radius: 7px; padding: 11px 16px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 720; }
.option-tabs button:hover { color: var(--ink); background: var(--green-soft); }
.option-tabs button.active { background: #347457; color: white; box-shadow: 0 4px 12px rgba(52,116,87,.2); }
.status-chip { background: rgba(255,255,255,.68); border: 1px solid var(--line); padding: 10px 14px; border-radius: 999px; color: var(--muted); font-size: 12px; font-weight: 650; }
.status-chip i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #d39744; margin-right: 7px; }
.status-chip.online i { background: #3da56f; box-shadow: 0 0 0 4px rgba(61,165,111,.12); }
.icon-button { width: 36px; height: 36px; border: 1px solid var(--line); background: var(--surface); border-radius: 50%; color: var(--ink); font-size: 17px; transition: transform .25s; }
.icon-button:hover { transform: rotate(35deg); }
.engine-chip { display: flex; align-items: center; gap: 7px; padding-right: 5px; }
.engine-chip small { display: grid; place-items: center; width: 21px; height: 21px; border-radius: 6px; background: var(--green-soft); color: var(--green); font-size: 7px; font-weight: 850; }
.engine-chip b { font-size: 11px; letter-spacing: -.02em; }
.mode-popover { position: absolute; z-index: 20; top: 49px; right: 45px; width: 275px; padding: 16px; border: 1px solid var(--line); border-radius: 13px; background: white; box-shadow: 0 18px 45px rgba(23,33,30,.16); }
.mode-popover::before { content: ""; position: absolute; top: -5px; right: 38px; width: 9px; height: 9px; transform: rotate(45deg); border-left: 1px solid var(--line); border-top: 1px solid var(--line); background: white; }
.popover-heading { display: flex; align-items: center; gap: 10px; }
.popover-heading .demo-icon { width: 31px; height: 31px; }
.popover-heading strong { display: block; font-size: 11px; }
.popover-heading small { display: block; margin-top: 3px; color: var(--amber); font-size: 8px; font-weight: 750; }
.mode-popover > p { margin: 13px 0; color: var(--muted); font-size: 9px; line-height: 1.6; }
.mode-popover > button { width: 100%; border: 1px solid #dfc69c; border-radius: 8px; background: #fff9ec; color: #79501d; padding: 9px; font-size: 8px; font-weight: 780; }

.tab-view { animation: reveal .32s ease both; }
@keyframes reveal { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
.hero { min-height: 300px; display: flex; align-items: end; justify-content: space-between; padding: 66px 0 46px; gap: 50px; }
.hero-main { max-width: 830px; }
.eyebrow { margin: 0 0 12px; color: var(--green); font-size: 9px; font-weight: 850; letter-spacing: .2em; }
.hero h1, .guide-hero h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(48px, 5vw, 74px); line-height: .98; letter-spacing: -.055em; font-weight: 500; }
.hero h1 span { color: var(--green); }
.hero-copy { max-width: 610px; margin: 23px 0 0; color: var(--muted); font-size: 14px; line-height: 1.75; }
.hero-status-card { min-width: 245px; display: flex; align-items: center; gap: 16px; margin-bottom: 3px; padding: 20px 21px; border: 1px solid rgba(29,106,73,.2); border-radius: 15px; background: rgba(255,255,255,.58); backdrop-filter: blur(12px); }
.pulse-ring { width: 39px; height: 39px; display: grid; place-items: center; border: 1px solid rgba(29,106,73,.24); border-radius: 50%; }
.pulse-ring span { width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 6px rgba(29,106,73,.09); }
.hero-status-card p { margin: 0 0 4px; color: var(--muted); font-size: 9px; }
.hero-status-card strong { display: block; font-size: 15px; }
.hero-status-card > div:last-child > span { display: inline-block; margin-top: 5px; color: var(--green); font-size: 9px; font-weight: 750; }

.metrics { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; background: var(--surface); box-shadow: var(--shadow); }
.metric-card { min-height: 108px; padding: 16px 18px; border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.metric-card:last-child { border-right: 0; }
.metric-card.accent-card { background: linear-gradient(135deg, var(--green), var(--green-deep)); color: white; }
.metric-top { display: flex; justify-content: space-between; align-items: center; }
.metric-label { color: var(--ink-soft); font-size: 10px; font-weight: 800; }
.metric-index { color: #aab3ae; font: italic 11px Georgia, serif; }
.accent-card .metric-label, .accent-card small, .accent-card .metric-index { color: rgba(255,255,255,.66); }
.metric-card strong { margin-top: 8px; font: 500 29px Georgia, serif; letter-spacing: -.04em; }
.metric-card .date-value { font: 750 15px/1.3 Inter, sans-serif; letter-spacing: -.035em; }
.metric-card small { margin-top: auto; color: var(--muted); font-size: 9px; line-height: 1.35; }
.status-summary { display: flex; align-items: baseline; justify-content: flex-end; gap: 38px; padding: 7px 2px 20px; border-bottom: 1px solid var(--line); }
.status-summary > div { display: flex; align-items: baseline; gap: 12px; }
.status-summary span { color: var(--muted); font-size: 13px; font-weight: 750; }
.status-summary strong { color: var(--ink); font: 750 26px Inter, Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; letter-spacing: -.03em; }
.status-summary .needs-review span, .status-summary .needs-review strong { color: #a4632d; }
html.desktop-ui .topbar .status-summary { gap: 20px; padding: 0; border: 0; }
html.desktop-ui .topbar .status-summary > div { gap: 7px; }
html.desktop-ui .topbar .status-summary span { font-size: 12px; }
html.desktop-ui .topbar .status-summary strong { font-size: 20px; }

.workspace-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(350px, .85fr); gap: 18px; padding: 18px 0 50px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); }
.composer-panel { padding: 30px; }
.history-panel { padding: 28px 0 8px; overflow: hidden; }
.panel-heading { display: flex; align-items: start; justify-content: space-between; gap: 20px; }
.panel-heading.compact { padding: 0 26px 18px; align-items: center; }
.panel-heading h2 { margin: 0; font-size: 21px; letter-spacing: -.04em; }
.section-description { margin: 8px 0 0; color: var(--muted); font-size: 11px; }
.quiet-badge { padding: 7px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 9px; white-space: nowrap; }
.quiet-badge i { display: inline-block; width: 5px; height: 5px; margin-right: 5px; border-radius: 50%; background: var(--green); }
.text-button { border: 0; background: transparent; color: var(--green); font-size: 10px; font-weight: 780; padding: 6px 0; }

form { margin-top: 29px; }
.field-head { display: flex; justify-content: space-between; margin-bottom: 9px; color: var(--muted); font-size: 9px; }
label { color: var(--ink-soft); font-size: 10px; font-weight: 750; }
.field-head b { color: var(--ink); }
textarea { width: 100%; min-height: 164px; resize: vertical; border: 1px solid var(--line); border-radius: 13px; padding: 18px; color: var(--ink); background: #fafbf8; outline: none; line-height: 1.7; transition: border-color .2s, box-shadow .2s; }
textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(29,106,73,.08); }
textarea::placeholder { color: #a4ada8; }
.suggestion-row { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-top: 11px; }
.suggestion-row > span { color: var(--muted); font-size: 9px; margin-right: 2px; }
.suggestion { border: 1px solid var(--line); border-radius: 999px; background: white; color: var(--muted); padding: 6px 9px; font-size: 9px; }
.suggestion:hover { color: var(--green); border-color: rgba(29,106,73,.35); background: var(--green-soft); }
.form-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 15px; }
.form-footer p { margin: 0; color: var(--muted); font-size: 9px; }
.form-footer p i { display: inline-block; width: 5px; height: 5px; margin-right: 6px; border-radius: 50%; background: #d49a4d; }
.primary-button { display: flex; align-items: center; gap: 30px; border: 0; border-radius: 10px; background: var(--ink); color: white; padding: 13px 15px 13px 18px; font-size: 11px; font-weight: 750; transition: transform .2s, background .2s; }
.primary-button:hover { background: var(--green-deep); transform: translateY(-1px); }
.primary-button:disabled { opacity: .55; transform: none; cursor: wait; }
.primary-button b { color: var(--lime); font-size: 17px; }
.answer-area { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 22px; }
.answer-label, .evidence-head { display: flex; justify-content: space-between; align-items: center; color: var(--green); font-size: 10px; font-weight: 800; }
.answer-label button { border: 0; background: transparent; color: var(--muted); font-size: 9px; }
#answer-text { margin: 13px 0 18px; padding: 18px; border-left: 3px solid var(--green); border-radius: 3px 12px 12px 3px; background: #f0f6ef; line-height: 1.75; font-size: 13px; white-space: pre-wrap; }
.evidence-head { color: var(--ink-soft); margin-bottom: 9px; }
.evidence-head small { color: var(--muted); font-weight: 500; }
.match-list { display: flex; gap: 7px; flex-wrap: wrap; }
.match-pill { padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); font-size: 8px; }
.match-pill b { color: var(--green); }
.history-summary { display: grid; grid-template-columns: .8fr 1.2fr; padding: 9px 26px; border-top: 1px solid var(--line); background: #fafbf8; color: #969f9a; font-size: 8px; font-weight: 750; text-transform: uppercase; }
.history-list { max-height: 510px; overflow: auto; }
.history-item { position: relative; padding: 18px 26px 19px; border-top: 1px solid var(--line); }
.history-item:first-child { border-top: 0; }
.history-item::before { content: ""; position: absolute; top: 22px; left: 14px; width: 3px; height: 3px; border-radius: 50%; background: var(--green); }
.history-item time { color: var(--green); font-size: 8px; font-weight: 800; letter-spacing: .06em; }
.history-item h3 { margin: 7px 0 6px; font-size: 12px; line-height: 1.5; }
.history-item p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.empty-state { padding: 60px 24px; text-align: center; color: var(--muted); font-size: 11px; }

/* Consultation-first dashboard */
.dashboard-main { padding: 0; }
.dashboard-title-row { display: flex; align-items: end; justify-content: space-between; gap: 40px; margin-bottom: 34px; }
.dashboard-title-row h1 { margin: 0; font: 500 clamp(42px, 4.5vw, 66px)/1 Georgia, serif; letter-spacing: -.05em; }
.dashboard-title-row > div:first-child > p:last-child { margin: 15px 0 0; color: var(--muted); font-size: 12px; }
.engine-summary { min-width: 220px; padding: 16px 18px; border-left: 2px solid var(--green); }
.engine-summary span { display: block; color: var(--muted); font-size: 8px; font-weight: 750; letter-spacing: .08em; }
.engine-summary strong { display: block; margin-top: 6px; font-size: 14px; }
.engine-summary small { display: block; margin-top: 5px; color: var(--green); font-size: 8px; font-weight: 750; }
.demo-notice { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 14px; padding: 17px 20px; border: 1px solid #e8d2ad; border-radius: 14px; background: #fff9ec; }
.demo-notice > div { display: flex; align-items: center; gap: 13px; }
.demo-icon { width: 34px; height: 34px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 10px; background: #f1dfbd; color: #8a5a20; font: italic 15px Georgia, serif; }
.demo-notice strong { display: block; color: #66441d; font-size: 11px; }
.demo-notice p { margin: 4px 0 0; color: #90734f; font-size: 9px; line-height: 1.5; }
.demo-notice button { flex: 0 0 auto; border: 1px solid #ddc391; border-radius: 8px; background: rgba(255,255,255,.6); color: #76501f; padding: 8px 10px; font-size: 8px; font-weight: 750; }
.case-panel { margin-top: 18px; overflow: hidden; }
.desktop-consultation-layout { display: grid; grid-template-columns: 350px minmax(0, 1fr); gap: 14px; align-items: stretch; height: calc(100dvh - 92px); min-height: 460px; }
.desktop-detail-shell { position: relative; min-width: 0; height: 100%; margin-top: 18px; overflow: hidden; background: var(--surface); }
.desktop-detail-shell iframe { width: 100%; height: 100%; border: 0; background: var(--paper); }
.desktop-detail-placeholder { height: 100%; display: grid; place-items: center; color: var(--muted); font-size: 14px; }
.case-toolbar { display: flex; align-items: center; gap: 10px; padding: 18px 20px; }
.case-search { width: min(330px, 32%); display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid var(--line); border-radius: 9px; background: #fafbf8; }
.case-search > span { color: var(--muted); font: 18px Georgia, serif; transform: rotate(-15deg); }
.case-search input { min-width: 0; width: 100%; height: 39px; border: 0; outline: 0; background: transparent; color: var(--ink); font: inherit; font-size: 11px; }
.case-search input::placeholder { color: #a2aaa6; }
.case-filters { display: flex; gap: 5px; flex: 1; }
.filter-button { border: 1px solid var(--line); border-radius: 999px; background: white; color: var(--muted); padding: 7px 10px; font-size: 8px; font-weight: 680; }
.filter-button:hover { border-color: rgba(29,106,73,.3); color: var(--green); }
.filter-button.active { border-color: #347457; background: #347457; color: white; }
.sync-button { margin-left: auto; border: 0; border-radius: 8px; background: var(--green-soft); color: var(--green); padding: 10px 13px; font-size: 10px; font-weight: 780; white-space: nowrap; }
.sync-button:disabled { opacity: .6; cursor: wait; }
.case-table-head, .case-row { display: grid; grid-template-columns: 100px 90px 135px minmax(280px, 1fr) 120px; gap: 20px; align-items: center; }
.case-table-head { min-height: 44px; padding: 0 22px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #f8faf7; color: #6d7772; font-size: 11px; font-weight: 820; letter-spacing: .035em; }
.case-list { min-height: 310px; max-height: 570px; overflow: auto; }
.case-row { min-height: 105px; padding: 19px 22px; border-bottom: 1px solid var(--line); transition: background .18s; }
.case-row:hover, .case-row:focus-visible { background: #f7faf7; outline: 0; box-shadow: inset 3px 0 var(--green); }
.case-row.selected { background: var(--green-soft); box-shadow: inset 4px 0 var(--green); }
.case-row { cursor: pointer; }
.case-meta-row { min-width: 0; display: flex; align-items: center; gap: 7px; }
.case-meta { display: flex; flex-direction: column; align-items: start; gap: 9px; }
.case-category { width: max-content; max-width: none; flex: 0 0 auto; padding: 6px 8px; border-radius: 6px; background: var(--green-soft); color: var(--green); font-size: 9px; font-weight: 850; white-space: nowrap; }
.case-category.delivery, .category-input.delivery { background: var(--green-soft); color: var(--green); }
.case-category.return { background: #f7ebdf; color: #a4632d; }
.case-category.order { background: #e9eef7; color: #536b9b; }
.case-category.product { background: #f1eaf6; color: #77558d; }
.category-input.return { background: #f7ebdf; color: #a4632d; }
.category-input.order { background: #e9eef7; color: #536b9b; }
.category-input.product { background: #f1eaf6; color: #77558d; }
.category-input.other { background: #eef1ed; color: var(--muted); }
.case-type { display: flex; align-items: center; }
.case-channel { width: 29px; height: 29px; display: grid; place-items: center; border-radius: 9px; color: white; font-size: 13px; font-weight: 900; }
.case-channel.naver { background: #03c75a; }
.case-channel.kakao { background: #fee500; color: #191919; }
.case-channel.channel-talk { background: var(--ink); color: var(--lime); }
.case-customer-name { min-width: 0; overflow: hidden; color: var(--ink); font-size: 14px; font-weight: 800; letter-spacing: -.025em; text-overflow: ellipsis; white-space: nowrap; }
.case-date { color: var(--muted); font-size: 11px; }
.case-recent { min-width: 0; max-width: 100%; margin: 0; color: var(--ink-soft); font-size: 13px; line-height: 1.65; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-overflow: ellipsis; }
.case-meta time { color: var(--muted); font-size: 8px; }
.case-question strong { display: block; margin-bottom: 7px; font-size: 11px; line-height: 1.5; }
.case-question small { color: #9aa39e; font-size: 8px; }
.case-answer { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.65; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.case-status { display: inline-flex; flex: 0 0 auto; align-items: center; padding: 4px 9px; border: 1px solid transparent; border-radius: 999px; font-size: 10px; font-weight: 800; line-height: 1.2; white-space: nowrap; }
.case-status.needs-review { border-color: #e3bd92; background: #fff4e7; color: #9a5724; }
.case-status.answered { border-color: #bccae3; background: #f0f4fb; color: #47618f; }
.case-status.automatic { border-color: #abd2bc; background: #eef8f1; color: #17623f; }
.case-status.error { border-color: #e3b4ae; background: #fff1ef; color: #aa3f33; }
.case-footer { display: flex; justify-content: space-between; padding: 13px 22px; background: #fafbf8; color: var(--muted); font-size: 8px; }
.case-footer small { color: #9ca49f; }

/* Consultation detail */
.detail-topbar { grid-template-columns: minmax(0, 1fr) auto; }
.detail-nav { width: min(650px, 100%); display: flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,255,255,.58); }
.detail-nav a { padding: 10px 18px; border-radius: 7px; color: var(--muted); font-size: 12px; font-weight: 720; text-decoration: none; white-space: nowrap; }
.detail-nav a:hover { color: var(--ink); background: var(--green-soft); }
.detail-nav .detail-guide-link { margin-left: auto; border-left: 1px solid var(--line); border-radius: 0 7px 7px 0; }
.detail-header-actions { justify-self: end; display: flex; align-items: center; gap: 14px; }
.detail-page-label { color: var(--muted); font-size: 11px; font-weight: 760; letter-spacing: -.02em; }
.header-back-link { justify-self: end; color: var(--green); font-size: 10px; font-weight: 780; text-decoration: none; }
.header-back-link:hover { text-decoration: underline; }
.detail-page { padding: 24px 0 48px; }
.back-button { border: 0; background: transparent; color: var(--green); padding: 8px 0; font-size: 10px; font-weight: 780; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, .65fr); gap: 17px; margin-top: 14px; }
.detail-conversation { min-height: 430px; padding: 16px 28px 18px; }
.conversation-channel-header { display: flex; align-items: center; gap: 8px; padding: 0 2px 12px; }
.conversation-channel-header .channel-logo { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 7px; color: white; font-size: 10px; font-weight: 900; }
.conversation-channel-header .channel-logo.naver { background: #03c75a; }
.conversation-channel-header .channel-logo.kakao { background: #fee500; color: #191919; }
.conversation-channel-header strong { font-size: 13px; letter-spacing: -.02em; }
.detail-section-title span { color: var(--green); font-size: 8px; font-weight: 850; letter-spacing: .15em; }
.detail-section-title h1, .detail-section-title h2 { margin: 8px 0 0; font-size: 18px; letter-spacing: -.035em; }
.detail-section-title > h1:first-child, .detail-section-title > h2:first-child { margin-top: 0; }
.conversation-title { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
#detail-messages { height: 430px; padding: 8px 14px 10px 10px; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; border: 1px solid #e1e6e1; border-radius: 13px; background: #f5f7f3; box-shadow: inset 0 2px 8px rgba(23,33,30,.045); scroll-behavior: smooth; }
#detail-messages:focus-visible { outline: 2px solid rgba(29,106,73,.3); outline-offset: 4px; }
.message { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 13px; margin-top: 30px; }
.message-avatar { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: #d9efe1; color: #155d3d; border: 2px solid #8bc6a0; font: 800 14px Inter, sans-serif; }
.manager-message .message-avatar { background: #edf3ee; color: #9aa8a0; border-color: #dce6df; }
.message > div:last-child { width: fit-content; max-width: min(88%, 680px); min-width: 0; }
.message time { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; justify-content: flex-start; font-size: 11px; font-weight: 600; line-height: 1.25; }
.message-date { color: var(--muted); font-size: .78em; font-weight: 650; }
.message-clock { color: var(--ink); font-weight: 800; }
.message-bubbles { display: grid; justify-items: start; gap: 5px; margin-top: 8px; }
.message-bubble { width: fit-content; max-width: 100%; }
.message-bubble p { width: fit-content; max-width: 100%; margin: 0; padding: 17px 19px; overflow-wrap: anywhere; border: 1px solid #dbe2dc; border-radius: 5px 14px 14px 14px; background: #f3f5f1; font-size: 16px; line-height: 1.7; box-shadow: 0 4px 12px rgba(23,33,30,.035); }
.customer-message .message-bubble p { border-color: #c8d5cc; border-left: 3px solid #347457; background: #fff; color: #101916; font-weight: 540; box-shadow: 0 7px 18px rgba(23,33,30,.075); }
.customer-message .message-bubble:not(:first-child) p { border-radius: 5px 14px 14px 5px; }
.customer-message .message-bubble:not(:last-child) p { border-bottom-left-radius: 5px; }
.message-image { position: relative; width: min(100%, 520px); min-height: 150px; margin: 10px 0 0; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: #eef1ed; }
.message-image::before { content: "사진 불러오는 중…"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 11px; }
.message-image a { position: relative; z-index: 1; display: block; }
.message-image img { display: block; width: 100%; max-height: 430px; object-fit: contain; opacity: 0; transition: opacity .18s ease; background: #f5f7f4; }
.message-image.loaded { min-height: 0; }
.message-image.loaded::before { display: none; }
.message-image.loaded img { opacity: 1; }
.message-image.failed::before { content: "사진을 불러오지 못했습니다"; }
.message-image figcaption { position: relative; z-index: 2; margin: 0; padding: 8px 11px; overflow: hidden; color: var(--muted); background: var(--surface); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.message-unsupported { color: var(--muted); font-style: italic; }
.manager-message { grid-template-columns: minmax(0, 1fr) 38px; margin-left: 9%; }
.manager-message .message-avatar { grid-column: 2; grid-row: 1; }
.manager-message > div:last-child { grid-column: 1; grid-row: 1; justify-self: end; }
.manager-message time { align-items: flex-end; justify-content: flex-end; }
.manager-message .message-bubbles { justify-items: end; }
.manager-message .message-bubble p { border-color: #dbe6dd; border-radius: 14px 5px 14px 14px; background: #edf3ee; color: #34423c; }
.manager-message .message-bubble:not(:first-child) p { border-radius: 14px 5px 5px 14px; }
.manager-message .message-bubble:not(:last-child) p { border-bottom-right-radius: 5px; }
.conversation-date-divider { display: flex; align-items: center; gap: 12px; margin: 22px 4px -7px; color: var(--muted); font-size: 11px; font-weight: 700; }
.conversation-date-divider::before, .conversation-date-divider::after { content: ""; height: 1px; flex: 1; background: #d6ddd6; }
.conversation-date-divider span { padding: 0 3px; white-space: nowrap; }
.conversation-line { width: 1px; height: 28px; margin: 12px 0 -20px 18px; background: var(--line); }
.reply-composer { margin-top: 10px; }
.reply-status-badge { display: inline-flex; width: max-content; padding: 7px 9px; border-radius: 999px; background: #f7ebdf; color: #a4632d; font-size: 10px; font-weight: 800; letter-spacing: 0; }
.reply-status-badge.automatic { background: var(--green-soft); color: var(--green); }
.reply-status-badge.review { background: #f7ebdf; color: #a4632d; }
.reply-status-badge.completed { background: #e9eef7; color: #536b9b; }
.reply-composer textarea { width: 100%; height: 132px; min-height: 132px; box-sizing: border-box; margin-top: 0; padding: 16px; resize: vertical; border: 1px solid var(--line); border-radius: 10px; outline: 0; background: #fafbf8; color: var(--ink); font: inherit; font-size: 16px; line-height: 1.6; }
.reply-composer textarea:focus { border-color: rgba(29,106,73,.45); box-shadow: 0 0 0 3px rgba(29,106,73,.07); }
.reply-compose-row { display: grid; grid-template-columns: minmax(0, 1fr) 116px; gap: 10px; align-items: stretch; }
.reply-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.reply-actions button { border-radius: 8px; padding: 11px 14px; font-size: 11px; font-weight: 780; }
.reply-primary-actions { flex-direction: column; margin-top: 0; }
.reply-primary-actions button { flex: 1; width: 100%; padding: 7px 9px; white-space: nowrap; }
.reply-actions button:disabled { opacity: .55; cursor: wait; }
.generate-reply-button { border: 1px solid var(--line); background: white; color: var(--green); }
.send-reply-button { border: 0; background: var(--green); color: white; }
.detail-sidebar { display: flex; flex-direction: column; gap: 17px; }
.detail-info { padding: 23px; }
.detail-info dl { margin: 0; }
.detail-info dl > div { display: grid; grid-template-columns: 88px 1fr; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); }
.detail-info dt { color: var(--muted); font-size: 10px; }
.detail-info dd { margin: 0; font-size: 11px; font-weight: 680; overflow-wrap: anywhere; }
.detail-info dd.mono { color: var(--green-deep); font-family: "SFMono-Regular", Consolas, monospace; font-size: 8px; line-height: 1.6; }
.detail-knowledge-list { display: grid; gap: 10px; min-width: 0; max-height: 320px; margin-top: 20px; padding-right: 6px; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.detail-knowledge-section { margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--line); }
.detail-knowledge-item { min-width: 0; overflow: hidden; padding: 13px; border: 1px solid var(--line); border-radius: 10px; background: #fafbf8; }
.detail-knowledge-item > div { display: flex; justify-content: space-between; align-items: center; }
.detail-knowledge-item > div span { color: var(--green); font-size: 9px; font-weight: 800; }
.detail-knowledge-item > div b { color: var(--green); font-size: 10px; }
.detail-knowledge-item > strong { display: block; min-width: 0; margin-top: 9px; font-size: 11px; line-height: 1.45; overflow-wrap: anywhere; word-break: break-word; }
.detail-knowledge-item > p { min-width: 0; margin: 6px 0 0; color: var(--muted); font-size: 10px; line-height: 1.55; overflow-wrap: anywhere; word-break: break-word; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.empty-state.compact { padding: 24px 8px; }
.raw-detail { margin-top: 17px; overflow: hidden; }
.raw-detail > button { width: 100%; display: flex; justify-content: space-between; border: 0; background: white; padding: 16px 20px; color: var(--ink-soft); font-size: 9px; font-weight: 760; }
.raw-detail pre { max-height: 340px; overflow: auto; margin: 0; padding: 20px; border-top: 1px solid var(--line); background: #15201c; color: #dce8df; font-size: 9px; line-height: 1.65; }

html.embedded-detail, html.embedded-detail body { height: 100%; overflow: hidden; }
html.embedded-detail .ambient-orb, html.embedded-detail .topbar,
html.embedded-detail .back-button, html.embedded-detail .raw-detail { display: none; }
html.embedded-detail .page-shell { width: 100%; height: 100%; padding: 0; }
html.embedded-detail main, html.embedded-detail .detail-page { height: 100%; }
html.embedded-detail .detail-page { padding: 0; }
html.embedded-detail .detail-grid { height: 100%; grid-template-columns: minmax(0, 1fr) 285px; gap: 1px; margin: 0; }
html.embedded-detail .detail-conversation, html.embedded-detail .detail-info { height: 100%; border: 0; border-radius: 0; box-shadow: none; }
html.embedded-detail .detail-conversation { display: flex; flex-direction: column; padding: 16px 28px 18px; }
html.embedded-detail .detail-sidebar { min-width: 0; }
html.embedded-detail #detail-messages { flex: 1 1 auto; min-height: 0; height: auto; }
html.embedded-detail .reply-composer { flex: 0 0 auto; }

/* Guide */
.guide-hero { min-height: 325px; display: flex; align-items: end; justify-content: space-between; gap: 60px; padding: 70px 0 52px; border-bottom: 1px solid rgba(23,33,30,.12); }
.guide-hero h1 { font-size: clamp(50px, 5.4vw, 78px); color: var(--ink); }
.guide-hero > p { width: 350px; margin: 0 0 7px; color: var(--muted); font-size: 14px; line-height: 1.75; }
.guide-layout { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 70px; padding: 55px 0 75px; }
.guide-nav { position: sticky; top: 25px; align-self: start; display: flex; flex-direction: column; gap: 7px; }
.guide-nav > span { margin-bottom: 9px; color: #98a19c; font-size: 8px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.guide-nav a { padding: 8px 0; color: var(--muted); font-size: 10px; font-weight: 650; text-decoration: none; border-bottom: 1px solid var(--line); }
.guide-nav a:hover { color: var(--green); }
.guide-content { min-width: 0; }
.guide-section { padding: 0 0 68px; margin-bottom: 68px; border-bottom: 1px solid var(--line); scroll-margin-top: 25px; }
.section-kicker { display: flex; align-items: center; gap: 9px; }
.section-kicker span { display: grid; place-items: center; width: 25px; height: 25px; border: 1px solid rgba(29,106,73,.28); border-radius: 50%; color: var(--green); font: italic 9px Georgia, serif; }
.section-kicker p { margin: 0; color: var(--green); font-size: 8px; font-weight: 850; letter-spacing: .18em; }
.guide-section > h2 { margin: 17px 0 27px; font: 500 37px Georgia, serif; letter-spacing: -.04em; }
.step-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 11px; }
.step-card { min-height: 180px; padding: 21px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.step-card > span { color: var(--green); font: italic 18px Georgia, serif; }
.step-card h3 { margin: 30px 0 8px; font-size: 13px; }
.step-card p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.65; }
code { font-family: "SFMono-Regular", Consolas, monospace; }
.step-card code, .guide-intro code { color: var(--green); font-size: .95em; }
.code-card { margin-top: 14px; overflow: hidden; border-radius: 14px; background: var(--ink); box-shadow: 0 18px 35px rgba(23,33,30,.12); }
.code-card > div { height: 38px; display: flex; align-items: center; gap: 6px; padding: 0 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
.code-card > div span { width: 6px; height: 6px; border-radius: 50%; background: #ed786f; }
.code-card > div span:nth-child(2) { background: #e6b25f; }
.code-card > div span:nth-child(3) { background: #70bd83; }
.code-card > div b { margin-left: 7px; color: rgba(255,255,255,.42); font-size: 8px; }
.code-card pre { margin: 0; padding: 22px; color: #e5eee7; font-size: 10px; line-height: 1.75; overflow: auto; }
.flow-line { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr; align-items: center; gap: 12px; }
.flow-line article { min-height: 178px; padding: 18px; border-radius: 13px; background: var(--surface); border: 1px solid var(--line); }
.flow-line article b { color: var(--green); font: italic 13px Georgia, serif; }
.flow-line article strong { display: block; margin-top: 30px; font-size: 12px; }
.flow-line article p { margin: 7px 0 0; color: var(--muted); font-size: 9px; line-height: 1.6; }
.flow-line > i { color: #9da6a1; font: normal 13px Georgia, serif; }
.guide-intro { max-width: 620px; margin: -12px 0 30px; color: var(--muted); font-size: 11px; line-height: 1.7; }
.parameter-group { margin-top: 38px; }
.parameter-title { display: flex; align-items: center; gap: 13px; margin-bottom: 12px; }
.parameter-title > span { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 11px; background: var(--ink); color: var(--lime); font-size: 8px; font-weight: 900; letter-spacing: .08em; }
.parameter-title.green > span { background: var(--green); color: white; }
.parameter-title.amber > span { background: #f4e6d5; color: #995b26; }
.parameter-title h3 { margin: 0 0 3px; font-size: 13px; }
.parameter-title p { margin: 0; color: var(--muted); font-size: 9px; }
.parameter-table { overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); }
.parameter-row { display: grid; grid-template-columns: 1.25fr .72fr 1.7fr; align-items: center; min-height: 54px; padding: 0 18px; border-top: 1px solid var(--line); gap: 15px; }
.parameter-row:first-child { border-top: 0; }
.parameter-row.header { min-height: 34px; background: #f8faf7; color: #929b96; font-size: 8px; font-weight: 800; letter-spacing: .06em; }
.parameter-row code { color: var(--green-deep); font-size: 9px; font-weight: 750; overflow-wrap: anywhere; }
.parameter-row b { font-size: 9px; }
.parameter-row > span:last-child { color: var(--muted); font-size: 9px; line-height: 1.5; }
.launch-section { display: grid; grid-template-columns: 1.25fr .75fr; gap: 40px; align-items: end; margin-bottom: 0; padding: 44px; border: 0; border-radius: 18px; color: white; background: linear-gradient(135deg, var(--green), var(--green-deep)); box-shadow: var(--shadow); }
.section-kicker.light span { border-color: rgba(255,255,255,.3); color: var(--lime); }
.section-kicker.light p { color: var(--lime); }
.launch-copy h2 { margin: 18px 0 14px; font: 500 33px/1.05 Georgia, serif; letter-spacing: -.04em; }
.launch-copy > p { max-width: 500px; margin: 0; color: rgba(255,255,255,.68); font-size: 10px; line-height: 1.65; }
.launch-code { display: flex; flex-direction: column; gap: 7px; }
.launch-code code { padding: 11px 13px; border: 1px solid rgba(255,255,255,.18); border-radius: 8px; background: rgba(7,33,22,.22); color: white; font-size: 9px; }
.launch-code small { margin-top: 4px; color: rgba(255,255,255,.58); font-size: 8px; }

footer { display: flex; justify-content: space-between; border-top: 1px solid rgba(23,33,30,.12); padding: 25px 0 35px; color: var(--muted); font-size: 9px; }
footer b { color: var(--green); }
.toast { position: fixed; z-index: 10; right: 24px; bottom: 24px; transform: translateY(20px); opacity: 0; pointer-events: none; background: var(--ink); color: white; padding: 13px 16px; border-radius: 9px; font-size: 10px; box-shadow: var(--shadow); transition: .25s ease; }
.toast.show { transform: translateY(0); opacity: 1; }

/* Classification prompt editor */
.rules-page { padding: 48px 0 72px; max-width: 1080px; margin: 0 auto; }
.rules-list { display: grid; gap: 12px; }
.rules-demo-notice { padding: 13px 16px; border: 1px solid #e8d2ad; border-radius: 10px; background: #fff9ec; color: #76501f; font-size: 9px; }
.rules-table { overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: white; }
.rules-table-head, .rule-row { display: grid; grid-template-columns: 140px 80px minmax(360px, 1fr) 70px; gap: 18px; align-items: center; }
.rules-table-head { min-height: 46px; padding: 0 20px; background: #f8faf7; color: var(--muted); font-size: 11px; font-weight: 800; }
.rule-row { min-height: 94px; padding: 14px 20px; border-top: 1px solid var(--line); }
.rule-name { width: 100%; min-width: 0; box-sizing: border-box; border: 0; outline: 0; color: var(--ink); font: inherit; font-size: 13px; font-weight: 800; }
.category-input { padding: 9px 11px; border-radius: 8px; }
.rule-enabled { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; }
.rule-row textarea { width: 100%; min-width: 0; box-sizing: border-box; padding: 12px 13px; resize: vertical; border: 1px solid var(--line); border-radius: 8px; background: #fafbf8; font: inherit; font-size: 12px; line-height: 1.55; }
.rule-row button { border: 0; border-radius: 8px; padding: 10px 13px; background: var(--green); color: white; font-size: 11px; font-weight: 750; }

/* Answer knowledge database */
.knowledge-page { padding: 48px 0 72px; }
.knowledge-subtabs { display: flex; gap: 4px; width: max-content; margin-bottom: 24px; padding: 4px; border: 1px solid var(--line); border-radius: 10px; background: white; }
.knowledge-subtabs button { border: 0; border-radius: 7px; padding: 9px 18px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 750; }
.knowledge-subtabs button.active { background: #347457; color: white; }
.knowledge-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.knowledge-toolbar > div { display: flex; align-items: baseline; gap: 12px; }
.knowledge-toolbar strong { font-size: 16px; }
.knowledge-toolbar span { color: var(--muted); font-size: 12px; }
.knowledge-toolbar button { border: 0; border-radius: 8px; padding: 11px 14px; background: var(--green); color: white; font-size: 11px; font-weight: 780; }
.knowledge-table-head, .knowledge-row { display: grid; grid-template-columns: minmax(260px, .9fr) minmax(400px, 1.45fr) 115px; gap: 16px; align-items: center; }
.knowledge-table-head { min-height: 46px; padding: 0 18px; border: 1px solid var(--line); border-radius: 13px 13px 0 0; background: #f8faf7; color: var(--muted); font-size: 11px; font-weight: 800; }
.knowledge-list { overflow: hidden; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 13px 13px; background: white; }
.knowledge-row { margin: 0; padding: 14px 18px; border-top: 1px solid var(--line); }
.knowledge-row:first-child { border-top: 0; }
.knowledge-row textarea { min-height: 78px; padding: 11px 12px; border-radius: 8px; font-size: 12px; line-height: 1.55; }
.knowledge-actions { display: flex; gap: 6px; }
.knowledge-actions button { border: 1px solid var(--line); border-radius: 7px; padding: 8px 10px; background: white; color: var(--green); font-size: 10px; font-weight: 750; }
.knowledge-actions .delete-knowledge { color: #a34f43; }
.knowledge-actions .delete-document { color: #a34f43; }
.knowledge-actions button:disabled { opacity: .55; }
.document-table-head, .document-row { display: grid; grid-template-columns: 230px minmax(420px, 1fr) 115px; gap: 16px; align-items: center; }
.document-table-head { min-height: 46px; padding: 0 18px; border: 1px solid var(--line); border-radius: 13px 13px 0 0; background: #f8faf7; color: var(--muted); font-size: 11px; font-weight: 800; }
.document-list { overflow: hidden; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 13px 13px; background: white; }
.document-row { margin: 0; padding: 14px 18px; border-top: 1px solid var(--line); }
.document-row:first-child { border-top: 0; }
.document-row input { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fafbf8; font: inherit; font-size: 12px; font-weight: 750; }
.document-row textarea { min-height: 88px; padding: 11px 12px; border-radius: 8px; font-size: 12px; line-height: 1.55; }

/* Runtime options */
.options-page { max-width: 1080px; margin: 0 auto; padding: 52px 0 72px; }
.options-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 0; }
.options-toolbar { grid-column: 1 / -1; display: flex; align-items: center; justify-content: flex-end; gap: 18px; margin-bottom: 5px; }
.options-toolbar > span { margin-right: auto; padding: 8px 11px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: var(--surface); font-size: 9px; }
.options-toolbar > div { display: flex; gap: 9px; }
.option-card { padding: 25px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.option-card.featured { grid-row: span 2; }
.option-card-head { display: flex; gap: 13px; margin-bottom: 23px; }
.option-icon { width: 35px; height: 35px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 10px; color: var(--green); background: var(--green-soft); font-size: 12px; font-weight: 850; }
.option-card h2 { margin: 1px 0 5px; font-size: 15px; letter-spacing: -.025em; }
.option-card-head p { margin: 0; color: var(--muted); font-size: 9px; line-height: 1.5; }
.range-option, .select-option, .switch-option { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 17px 0; border-top: 1px solid var(--line); }
.range-option b, .select-option b, .switch-option b { display: block; color: var(--ink); font-size: 11px; }
.range-option small, .select-option small, .switch-option small { display: block; margin-top: 5px; color: var(--muted); font-size: 8px; font-weight: 500; line-height: 1.45; }
.range-option output { color: var(--green); font: 600 24px Georgia, serif; }
#similarity-threshold { width: 100%; accent-color: var(--green); }
.range-scale { display: flex; justify-content: space-between; margin: 6px 0 15px; color: var(--muted); font-size: 8px; }
.select-option select { min-width: 130px; padding: 9px 30px 9px 10px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: var(--paper); font: inherit; font-size: 10px; }
.switch-option input { position: absolute; opacity: 0; pointer-events: none; }
.switch-option i { position: relative; width: 40px; height: 23px; flex: 0 0 auto; border-radius: 999px; background: #c8cfcb; transition: .2s; }
.switch-option i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%; background: white; box-shadow: 0 2px 5px rgba(0,0,0,.2); transition: .2s; }
.switch-option input:checked + i { background: var(--green); }
.switch-option input:checked + i::after { transform: translateX(17px); }
.switch-option input:focus-visible + i { outline: 3px solid rgba(29,106,73,.2); }
.options-toolbar button { padding: 12px 16px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--muted); font-size: 10px; font-weight: 780; }
.options-toolbar #save-options { border-color: var(--green); background: var(--green); color: white; }
.options-toolbar button:disabled { opacity: .55; }

html[data-theme="dark"] { --ink: #edf4ef; --ink-soft: #d5dfd8; --muted: #98a69e; --line: #33423a; --paper: #111814; --surface: #1a241e; --green: #65ba8b; --green-deep: #296b4a; --green-soft: #223b2c; --lime: #d8f26e; --shadow: 0 20px 55px rgba(0,0,0,.2); }
html[data-theme="dark"] body { background: var(--paper); }
html[data-theme="dark"] .ambient-orb { display: none; }
html[data-theme="dark"] .toast { background: #27362e; color: #f4f8f5; border: 1px solid #465a4f; }
html[data-theme="dark"] .main-tabs, html[data-theme="dark"] .option-tabs, html[data-theme="dark"] .status-chip, html[data-theme="dark"] .mode-popover, html[data-theme="dark"] .mode-popover::before { background: rgba(26,36,30,.96); }
html[data-theme="dark"] .tab-button.active,
html[data-theme="dark"] .knowledge-subtabs button.active,
html[data-theme="dark"] .filter-button.active { background: #315f48; color: #fff; border-color: #315f48; box-shadow: 0 4px 12px rgba(0,0,0,.24); }
html[data-theme="dark"] .case-table-head, html[data-theme="dark"] .case-footer, html[data-theme="dark"] .rules-table-head, html[data-theme="dark"] .knowledge-table-head, html[data-theme="dark"] .document-table-head, html[data-theme="dark"] .parameter-row.header { background: #151e19; }
html[data-theme="dark"] textarea, html[data-theme="dark"] input, html[data-theme="dark"] .rule-row textarea, html[data-theme="dark"] .document-row input { color: var(--ink); background: #151e19; }
html[data-theme="dark"] .knowledge-subtabs, html[data-theme="dark"] .filter-button, html[data-theme="dark"] .knowledge-actions button, html[data-theme="dark"] .rules-table, html[data-theme="dark"] .knowledge-list, html[data-theme="dark"] .document-list { background: var(--surface); }
html[data-theme="dark"] .case-row:hover, html[data-theme="dark"] .case-row:focus-visible { background: #202d25; }
html[data-theme="dark"] .demo-notice, html[data-theme="dark"] .rules-demo-notice { border-color: #675332; background: #2a2419; color: #e8c98e; }
html[data-theme="dark"] .parameter-table, html[data-theme="dark"] .step-card, html[data-theme="dark"] .hero-status-card, html[data-theme="dark"] .detail-nav, html[data-theme="dark"] .case-search, html[data-theme="dark"] .history-summary { background: var(--surface); }
html[data-theme="dark"] #answer-text { background: var(--green-soft); }

/* Readability: keep compact layouts while raising small UI text sizes. */
body { font-size: 16px; }
.brand-copy small, .engine-chip small, .popover-heading small, .eyebrow,
.hero-status-card p, .hero-status-card > div:last-child > span,
.engine-summary span, .engine-summary small, .demo-notice p, .demo-notice button,
.filter-button, .case-meta time, .case-footer, .detail-section-title span,
.detail-info dd.mono, .guide-nav > span, .section-kicker p,
.parameter-row.header, .parameter-title > span, .launch-code small,
.options-toolbar > span, .range-option small, .select-option small,
.switch-option small, .range-scale { font-size: 10px; }
.engine-chip b, .popover-heading strong, .mode-popover > p,
.mode-popover > button, .metric-card small, .section-description,
.quiet-badge, .text-button, .field-head, label, .suggestion-row > span,
.suggestion, .form-footer p, .primary-button, .answer-label,
.evidence-head, .history-item p, .empty-state, .demo-notice strong,
.case-search input, .case-category, .case-question strong,
.case-question small, .case-answer, .case-status, .detail-page-label,
.header-back-link, .back-button, .message-image::before,
.message-image figcaption, .reply-status-badge,
.reply-actions button, .detail-info dt, .detail-info dd,
.detail-knowledge-item > div span, .detail-knowledge-item > div b,
.detail-knowledge-item > strong, .detail-knowledge-item > p,
.raw-detail > button, .guide-nav a, .step-card p,
.code-card > div b, .flow-line article p, .guide-intro,
.parameter-title p, .parameter-row code, .parameter-row b,
.parameter-row > span:last-child, .launch-copy > p, .launch-code code,
footer, .toast, .rules-demo-notice, .knowledge-actions button,
.options-toolbar button, .option-card-head p, .range-option b,
.select-option b, .switch-option b, .select-option select { font-size: 12px; }
.tab-button, .options-button, .option-tabs button, .status-chip,
.hero-copy, .status-summary span, .history-item h3,
.dashboard-title-row > div:first-child > p:last-child,
.engine-summary strong, .case-table-head, .case-date, .case-recent,
.detail-nav a, .detail-section-title h1, .detail-section-title h2,
.message time, .reply-composer textarea, .rule-name,
.rule-enabled, .rule-row textarea, .knowledge-subtabs button,
.knowledge-toolbar span, .knowledge-row textarea, .document-row input,
.document-row textarea, .option-card h2 { font-size: 14px; }

html.desktop-ui .page-shell { min-width: 1100px; }
html.desktop-ui .desktop-consultation-layout .case-table-head { display: none; }
html.desktop-ui .desktop-consultation-layout .case-panel { height: calc(100% - 18px); }
html.desktop-ui .desktop-consultation-layout .case-list { height: 100%; max-height: none; }
html.desktop-ui .desktop-consultation-layout .case-row { display: flex; flex-direction: column; align-items: stretch; gap: 9px; min-height: 92px; padding: 13px 14px; }
html.desktop-ui .desktop-consultation-layout .case-meta-row { width: 100%; }
html.desktop-ui .desktop-consultation-layout .case-customer-name { flex: 1 1 auto; }
html.desktop-ui .desktop-consultation-layout .case-category { padding: 5px 7px; }
html.desktop-ui .desktop-consultation-layout .case-channel { width: 26px; height: 26px; flex: 0 0 26px; }
html.desktop-ui .desktop-consultation-layout .case-date { margin-left: auto; font-size: 11px; white-space: nowrap; }
html.desktop-ui .desktop-consultation-layout .case-recent { width: 100%; font-size: 13px; line-height: 1.45; -webkit-line-clamp: 2; }
html.desktop-ui .desktop-consultation-layout .case-status { flex: 0 0 auto; font-size: 11px; }
html.mobile-ui .desktop-consultation-layout { display: block; }
html.mobile-ui .desktop-detail-shell { display: none; }

@media (max-width: 1050px) {
  .page-shell { padding: 0 24px; }
  .guide-layout { grid-template-columns: 1fr; gap: 30px; }
  .guide-nav { position: static; flex-direction: row; flex-wrap: wrap; }
  .guide-nav > span { width: 100%; }
  .guide-nav a { padding: 7px 10px; border: 1px solid var(--line); border-radius: 999px; }
  .flow-line { grid-template-columns: 1fr 1fr; }
  .flow-line > i { display: none; }
}

@media (max-width: 900px) {
  .topbar { grid-template-columns: 1fr auto; }
  .detail-topbar { grid-template-columns: minmax(0, 1fr) auto; }
  .hero { align-items: start; flex-direction: column; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .metric-card:nth-child(2) { border-right: 0; }
  .metric-card:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .workspace-grid { grid-template-columns: 1fr; }
  .case-toolbar { flex-wrap: wrap; }
  .case-search { width: 100%; }
  .case-filters { order: 3; width: 100%; overflow-x: auto; }
  .case-table-head { display: none; }
  .case-row { grid-template-columns: 90px 80px 1fr 110px; gap: 14px; }
  .case-recent { grid-column: 1 / -1; }
  .rules-table-head { display: none; }
  .rule-row { grid-template-columns: 1fr auto; gap: 12px; }
  .rule-enabled { justify-self: end; }
  .rule-row textarea { grid-column: 1 / -1; }
  .knowledge-table-head { display: none; }
  .knowledge-row { grid-template-columns: 1fr auto; }
  .knowledge-row textarea { grid-column: 1 / -1; }
  .document-table-head { display: none; }
  .document-row { grid-template-columns: 1fr auto; }
  .document-row input, .document-row textarea { grid-column: 1 / -1; }
  .detail-page { padding-top: 38px; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-sidebar { display: grid; grid-template-columns: 1fr 1fr; }
  .guide-hero { flex-direction: column; align-items: start; }
  .guide-hero > p { width: auto; max-width: 520px; }
  .step-grid { grid-template-columns: 1fr; }
  .step-card { min-height: auto; }
  .step-card h3 { margin-top: 18px; }
}

.admin-key-dialog {
  width: min(440px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 28px 80px rgba(17, 24, 39, .24);
}
.admin-key-dialog::backdrop { background: rgba(17, 24, 39, .48); backdrop-filter: blur(3px); }
.admin-key-form { display: grid; gap: 14px; padding: 30px; }
.admin-key-form .eyebrow { margin: 0; font-size: 11px; font-weight: 800; letter-spacing: .12em; color: var(--accent); }
.admin-key-form h2 { margin: 0; font-size: 23px; letter-spacing: -.03em; }
.admin-key-form > p:not(.eyebrow) { margin: -4px 0 4px; color: var(--muted); font-size: 13px; line-height: 1.65; }
.admin-key-form input { width: 100%; box-sizing: border-box; border: 1px solid var(--line-strong); border-radius: 10px; padding: 13px 14px; color: var(--ink); background: var(--soft); font: inherit; }
.admin-key-form input:focus { outline: 2px solid color-mix(in srgb, var(--accent) 38%, transparent); border-color: var(--accent); }
.admin-key-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 4px; }
.admin-key-actions button { border: 0; border-radius: 9px; padding: 10px 14px; font: inherit; font-weight: 750; cursor: pointer; }
.admin-key-actions .secondary-button { color: var(--ink); background: var(--soft); }
.admin-key-actions .primary-button { color: #fff; background: var(--accent); }

@media (max-width: 590px) {
  .page-shell { padding: 0 14px; }
  .topbar { height: 62px; }
  .detail-topbar { grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
  .detail-nav { overflow-x: auto; }
  .detail-nav a { padding: 9px 11px; font-size: 11px; }
  .detail-page-label { display: none; }
  .brand-copy small { display: none; }
  .engine-chip b { display: none; }
  .engine-chip { display: none; }
  .status-chip { padding: 8px 10px; }
  .option-tabs { overflow-x: auto; }
  .option-tabs button { flex: 0 0 auto; white-space: nowrap; }
  .main-tabs { width: max-content; }
  .hero { min-height: auto; padding: 35px 4px; }
  .hero h1, .guide-hero h1 { font-size: 43px; }
  .hero-status-card { width: 100%; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .status-summary { flex-wrap: wrap; gap: 14px 28px; }
  .metric-card { min-height: 96px; padding: 14px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .metric-card:nth-child(2n) { border-right: 0; }
  .metric-card strong { font-size: 25px; }
  .composer-panel { padding: 23px 17px; }
  .dashboard-main { padding-top: 28px; }
  .dashboard-title-row { align-items: start; flex-direction: column; gap: 20px; }
  .engine-summary { width: 100%; }
  .demo-notice { align-items: start; flex-direction: column; }
  .case-toolbar { padding: 14px; }
  .sync-button { margin-left: auto; }
  .case-row { grid-template-columns: 1fr auto; min-height: auto; padding: 17px; }
  .case-row { grid-template-columns: auto auto 1fr auto; }
  .case-date { grid-column: 1 / 4; grid-row: 2; text-align: left; }
  .case-recent { grid-column: 1 / -1; }
  .case-status { grid-column: 4; grid-row: 1; }
  .detail-sidebar { display: flex; }
  #detail-messages { height: 300px; padding-right: 6px; }
  .message > div:last-child { max-width: 92%; }
  .manager-message { margin-left: 4%; }
  .quiet-badge { display: none; }
  .suggestion-row > span { width: 100%; }
  .form-footer { align-items: end; gap: 15px; }
  .form-footer p { max-width: 145px; }
  .guide-hero { min-height: auto; padding: 115px 4px 42px; }
  .guide-layout { padding-top: 35px; }
  .guide-section { margin-bottom: 48px; padding-bottom: 48px; }
  .flow-line { grid-template-columns: 1fr; }
  .parameter-row { grid-template-columns: 1fr .65fr; padding: 12px 14px; }
  .parameter-row > span:last-child { grid-column: 1 / -1; }
  .parameter-row.header > span:last-child { display: none; }
  .launch-section { grid-template-columns: 1fr; padding: 28px 22px; }
  footer { flex-direction: column; gap: 7px; }
  .options-layout { grid-template-columns: 1fr; }
  .option-card.featured { grid-row: auto; }
  .options-toolbar { align-items: stretch; flex-direction: column; }
  .options-toolbar > span { margin-right: 0; align-self: flex-start; }
  .options-toolbar > div { width: 100%; }
  .options-toolbar button { flex: 1; }
  .select-option { align-items: start; flex-direction: column; gap: 12px; }
  .select-option select { width: 100%; }
}
