:root {
  --bg: #f2f4f1;
  --surface: #ffffff;
  --surface-muted: #f7f8f6;
  --ink: #18201c;
  --muted: #667069;
  --line: #dfe4df;
  --line-strong: #cbd2cc;
  --accent: #b83c32;
  --accent-hover: #993128;
  --teal: #217166;
  --teal-soft: #e5f1ee;
  --warning: #a66a16;
  --shadow: 0 12px 32px rgba(27, 39, 31, 0.12);
  font-family: Inter, "Noto Sans TC", "Microsoft JhengHei", "PingFang TC", sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  overflow: hidden;
  letter-spacing: 0;
}

button, textarea, select { font: inherit; }
button, select { cursor: pointer; }

[hidden] { display: none !important; }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
.login-screen { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; padding: 20px; background: #e9eeea; }
.login-panel { width: min(390px, 100%); padding: 32px; border: 1px solid var(--line); border-radius: 8px; background: white; box-shadow: var(--shadow); }
.login-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 6px; background: var(--accent); color: white; font-size: 14px; font-weight: 800; }
.login-eyebrow { margin: 22px 0 5px; color: var(--teal); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.login-panel h2 { margin: 0; font-size: 24px; }
.login-copy { margin: 8px 0 24px; color: var(--muted); font-size: 13px; }
.login-panel label { display: grid; gap: 7px; margin-top: 14px; color: var(--muted); font-size: 12px; font-weight: 700; }
.login-panel input { height: 42px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: 5px; color: var(--ink); outline: none; }
.login-panel input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(33, 113, 102, .12); }
.login-error { min-height: 18px; margin: 12px 0 0; color: #b83c32; font-size: 12px; }
.login-submit { width: 100%; height: 42px; display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 10px; border: 0; border-radius: 5px; background: var(--accent); color: white; font-weight: 700; }
.login-submit:hover { background: var(--accent-hover); }
.account-menu { display: flex; align-items: center; gap: 6px; margin-left: 14px; color: #d8ded9; font-size: 12px; }
.account-menu .icon-button { width: 32px; height: 32px; }
.admin-button { height:32px; display:flex; align-items:center; gap:6px; border:1px solid #59645c; border-radius:5px; background:transparent; color:white; padding:0 9px; font-size:12px; }.admin-button svg{width:15px}

.topbar {
  height: 66px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  background: #1d2420;
  color: white;
  border-bottom: 1px solid #343c37;
}

.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  background: var(--accent);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 800;
}

.brand-copy h1 { margin: 0; font-size: 16px; font-weight: 700; }
.brand-copy span { display: block; margin-top: 2px; color: #aeb8b1; font-size: 10px; text-transform: uppercase; }

.system-status {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 7px;
  color: #d8ded9;
  font-size: 12px;
}

.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #c99a3d; }
.system-status.ready .status-dot { background: #45b89c; }
.system-status.error .status-dot { background: #e86a5f; }

.app-shell {
  height: calc(100vh - 66px);
  display: grid;
  grid-template-columns: 238px minmax(0, 1fr) 360px;
  background: var(--surface);
}

.sidebar {
  padding: 20px 14px;
  background: var(--surface-muted);
  border-right: 1px solid var(--line);
  overflow-y: auto;
}

.sidebar-section { margin-bottom: 26px; }
.sidebar-section label, .section-label, .eyebrow {
  display: block;
  margin: 0 6px 9px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.select-wrap {
  height: 42px;
  display: grid;
  grid-template-columns: 20px 1fr 18px;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  background: white;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
}

.select-wrap svg { width: 17px; color: var(--muted); }
.select-wrap select { width: 100%; border: 0; outline: 0; appearance: none; background: transparent; color: var(--ink); font-size: 13px; }

.quick-action {
  width: 100%;
  height: 40px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 11px;
  margin-bottom: 3px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #3b443e;
  text-align: left;
  font-size: 13px;
}

.quick-action:hover, .quick-action:focus-visible { background: #e8ebe8; outline: none; }
.quick-action svg { width: 17px; color: var(--muted); }

.knowledge-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.knowledge-summary div { display: flex; flex-direction: column; padding: 0 7px; }
.knowledge-summary div + div { border-left: 1px solid var(--line); }
.knowledge-summary strong { font-size: 20px; font-variant-numeric: tabular-nums; }
.knowledge-summary span { margin-top: 2px; color: var(--muted); font-size: 11px; }

.conversation { min-width: 0; min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; background: var(--surface); }
.conversation-head, .visual-head {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
}

.conversation-head .eyebrow, .visual-head .eyebrow { margin: 0 0 4px; }
.conversation-head h2, .visual-head h2 { margin: 0; font-size: 16px; }

.model-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 700;
}
.model-badge svg { width: 15px; }

.messages { min-height: 0; overflow-y: auto; padding: 24px clamp(18px, 4vw, 48px); }
.message { display: flex; gap: 12px; max-width: 780px; margin: 0 auto 24px; }
.message-avatar {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--teal-soft);
  color: var(--teal);
}
.message-avatar svg { width: 17px; }
.message-body { min-width: 0; flex: 1; }
.message-meta { margin-bottom: 7px; color: var(--muted); font-size: 11px; font-weight: 700; }
.answer-text { color: #28312b; font-size: 14px; line-height: 1.75; white-space: pre-wrap; overflow-wrap: anywhere; }
.answer-text strong { color: var(--ink); }
.answer-heading, .answer-step, .answer-item { display: block; }
.answer-heading { margin: 12px 0 4px; font-size: 14px; }
.answer-step, .answer-item { padding-left: 4px; }
.answer-step b { display: inline-block; min-width: 25px; color: var(--teal); }
.answer-item::before { content: "•"; display: inline-block; width: 18px; color: var(--teal); }

.user-message { justify-content: flex-end; }
.user-message .message-body { flex: 0 1 auto; max-width: 78%; padding: 11px 14px; border-radius: 6px 6px 2px 6px; background: #28312b; color: white; }
.user-message .answer-text { color: white; line-height: 1.55; }
.user-message .message-meta { color: #c2cac4; }

.message-source { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }

.loading-line { display: flex; gap: 5px; padding-top: 7px; }
.loading-line span { width: 6px; height: 6px; border-radius: 50%; background: var(--teal); animation: pulse 1.2s infinite; }
.loading-line span:nth-child(2) { animation-delay: 0.15s; }
.loading-line span:nth-child(3) { animation-delay: 0.3s; }
@keyframes pulse { 0%, 70%, 100% { opacity: .25; } 35% { opacity: 1; } }
.loading-message .message-avatar svg { animation: spin 1.1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.answer-assets { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.answer-assets-title { margin-bottom: 9px; color: var(--muted); font-size: 11px; font-weight: 700; }
.answer-carousel { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(220px, 42%); gap: 10px; overflow-x: auto; overscroll-behavior-inline: contain; padding-bottom: 4px; scroll-snap-type: x mandatory; scrollbar-width: thin; }
.answer-image-card { display: grid; grid-template-rows: 154px auto; min-width: 0; padding: 0; overflow: hidden; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); color: var(--ink); text-align: left; scroll-snap-align: start; }
.answer-image-card img { width: 100%; height: 154px; object-fit: contain; background: #edf0ed; }
.answer-image-card span { min-height: 38px; padding: 8px 10px; overflow: hidden; font-size: 11px; line-height: 1.35; }
.answer-image-card:focus-visible { outline: 3px solid rgba(33, 113, 102, .35); outline-offset: 2px; }

.composer { margin: 0 clamp(18px, 4vw, 48px) 22px; border: 1px solid var(--line-strong); border-radius: 8px; background: white; box-shadow: 0 6px 20px rgba(24, 32, 28, .07); }
.composer:focus-within { border-color: #7b978d; box-shadow: 0 0 0 3px rgba(33, 113, 102, .1); }
.composer textarea { width: 100%; min-height: 68px; max-height: 160px; resize: vertical; padding: 14px 15px 8px; border: 0; outline: 0; background: transparent; color: var(--ink); line-height: 1.5; }
.composer textarea::placeholder { color: #939c95; }
.composer-footer { display: flex; align-items: center; justify-content: space-between; padding: 7px 8px 8px 13px; }

.llm-toggle { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; cursor: pointer; }
.llm-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-track { width: 30px; height: 17px; padding: 2px; border-radius: 9px; background: #b8c0ba; transition: background .2s; }
.toggle-track span { display: block; width: 13px; height: 13px; border-radius: 50%; background: white; transition: transform .2s; }
.llm-toggle input:checked + .toggle-track { background: var(--teal); }
.llm-toggle input:checked + .toggle-track span { transform: translateX(13px); }

.send-button { height: 36px; display: flex; align-items: center; gap: 7px; padding: 0 14px; border: 0; border-radius: 5px; background: var(--accent); color: white; font-size: 12px; font-weight: 700; }
.send-button:hover { background: var(--accent-hover); }
.send-button:disabled { opacity: .55; cursor: wait; }
.send-button svg { width: 15px; }

.visual-panel { min-width: 0; min-height: 0; background: var(--surface-muted); border-left: 1px solid var(--line); overflow-x: hidden; overflow-y: auto; }
.visual-head { position: sticky; top: 0; z-index: 2; background: var(--surface-muted); }
.image-count { min-width: 26px; height: 24px; display: grid; place-items: center; border-radius: 12px; background: #e0e5e1; color: var(--muted); font-size: 11px; font-weight: 700; }
.visual-empty { min-height: 280px; display: grid; place-content: center; justify-items: center; padding: 30px; color: #8b958e; text-align: center; }
.visual-empty svg { width: 30px; height: 30px; margin-bottom: 10px; }
.visual-empty p { max-width: 170px; margin: 0; font-size: 12px; line-height: 1.5; }
.image-gallery { display: grid; grid-template-columns: minmax(0, 1fr); width: 100%; min-width: 0; gap: 12px; padding: 16px; }
.image-item { min-width: 0; width: 100%; max-width: 100%; margin: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: white; }
.image-button { width: 100%; min-width: 0; max-width: 100%; aspect-ratio: 4 / 3; display: block; padding: 0; border: 0; background: #e9ece9; overflow: hidden; }
.image-button img { width: 100%; max-width: 100%; height: 100%; max-height: 100%; display: block; object-fit: contain; transition: transform .2s; }
.image-button:hover img { transform: scale(1.02); }
.image-item figcaption { padding: 10px 11px 11px; color: #3e4841; font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; }
.image-item figcaption span { display: block; margin-top: 5px; color: var(--muted); font-size: 10px; }
.source-list { padding: 0 16px 20px; }
.source-row { padding: 10px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; line-height: 1.45; overflow-wrap: anywhere; }

.icon-button { width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 5px; background: transparent; color: inherit; }
.icon-button svg { width: 20px; }
.mobile-menu { display: none; }
.sidebar-backdrop { display: none; }

.image-dialog { width: min(900px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 14px; border: 0; border-radius: 8px; background: white; box-shadow: var(--shadow); }
.admin-dialog[open] { width: min(1120px, calc(100vw - 32px)); height: min(780px, calc(100dvh - 32px)); max-height: none; display: grid; grid-template-rows: auto auto auto auto minmax(0, 1fr); padding: 0; overflow: hidden; border: 0; border-radius: 8px; background: white; box-shadow: var(--shadow); }
.admin-dialog::backdrop, .password-dialog::backdrop { background: rgba(16, 22, 18, .64); }
.admin-head { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 14px 18px 14px 20px; border-bottom: 1px solid var(--line); }
.admin-head .eyebrow, .admin-editor-head .eyebrow, .password-dialog .eyebrow { margin: 0 0 3px; }
.admin-head h2, .admin-editor-head h3, .password-dialog h2 { margin: 0; letter-spacing: 0; }
.admin-head h2 { font-size: 18px; }
.admin-head p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.admin-head-actions { display: flex; align-items: center; gap: 8px; }
.admin-create-button, .admin-save-button, .admin-secondary-button, .admin-filter-reset, .admin-row-action { min-height: 36px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border-radius: 5px; padding: 0 12px; font-size: 12px; font-weight: 700; }
.admin-create-button, .admin-save-button { border: 0; background: var(--teal); color: white; }
.admin-create-button:hover, .admin-save-button:hover { background: #195e55; }
.admin-create-button svg, .admin-save-button svg, .admin-secondary-button svg, .admin-filter-reset svg, .admin-row-action svg { width: 15px; height: 15px; }
.admin-metrics { min-height: 72px; display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--line); background: var(--surface-muted); }
.admin-metrics > div { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; padding: 13px 18px; }
.admin-metrics > div + div { border-left: 1px solid var(--line); }
.admin-metrics span { color: var(--muted); font-size: 11px; font-weight: 700; }
.admin-metrics strong { font-size: 23px; font-variant-numeric: tabular-nums; }
.admin-toolbar { min-height: 66px; display: grid; grid-template-columns: minmax(190px, 1fr) 135px 155px 135px auto; align-items: end; gap: 9px; padding: 10px 16px 12px; border-bottom: 1px solid var(--line); }
.admin-toolbar label { min-width: 0; display: grid; gap: 5px; color: var(--muted); font-size: 10px; font-weight: 700; }
.admin-toolbar input, .admin-toolbar select, .admin-field input, .admin-field select { min-width: 0; width: 100%; height: 38px; border: 1px solid var(--line-strong); border-radius: 5px; background: white; color: var(--ink); padding: 0 10px; outline: none; }
.admin-toolbar input:focus, .admin-toolbar select:focus, .admin-field input:focus, .admin-field select:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(33, 113, 102, .11); }
.admin-search { position: relative; }
.admin-search svg { position: absolute; z-index: 1; left: 10px; bottom: 11px; width: 16px; height: 16px; color: var(--muted); }
.admin-search input { padding-left: 34px; }
.admin-filter-reset, .admin-secondary-button, .admin-row-action { border: 1px solid var(--line-strong); background: white; color: #344038; }
.admin-filter-reset:hover, .admin-secondary-button:hover, .admin-row-action:hover { border-color: #8ba79c; background: #f4f7f5; }
.admin-global-error { min-height: 0; padding: 0 16px; color: var(--accent); font-size: 12px; }
.admin-global-error:not(:empty) { padding-top: 10px; padding-bottom: 10px; border-bottom: 1px solid #ecd3cf; background: #fff6f4; }
.admin-workspace { height: auto; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr); transition: grid-template-columns .2s ease; }
.admin-dialog.editor-open .admin-workspace { grid-template-columns: minmax(0, 1fr) 380px; }
.admin-list-panel { min-width: 0; min-height: 0; overflow: auto; }
.admin-user-table-head, .admin-user-row { display: grid; grid-template-columns: minmax(180px, 1.35fr) 125px minmax(145px, 1fr) 90px 76px; align-items: center; gap: 12px; }
.admin-user-table-head { position: sticky; z-index: 2; top: 0; min-height: 38px; padding: 0 16px; border-bottom: 1px solid var(--line); background: #f6f8f6; color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.admin-users { min-width: 660px; }
.admin-user-row { min-height: 62px; padding: 8px 16px; border-bottom: 1px solid var(--line); font-size: 12px; transition: background .16s; }
.admin-user-row:hover { background: #f7faf8; }
.admin-user-identity { min-width: 0; display: flex; align-items: center; gap: 10px; }
.admin-user-identity strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.admin-avatar { flex: 0 0 32px; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 5px; background: var(--teal-soft); color: var(--teal); font-size: 12px; font-weight: 800; }
.account-role, .account-status { width: max-content; max-width: 100%; display: inline-flex; align-items: center; gap: 6px; padding: 4px 7px; border-radius: 4px; font-size: 10px; font-weight: 800; }
.account-role { background: #eef1ee; color: #4c5850; }
.account-role.admin { background: #f6ead1; color: #805817; }
.account-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.account-status.active { background: #e5f1ee; color: #217166; }
.account-status.inactive { background: #f5e6e3; color: #a33e34; }
.admin-store-name { min-width: 0; overflow: hidden; color: #465149; text-overflow: ellipsis; white-space: nowrap; }
.admin-row-action { min-height: 32px; padding: 0 9px; }
.admin-loading, .admin-empty { min-height: 230px; display: grid; place-content: center; justify-items: center; gap: 7px; color: var(--muted); text-align: center; }
.admin-loading svg { width: 21px; animation: spin 1.1s linear infinite; }
.admin-empty svg { width: 28px; margin-bottom: 4px; }
.admin-empty strong { color: var(--ink); font-size: 13px; }
.admin-empty span { font-size: 11px; }
.admin-editor { min-width: 0; min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; border-left: 1px solid var(--line); background: white; box-shadow: -10px 0 24px rgba(27, 39, 31, .07); }
.admin-editor-head { min-height: 68px; display: flex; align-items: center; justify-content: space-between; padding: 12px 14px 12px 18px; border-bottom: 1px solid var(--line); }
.admin-editor-head h3 { font-size: 15px; }
.admin-editor-body { min-height: 0; overflow-y: auto; padding: 18px; }
.admin-field { display: grid; gap: 6px; margin-bottom: 15px; color: #39443d; font-size: 11px; font-weight: 800; }
.admin-field small { color: var(--muted); font-size: 10px; font-weight: 400; line-height: 1.45; }
.admin-field input:disabled, .admin-field select:disabled { background: #eff2ef; color: #8a938d; cursor: not-allowed; }
.admin-password-fields { padding-top: 4px; border-top: 1px solid var(--line); }
.admin-switch-row { min-height: 66px; display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 5px; padding: 12px 0; border-top: 1px solid var(--line); cursor: pointer; }
.admin-switch-row > span:first-child { display: grid; gap: 4px; }
.admin-switch-row strong { font-size: 12px; }
.admin-switch-row small { max-width: 245px; color: var(--muted); font-size: 10px; line-height: 1.4; }
.admin-switch { position: relative; flex: 0 0 36px; width: 36px; height: 20px; }
.admin-switch input { position: absolute; opacity: 0; pointer-events: none; }
.admin-switch > span { display: block; width: 36px; height: 20px; padding: 3px; border-radius: 10px; background: #adb6af; transition: background .18s; }
.admin-switch > span::after { content: ""; display: block; width: 14px; height: 14px; border-radius: 50%; background: white; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .18s; }
.admin-switch input:checked + span { background: var(--teal); }
.admin-switch input:checked + span::after { transform: translateX(16px); }
.admin-switch input:focus-visible + span { outline: 3px solid rgba(33, 113, 102, .24); outline-offset: 2px; }
.admin-editor-error { min-height: 18px; margin: 8px 0 0; color: var(--accent); font-size: 11px; line-height: 1.4; }
.admin-editor-actions { min-height: 64px; display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--surface-muted); }
.admin-editor-actions .admin-secondary-button:first-child { margin-right: auto; }
.admin-save-button:disabled { opacity: .58; cursor: wait; }
.admin-save-button.busy svg { animation: spin 1.1s linear infinite; }
.password-dialog { width: min(460px, calc(100vw - 28px)); padding: 0; overflow: hidden; border: 0; border-radius: 8px; background: white; box-shadow: var(--shadow); }
.password-dialog header { min-height: 74px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 16px 14px 20px; border-bottom: 1px solid var(--line); }
.password-dialog h2 { font-size: 17px; }
.password-dialog header p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.password-dialog-body { padding: 18px 20px 10px; }
.password-warning { display: flex; align-items: flex-start; gap: 9px; margin-bottom: 18px; padding: 10px 11px; border-left: 3px solid #c99a3d; background: #fbf6e9; color: #6b551f; font-size: 11px; line-height: 1.5; }
.password-warning svg { flex: 0 0 17px; width: 17px; margin-top: 1px; }
.password-visibility { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; }
.password-dialog footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line); background: var(--surface-muted); }
.admin-toast { position: fixed; z-index: 140; right: 20px; bottom: 20px; max-width: min(360px, calc(100vw - 32px)); padding: 11px 14px; border-radius: 5px; background: #24312b; color: white; box-shadow: var(--shadow); font-size: 12px; opacity: 0; pointer-events: none; transform: translateY(12px); transition: opacity .18s, transform .18s; }
.admin-toast.visible { opacity: 1; transform: translateY(0); }
.image-dialog::backdrop { background: rgba(16, 22, 18, .78); }
.image-dialog img { display: block; max-width: 100%; max-height: calc(100vh - 120px); margin: 0 auto; object-fit: contain; }
.image-dialog > div { padding: 10px 42px 0 4px; color: #3f4842; font-size: 13px; }
.dialog-close { position: absolute; top: 10px; right: 10px; background: rgba(24, 32, 28, .82); color: white; }
.guidance-dialog { width: min(1240px, calc(100vw - 32px)); height: min(820px, calc(100vh - 32px)); max-height: none; padding: 0; overflow: hidden; border: 0; border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); }
.guidance-dialog::backdrop { background: rgba(16, 22, 18, .62); }
.guidance-head { min-height: 72px; display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.guidance-head .eyebrow { margin: 0 0 4px; }.guidance-head h2 { margin: 0; font-size: 18px; }.guidance-toolbar { display:flex; gap:8px; align-items:center; padding:12px 16px; border-bottom:1px solid var(--line); background:var(--surface-muted); }.guidance-toolbar input,.guidance-toolbar select,.guidance-fields input,.guidance-fields textarea,.guidance-fields select,.guidance-assets > input { min-width:0; border:1px solid var(--line-strong); border-radius:5px; background:white; color:var(--ink); }.guidance-toolbar input { width:min(360px, 100%); height:36px; padding:0 10px; }.guidance-toolbar select { height:36px; padding:0 8px; }.guidance-toolbar button,.primary-button,.guidance-status-action { height:36px; display:flex; align-items:center; gap:6px; margin-left:auto; border:0; border-radius:5px; background:var(--teal); color:white; padding:0 12px; font-weight:700; font-size:12px; }.guidance-toolbar button svg{width:15px}
.guidance-layout { height:calc(100% - 121px); display:grid; grid-template-columns:320px minmax(0,1fr); }.guidance-list { overflow:auto; padding:10px; border-right:1px solid var(--line); background:var(--surface-muted); }.guidance-list-item { width:100%; display:grid; gap:5px; padding:12px; margin-bottom:7px; border:1px solid var(--line); border-radius:6px; background:white; color:var(--ink); text-align:left; }.guidance-list-item:hover { border-color:#8ba79c; }.guidance-list-item strong { font-size:13px; }.guidance-list-item span { color:var(--muted); font-size:11px; }.guidance-list-item em { width:max-content; padding:2px 6px; border-radius:3px; background:#e7eee9; color:#466051; font-size:10px; font-style:normal; }.guidance-list-item em.inactive { background:#f3e5e2; color:#9a4037; }
.guidance-editor-wrap { min-width:0; overflow:auto; padding:20px; }.guidance-empty { height:100%; display:grid; place-items:center; color:var(--muted); font-size:13px; }.editor-title { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:18px; }.editor-title h3,.guidance-assets h3 { margin:0; font-size:15px; }.editor-title > div { display:flex; gap:8px; }.editor-title button,.danger-button { height:32px; border:1px solid var(--line-strong); border-radius:5px; background:white; color:var(--ink); padding:0 10px; font-size:12px; }.danger-button { border-color:#d7a49d; color:#a1362b; }.guidance-fields { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }.guidance-field,.guidance-fields > label { display:grid; gap:6px; color:var(--muted); font-size:11px; font-weight:700; }.guidance-fields input,.guidance-fields select { height:38px; padding:0 9px; }.guidance-custom-option:not([hidden]) { margin-top:6px; }.guidance-fields textarea { min-height:76px; padding:9px; resize:vertical; line-height:1.45; }.wide-field { grid-column:1 / -1; }.guidance-assets { margin-top:22px; padding-top:18px; border-top:1px solid var(--line); }.asset-section-title { display:flex; align-items:center; justify-content:space-between; gap:12px; }.upload-control { position:relative; overflow:hidden; display:inline-flex; align-items:center; height:32px; padding:0 10px; border:1px solid var(--line-strong); border-radius:5px; background:white; color:#344038; font-size:12px; cursor:pointer; }.upload-control input { position:absolute; inset:0; opacity:0; cursor:pointer; }.guidance-assets > input { width:100%; height:36px; margin-top:10px; padding:0 9px; }.management-assets { display:grid; grid-template-columns:repeat(auto-fill,minmax(180px,1fr)); gap:10px; margin-top:12px; }.management-asset { display:grid; gap:7px; padding:8px; border:1px solid var(--line); border-radius:6px; background:var(--surface-muted); }.management-asset img { width:100%; height:120px; object-fit:contain; background:white; }.management-asset input { min-width:0; height:32px; padding:0 8px; border:1px solid var(--line-strong); border-radius:4px; }.editor-actions { display:flex; justify-content:flex-end; margin-top:20px; }.primary-button { margin-left:0; }

@media (max-width: 1120px) {
  .app-shell { grid-template-columns: 220px minmax(0, 1fr) 280px; }
}

@media (max-width: 900px) {
  body { overflow: auto; }
  .app-shell { height: calc(100dvh - 66px); grid-template-columns: minmax(0, 1fr); }
  .visual-panel { display: none; }
  .mobile-menu { display: grid; }
  .sidebar { position: fixed; z-index: 20; inset: 66px auto 0 0; width: 260px; transform: translateX(-100%); transition: transform .22s; box-shadow: var(--shadow); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop { position: fixed; z-index: 19; inset: 66px 0 0; background: rgba(16, 22, 18, .45); }
  .sidebar-backdrop.open { display: block; }
  .composer { position: sticky; bottom: 0; margin-bottom: 0; border-bottom: 0; border-radius: 8px 8px 0 0; }
  .answer-carousel { grid-auto-columns: minmax(240px, 78vw); }
  .answer-image-card, .answer-image-card img { grid-template-rows: 170px auto; height: auto; }
  .answer-image-card img { height: 170px; }
}

@media (max-width: 700px) {
  .admin-dialog { width: 100vw; height: 100dvh; max-width: none; border-radius: 0; }
  .admin-head { min-height: 70px; padding: 11px 12px 11px 15px; }
  .admin-head p { display: none; }
  .admin-create-button { width: 36px; padding: 0; }
  .admin-create-button span { display: none; }
  .admin-metrics { min-height: 112px; grid-template-columns: 1fr 1fr; }
  .admin-metrics > div { padding: 9px 14px; }
  .admin-metrics > div:nth-child(3) { border-left: 0; border-top: 1px solid var(--line); }
  .admin-metrics > div:nth-child(4) { border-top: 1px solid var(--line); }
  .admin-toolbar { grid-template-columns: 1fr 1fr; align-items: end; padding: 10px 12px; }
  .admin-search { grid-column: 1 / -1; }
  .admin-filter-reset { min-height: 38px; }
  .admin-workspace { height: auto; }
  .admin-user-table-head { display: none; }
  .admin-users { min-width: 0; display: grid; gap: 9px; padding: 10px 12px 18px; }
  .admin-user-row { min-height: 0; grid-template-columns: 1fr 1fr; gap: 12px 10px; padding: 13px; border: 1px solid var(--line); border-radius: 6px; background: white; }
  .admin-user-row:hover { border-color: #8ba79c; }
  .admin-user-row > *::before { content: attr(data-label); display: block; margin-bottom: 5px; color: var(--muted); font-size: 9px; font-weight: 800; text-transform: uppercase; }
  .admin-user-identity { grid-column: 1 / -1; }
  .admin-user-identity::before { display: none; }
  .admin-store-name { white-space: normal; overflow-wrap: anywhere; }
  .admin-row-action { width: 100%; min-height: 38px; }
  .admin-dialog.editor-open .admin-workspace { grid-template-columns: 1fr; }
  .admin-dialog.editor-open .admin-editor { position: absolute; z-index: 5; inset: 0; width: 100%; height: 100%; border-left: 0; }
  .admin-editor-head { min-height: 64px; }
  .admin-editor-actions { position: sticky; bottom: 0; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .admin-editor-actions .admin-secondary-button:first-child { width: 38px; padding: 0; }
  .admin-editor-actions .admin-secondary-button:first-child span { display: none; }
  .password-dialog { width: calc(100vw - 20px); }
  .admin-toast { right: 12px; bottom: 12px; }
}

@media (max-width: 560px) {
  .topbar { height: 60px; padding: 0 11px; }
  .brand-mark { width: 32px; height: 32px; }
  .brand-copy h1 { font-size: 14px; }
  .brand-copy span { display: none; }
  .admin-button span { display:none; }.admin-button{width:32px;justify-content:center;padding:0; }
  .system-status span:last-child { display: none; }
  .app-shell { height: calc(100dvh - 60px); }
  .sidebar { inset: 60px auto 0 0; }
  .conversation-head { min-height: 62px; padding: 11px 14px; }
  .conversation-head h2 { font-size: 14px; }
  .messages { padding: 18px 14px; }
  .message { gap: 9px; }
  .message-avatar { flex-basis: 29px; width: 29px; height: 29px; }
  .answer-text { font-size: 13px; }
  .composer { margin: 0 10px 10px; }
  .composer-footer { align-items: flex-end; gap: 8px; }
  .llm-toggle > span:last-child { max-width: 82px; line-height: 1.2; }
  .send-button span { display: none; }
  .send-button { width: 38px; padding: 0; justify-content: center; }
  .answer-carousel { grid-auto-columns: 82vw; }
  .answer-image-card img { height: 180px; }
  .guidance-dialog{width:100vw;height:100dvh;border-radius:0}.guidance-layout{grid-template-columns:1fr;height:calc(100% - 121px)}.guidance-list{max-height:190px;border-right:0;border-bottom:1px solid var(--line)}.guidance-toolbar{flex-wrap:wrap}.guidance-toolbar input{width:100%}.guidance-toolbar button{margin-left:0}.guidance-fields{grid-template-columns:1fr}.wide-field{grid-column:auto}.guidance-editor-wrap{padding:14px}.management-assets{grid-template-columns:1fr 1fr}
}
