:root {
  --canvas: #f4f6f9;
  --surface: #ffffff;
  --surface-soft: #f7f8fa;
  --ink: #050505;
  --ink-2: #111827;
  --muted: #5f6875;
  --line: #d8dee8;
  --line-strong: #b8c2cf;
  --forest: #071a33;
  --forest-hover: #0d2a4f;
  --forest-soft: #eaf0f7;
  --clay: #071a33;
  --danger: #050505;
  --shadow-lg: 0 30px 90px rgba(7,26,51,.10), 0 4px 16px rgba(7,26,51,.04);
  --shadow-sm: 0 10px 32px rgba(7,26,51,.07);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); color: var(--ink); font-family: var(--sans); }
body { min-height: 100dvh; margin: 0; display: flex; flex-direction: column; background: radial-gradient(circle at 4% 0%, rgba(255,255,255,.95), transparent 34rem), var(--canvas); }
button, input, textarea { font: inherit; }
button, a, input, textarea, summary { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, textarea:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid rgba(7,26,51,.24); outline-offset: 3px; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.site-header { height: 72px; flex: 0 0 72px; display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(20px,5vw,72px); border-bottom: 1px solid rgba(7,26,51,.08); }
.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; }
.brand > span:last-child { display: grid; gap: 1px; }
.brand-mark { display: block; width: 36px; height: 36px; flex: 0 0 auto; }
.avatar { display: grid; place-items: center; width: 36px; height: 36px; flex: 0 0 auto; border-radius: 42% 58% 49% 51%; background: var(--ink); color: #ffffff; font: 600 19px/1 var(--serif); box-shadow: inset 0 0 0 1px rgba(255,255,255,.14); }
.brand strong { font: 650 21px/1 var(--serif); letter-spacing: -.04em; }
.brand small { color: var(--muted); font-size: 9px; font-weight: 750; letter-spacing: .11em; text-transform: uppercase; }
.privacy-status, .ready, #agent-status { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--muted); font-size: 12px; font-weight: 650; }
.header-actions { display: flex; align-items: center; gap: 16px; }
.return-agent { min-height: 36px; border: 1px solid var(--line); border-radius: 99px; padding: 7px 12px; background: rgba(255,255,255,.5); color: var(--forest); font-size: 11px; font-weight: 750; cursor: pointer; }
.return-agent:hover { border-color: var(--forest); background: var(--forest-soft); }
.auth-button { min-height: 40px; border: 1px solid var(--line-strong); border-radius: 999px; padding: 8px 14px; background: var(--surface); color: var(--ink); font-size: 12px; font-weight: 750; cursor: pointer; }
.auth-button:hover { border-color: var(--forest); background: var(--forest-soft); }
.privacy-status i, .ready i, #agent-status i { width: 7px; height: 7px; border-radius: 50%; background: #071a33; box-shadow: 0 0 0 4px rgba(7,26,51,.11); }

main { min-height: 0; flex: 1; display: grid; place-items: center; padding: clamp(22px,4vw,54px); }
.home-shell { width: min(1060px,100%); display: grid; grid-template-columns: minmax(0,1fr) minmax(360px,460px); align-items: center; gap: clamp(45px,8vw,110px); }
.home-intro { padding: 20px 0; }
.eyebrow { margin: 0 0 16px; color: var(--clay); font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
h1 { max-width: 660px; margin: 0; font: 500 clamp(48px,7vw,76px)/.95 var(--serif); letter-spacing: -.058em; text-wrap: balance; }
h1 em { color: var(--forest); font-weight: 400; }
.hero-copy { max-width: 580px; margin: 24px 0 0; color: var(--muted); font-size: 16px; line-height: 1.7; text-wrap: pretty; }
.trust-list { display: flex; flex-wrap: wrap; gap: 10px 22px; margin: 32px 0 0; padding: 0; color: var(--ink-2); font-size: 12px; font-weight: 650; list-style: none; }
.trust-list li { display: flex; align-items: center; gap: 7px; }
.trust-list span { color: var(--forest); font-weight: 850; }

.create-card { display: grid; gap: 21px; padding: clamp(25px,3vw,36px); border: 1px solid rgba(7,26,51,.13); border-radius: 22px; background: var(--surface); box-shadow: var(--shadow-lg); }
.form-heading { display: flex; gap: 12px; align-items: flex-start; padding-bottom: 5px; }
.form-heading h2 { margin: 0; font: 600 25px/1.12 var(--serif); letter-spacing: -.025em; }
.form-heading p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }

label { display: block; color: var(--ink-2); font-size: 13px; font-weight: 740; }
input, textarea { display: block; width: 100%; margin-top: 8px; border: 1px solid var(--line-strong); border-radius: 12px; background: #fff; color: var(--ink); padding: 13px 14px; line-height: 1.45; transition: border-color .16s ease, box-shadow .16s ease, background .16s ease; }
input::placeholder, textarea::placeholder { color: #737b87; opacity: 1; }
input:hover, textarea:hover { border-color: #aeb8c5; }
input:focus, textarea:focus { border-color: var(--forest); outline: 0; box-shadow: 0 0 0 4px rgba(7,26,51,.10); }
textarea { min-height: 112px; resize: vertical; }
.field-help { display: block; margin-top: 7px; color: var(--muted); font-size: 11px; font-weight: 500; }
.advanced-options { margin-top: -4px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.advanced-options > summary { min-height: 44px; display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 12px; font-weight: 700; cursor: pointer; list-style: none; }
.advanced-options > summary::-webkit-details-marker { display: none; }
.advanced-options > summary::after { content: "+"; font-size: 18px; font-weight: 400; }
.advanced-options[open] > summary::after { content: "−"; }
.runtime-picker { display: grid; gap: 8px; margin: 0; padding: 4px 0 15px; border: 0; }
.runtime-picker legend { padding: 0 0 8px; color: var(--ink-2); font-size: 12px; font-weight: 750; }
.runtime-picker label { display: grid; grid-template-columns: 18px minmax(0,1fr); gap: 10px; min-height: 65px; align-items: start; margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); cursor: pointer; }
.runtime-picker input { width: 18px; height: 18px; margin: 2px 0 0; padding: 0; accent-color: var(--forest); }
.runtime-picker .runtime-copy { display: grid; gap: 5px; }
.runtime-title { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.runtime-picker b { font-size: 13px; }
.runtime-badge { display: inline-flex; align-items: center; width: fit-content; min-height: 20px; padding: 2px 8px; border-radius: 999px; background: var(--forest); color: #fff; font-size: 9px; font-style: normal; font-weight: 800; letter-spacing: .02em; }
.runtime-picker small { color: var(--muted); font-size: 11px; font-weight: 500; line-height: 1.4; }
.runtime-picker label:has(input:checked) { border-color: var(--forest); background: var(--forest-soft); }
.error { min-height: 1em; margin: -8px 0 0; color: var(--danger); font-size: 12px; line-height: 1.45; }
.primary, .secondary { min-height: 46px; border-radius: 11px; padding: 11px 16px; font-weight: 750; cursor: pointer; transition: transform .16s ease, background .16s ease, border-color .16s ease, box-shadow .16s ease, opacity .16s ease; }
.primary { border: 0; background: var(--ink); color: white; box-shadow: 0 5px 13px rgba(7,26,51,.14); }
.primary:hover { background: var(--forest-hover); transform: translateY(-1px); box-shadow: 0 8px 18px rgba(7,26,51,.17); }
.secondary { border: 1px solid var(--line-strong); background: #fff; color: var(--ink); }
.secondary:hover { border-color: #aeb8c5; background: var(--surface-soft); transform: translateY(-1px); }
.primary:disabled, .secondary:disabled, .send-button:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.create-button { width: 100%; display: flex; align-items: center; justify-content: space-between; min-height: 52px; padding-inline: 19px; }
.create-button b { font-size: 19px; }
.form-assurance { margin: -10px 0 0; color: var(--muted); font-size: 10px; text-align: center; }
.form-assurance span { color: #071a33; font-size: 8px; }

.progress-card { width: min(650px,100%); padding: clamp(34px,6vw,64px); border: 1px solid rgba(7,26,51,.12); border-radius: 24px; background: var(--surface); box-shadow: var(--shadow-lg); text-align: center; }
.progress-card h1 { margin-inline: auto; font-size: clamp(42px,6vw,60px); }
.progress-card .hero-copy { margin: 18px auto 0; font-size: 14px; }
.agent-orb { position: relative; display: grid; place-items: center; width: 90px; height: 90px; margin: 0 auto 30px; border-radius: 42% 58% 49% 51%; background: var(--ink); color: white; font: 500 39px var(--serif); animation: breathe 3s ease-in-out infinite; }
.agent-orb i { position: absolute; inset: -8px; border: 1px solid rgba(7,26,51,.2); border-radius: inherit; }
.steps { max-width: 420px; margin: 30px auto 0; padding: 0; list-style: none; text-align: left; }
.steps li { display: flex; align-items: center; gap: 12px; margin: 7px 0; padding: 13px 15px; border-radius: 11px; background: var(--surface-soft); color: var(--muted); font-size: 13px; }
.steps li i { width: 9px; height: 9px; flex: 0 0 auto; border-radius: 50%; background: #c7ced8; }
.steps li.active { background: var(--forest-soft); color: var(--ink); font-weight: 700; }
.steps li.active i { background: var(--forest); box-shadow: 0 0 0 5px rgba(7,26,51,.11); }
.steps li.done i { background: #071a33; }
.progress-card > .secondary { margin-top: 14px; }

body:has(.chat-app:not(.hidden)) .return-agent { display: none; }
.chat-app { position: relative; width: min(1120px,100%); height: min(790px,calc(100dvh - 130px)); min-height: 560px; display: grid; grid-template-rows: 72px minmax(0,1fr) auto; overflow: hidden; border: 1px solid rgba(7,26,51,.13); border-radius: 22px; background: var(--surface); box-shadow: var(--shadow-lg); }
.chat-topbar { display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(18px,3vw,30px); border-bottom: 1px solid var(--line); background: rgba(255,255,255,.94); }
.agent-identity { display: flex; align-items: center; gap: 12px; min-width: 0; }
.agent-identity .avatar { width: 42px; height: 42px; font-size: 19px; }
.agent-identity > div:last-child { min-width: 0; }
.agent-identity h2 { margin: 0 0 3px; overflow: hidden; font: 600 21px/1.1 var(--serif); letter-spacing: -.025em; text-overflow: ellipsis; white-space: nowrap; }
#agent-status { font-size: 11px; }
#agent-status.thinking { color: var(--forest); }
#agent-status.thinking i { animation: pulse 1.2s ease-in-out infinite; }
.topbar-actions { display: flex; gap: 7px; }
.icon-button { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 12px; background: transparent; color: var(--ink); cursor: pointer; font-weight: 800; letter-spacing: .08em; }
.icon-button:hover { background: var(--surface-soft); border-color: var(--line-strong); }
.icon-button svg { width: 19px; height: 19px; fill: currentColor; }
.messages { min-width: 0; min-height: 0; display: flex; flex-direction: column; align-items: stretch; gap: 18px; overflow-y: auto; padding: 34px max(clamp(20px,7vw,92px),calc((100% - 850px)/2)); scroll-padding-bottom: 24px; overscroll-behavior: contain; scrollbar-width: thin; }
.message-row { display: flex; align-items: flex-end; gap: 9px; width: 100%; }
.message-row.user { justify-content: flex-end; }
.message-row.agent { justify-content: flex-start; }
.message-avatar { display: grid; place-items: center; width: 28px; height: 28px; flex: 0 0 auto; border-radius: 42% 58% 49% 51%; background: var(--forest-soft); color: var(--forest); font: 650 13px var(--serif); }
.message-wrap { max-width: min(76%,720px); }
.message { padding: 12px 15px; border-radius: 16px 16px 16px 5px; background: #f0f2f5; color: var(--ink); font-size: 15px; line-height: 1.58; overflow-wrap: anywhere; white-space: pre-wrap; }
.message-row.user .message { border-radius: 16px 16px 5px 16px; background: var(--forest); color: white; }
.message-row.failed .message { background: #eef1f5; color: var(--danger); }
.message-meta { min-height: 15px; margin: 5px 3px 0; color: var(--muted); font-size: 10px; }
.message-row.user .message-meta { text-align: right; }
.message-row.pending .message { opacity: .72; }
.empty-chat { min-height: 100%; display: grid; place-content: center; justify-items: center; padding: 20px; text-align: center; }
.empty-chat .avatar { width: 58px; height: 58px; margin-bottom: 17px; font-size: 26px; }
.empty-chat h3 { margin: 0; font: 550 clamp(28px,4vw,38px) var(--serif); letter-spacing: -.04em; }
.empty-chat p { max-width: 470px; margin: 10px 0 22px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.prompt-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: 620px; }
.prompt-button { min-height: 42px; border: 1px solid var(--line); border-radius: 99px; padding: 9px 14px; background: var(--surface-soft); color: var(--ink-2); font-size: 12px; cursor: pointer; }
.prompt-button:hover { border-color: var(--forest); background: var(--forest-soft); }
.typing-row { display: flex; align-items: flex-end; gap: 9px; }
.typing-bubble { display: flex; align-items: center; gap: 9px; min-width: 60px; min-height: 42px; padding: 12px 15px; border-radius: 16px 16px 16px 5px; background: #f0f2f5; color: var(--ink-2); font-size: 12px; }
.typing-dots { display: flex; gap: 4px; }
.typing-bubble i { width: 5px; height: 5px; border-radius: 50%; background: var(--muted); animation: typing 1.15s ease-in-out infinite; }
.typing-bubble i:nth-child(2) { animation-delay: .15s; }
.typing-bubble i:nth-child(3) { animation-delay: .3s; }
.new-messages { position: absolute; left: 50%; bottom: 100px; z-index: 3; transform: translateX(-50%); min-height: 36px; border: 1px solid var(--line); border-radius: 99px; padding: 7px 13px; background: var(--surface); color: var(--forest); box-shadow: var(--shadow-sm); font-size: 11px; font-weight: 750; cursor: pointer; }
.composer-wrap { border-top: 1px solid var(--line); padding: 14px max(clamp(16px,6vw,80px),calc((100% - 850px)/2)) 13px; background: rgba(255,255,255,.97); }
#message-form { display: grid; grid-template-columns: 42px minmax(0,1fr) 44px; gap: 7px; align-items: end; padding: 6px; border: 1px solid var(--line-strong); border-radius: 15px; background: #fff; transition: border-color .16s ease, box-shadow .16s ease; }
#message-form:focus-within { border-color: var(--forest); box-shadow: 0 0 0 4px rgba(7,26,51,.09); }
#message-form textarea { min-height: 39px; max-height: 145px; margin: 0; padding: 9px 0; border: 0; border-radius: 0; resize: none; box-shadow: none; }
.attach-button { width: 42px; height: 42px; border: 0; border-radius: 11px; background: transparent; color: var(--forest); cursor: pointer; font-size: 19px; }
.attach-button:hover { background: var(--forest-soft); }
.image-preview { display: flex; align-items: center; gap: 9px; width: fit-content; max-width: 100%; margin: 0 0 8px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-soft); font-size: 11px; }
.image-preview img { width: 42px; height: 42px; border-radius: 7px; object-fit: cover; }
.image-preview span { max-width: 250px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.image-preview button { width: 28px; height: 28px; border: 0; border-radius: 50%; background: #e4e8ee; color: var(--ink); cursor: pointer; font-size: 18px; }
.send-button { width: 42px; height: 42px; display: grid; place-items: center; border: 0; border-radius: 11px; background: var(--ink); color: white; cursor: pointer; }
.send-button:hover { background: var(--forest-hover); }
.send-button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.composer-help { margin: 7px 3px 0; color: #737b87; font-size: 9px; text-align: right; }
.composer-error { min-height: 0; margin: 6px 3px 0; color: var(--danger); font-size: 10px; }
.composer-error:empty { display: none; }

.settings-dialog { width: min(430px,calc(100vw - 24px)); max-width: none; max-height: calc(100dvh - 24px); padding: 0; border: 0; border-radius: 22px; background: var(--surface); color: var(--ink); box-shadow: 0 30px 100px rgba(5,5,5,.28); overflow: hidden; }
.settings-dialog::backdrop, .channel-dialog::backdrop { background: rgba(7,26,51,.55); backdrop-filter: blur(5px); }
.settings-dialog[open], .channel-dialog[open] { animation: dialog-in .18s ease-out; }
.settings-panel { max-height: calc(100dvh - 24px); display: flex; flex-direction: column; }
.dialog-head { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px 22px 17px; border-bottom: 1px solid var(--line); }
.dialog-head small, .setting-section > small, .setting-head small { color: var(--muted); font-size: 9px; font-weight: 750; letter-spacing: .11em; text-transform: uppercase; }
.dialog-head h2 { margin: 3px 0 0; font: 600 27px var(--serif); }
.dialog-close { width: 38px; height: 38px; display: grid; place-items: center; border: 0; border-radius: 50%; background: #edf0f4; color: var(--ink); cursor: pointer; font-size: 24px; line-height: 1; }
.settings-content { min-height: 0; overflow-y: auto; padding: 20px 22px 26px; overscroll-behavior: contain; }
.agent-summary { display: grid; grid-template-columns: 48px minmax(0,1fr); gap: 13px; align-items: start; padding: 0 0 19px; }
.agent-summary .avatar { width: 48px; height: 48px; font-size: 22px; }
.agent-summary h3 { margin: 1px 0 4px; font: 600 23px var(--serif); }
#chat-purpose { margin: 0 0 9px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.ready { color: var(--forest); font-size: 10px; }
.setting-section { padding: 17px; }
.setting-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.setting-section h3, .setting-head h3, .setting-summary h3 { margin: 4px 0 0; font: 600 18px var(--serif); }
.setting-section > p { margin: 7px 0 12px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.setting-section .secondary, .details-body .secondary { width: 100%; min-height: 42px; font-size: 12px; }
.quota-card { margin: 0 0 10px; border: 1px solid rgba(7,26,51,.12); border-radius: 15px; background: linear-gradient(145deg,#f3f6fa,#ffffff); box-shadow: 0 5px 18px rgba(7,26,51,.04); }
.quota-breakdown { display: grid; gap: 13px; margin-top: 15px; }
.quota-period { display: grid; gap: 7px; }
.quota-period + .quota-period { padding-top: 13px; border-top: 1px solid rgba(7,26,51,.10); }
.quota-period > div:first-child { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.quota-period span { color: var(--ink-2); font-size: 12px; font-weight: 800; }
.quota-period strong { color: var(--forest); font-size: 13px; font-weight: 800; text-align: right; }
.quota-period > small { color: var(--muted); font-size: 10px; }
.settings-details { margin: 0 0 10px; overflow: hidden; border: 1px solid rgba(7,26,51,.13); border-radius: 15px; background: var(--surface-soft); box-shadow: 0 4px 14px rgba(7,26,51,.035); transition: border-color .18s ease, background .18s ease, box-shadow .18s ease; }
.settings-details[open] { border-color: rgba(7,26,51,.34); background: var(--surface); box-shadow: 0 8px 24px rgba(7,26,51,.075); }
.settings-details > summary { min-height: 70px; display: flex; align-items: center; gap: 10px; padding: 0 14px; cursor: pointer; list-style: none; transition: background .18s ease; }
.settings-details > summary:hover { background: rgba(7,26,51,.045); }
.settings-details > summary::-webkit-details-marker { display: none; }
.settings-details > summary > div { min-width: 0; flex: 1; }
.settings-details > summary small { color: var(--muted); font-size: 9px; font-weight: 750; letter-spacing: .11em; text-transform: uppercase; }
.settings-details > summary::after { content: "+"; width: 27px; height: 27px; flex: 0 0 27px; display: grid; place-items: center; border-radius: 50%; background: #e9edf3; color: var(--forest); font-size: 18px; font-weight: 500; line-height: 1; }
.settings-details[open] > summary::after { content: "−"; background: var(--forest-soft); }
.details-body { padding: 0 14px 15px; }
.details-body > p { margin: 0 0 12px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.danger-details { border-color: rgba(5,5,5,.19); background: #f8fafc; }
.danger-details[open] { border-color: rgba(5,5,5,.38); }
.danger-details .setting-summary h3 { color: var(--danger); }
.danger-details > summary::after { color: var(--danger); background: #e8edf4; }
.danger-button { border-color: rgba(5,5,5,.32) !important; color: var(--danger) !important; background: #ffffff !important; }
.danger-button:hover { border-color: var(--danger) !important; background: #eef2f7 !important; }
.channel-badge { flex: 0 0 auto; padding: 5px 8px; border-radius: 99px; background: #eaf0f7; color: var(--forest); font-size: 9px; font-weight: 800; }
.copy-status { min-height: 16px; color: var(--forest) !important; }
.quota-track { height: 9px; overflow: hidden; border-radius: 999px; background: #dce3ec; }
.quota-track i { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--forest); transition: width .2s ease; }
.compact-form, .auth-form { display: grid; gap: 15px; }
.compact-form { margin-top: 1px; }
.compact-form input { padding-block: 10px; }
.success-message { min-height: 1em; margin: -8px 0 0; color: var(--forest); font-size: 12px; font-weight: 750; line-height: 1.45; }
.success-message:empty { display: none; }
.remember-row { display: flex; align-items: center; gap: 9px; min-height: 44px; cursor: pointer; }
.remember-row input { width: 19px; height: 19px; margin: 0; accent-color: var(--forest); }
.auth-form .primary { width: 100%; }
.text-button { appearance: none; border: 0; background: none; padding: 8px 0; color: var(--muted); cursor: pointer; text-decoration: underline; }

@keyframes breathe { 50% { transform: scale(1.04) rotate(1deg); } }
@keyframes pulse { 50% { opacity: .4; transform: scale(.8); } }
@keyframes typing { 0%,60%,100% { opacity: .35; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
@keyframes dialog-in { from { opacity: 0; transform: translateY(10px) scale(.985); } }

.admin-main { display: block; padding: clamp(24px,4vw,56px); }
.admin-shell { width: min(1180px,100%); margin: 0 auto; }
.admin-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.admin-heading h1 { font-size: clamp(42px,6vw,66px); }
.admin-heading .hero-copy { margin-top: 12px; }
.metric-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 14px; margin-bottom: 18px; }
.metric, .admin-card { border: 1px solid rgba(7,26,51,.13); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow-sm); }
.metric { display: grid; gap: 5px; padding: 22px; }
.metric b { font: 600 31px var(--serif); }
.metric span { color: var(--muted); font-size: 12px; }
.admin-card { padding: clamp(20px,3vw,28px); }
.admin-grid { display: grid; grid-template-columns: 1fr 1.25fr; gap: 18px; margin-top: 18px; }
.section-title { margin-bottom: 17px; }
.section-title small { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.section-title h2 { margin: 4px 0 0; font: 600 25px var(--serif); }
.record-list { display: grid; gap: 9px; }
.record { display: grid; gap: 7px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); }
.record > div { display: flex; align-items: baseline; justify-content: space-between; gap: 15px; }
.record strong { font-size: 13px; }
.record small { color: var(--muted); font-size: 10px; text-align: right; }
.record p, .empty-record { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }

@media (max-width: 820px) {
  .site-header { height: 62px; flex-basis: 62px; padding: 0 17px; }
  .brand small { display: none; }
  .privacy-status { font-size: 10px; }
  main { place-items: stretch; padding: 16px; }
  .home-shell { grid-template-columns: 1fr; gap: 28px; max-width: 620px; margin: 0 auto; }
  .home-intro { padding: 14px 4px 0; }
  h1 { font-size: clamp(45px,12vw,64px); }
  .hero-copy { margin-top: 18px; font-size: 14px; }
  .trust-list { margin-top: 22px; }
  .create-card { padding: 24px 20px; }
  .chat-app { height: calc(100dvh - 94px); min-height: 0; border-radius: 17px; }
  .messages { padding: 25px 18px; }
  .message-wrap { max-width: 85%; }
  .composer-wrap { padding-inline: 12px; }
  .metric-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .admin-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  body:has(.chat-app:not(.hidden)) .site-header { display: none; }
  body:has(.chat-app:not(.hidden)) main { padding: 0; }
  main { padding: 10px; }
  .home-intro { padding-inline: 10px; }
  .home-intro h1 { font-size: clamp(43px,13.5vw,57px); }
  .hero-copy { line-height: 1.6; }
  .trust-list { display: grid; gap: 8px; }
  .create-card { border-radius: 18px; box-shadow: 0 12px 36px rgba(7,26,51,.07); }
  .form-heading h2 { font-size: 23px; }
  .progress-card { align-self: center; padding: 35px 22px; border-radius: 18px; }
  .progress-card h1 { font-size: 42px; }
  .chat-app { width: 100%; height: 100dvh; border: 0; border-radius: 0; box-shadow: none; }
  .chat-topbar { min-height: 62px; padding: 0 12px 0 14px; }
  .agent-identity .avatar { width: 38px; height: 38px; font-size: 17px; }
  .agent-identity h2 { font-size: 19px; }
  .icon-button { width: 40px; height: 40px; }
  .messages { gap: 14px; padding: 20px 13px; }
  .message-wrap { max-width: 88%; }
  .message { padding: 10px 13px; font-size: 14px; line-height: 1.55; }
  .message-avatar { display: none; }
  .empty-chat { padding: 16px 10px; }
  .empty-chat h3 { font-size: 30px; }
  .prompt-list { display: grid; width: 100%; }
  .prompt-button { width: 100%; border-radius: 12px; text-align: left; }
  .composer-wrap { padding: 9px 9px max(8px,env(safe-area-inset-bottom)); }
  #message-form { grid-template-columns: 40px minmax(0,1fr) 42px; padding: 5px; }
  .send-button { width: 40px; height: 40px; }
  .composer-help { display: none; }
  .new-messages { bottom: 78px; }
  .settings-dialog, .channel-dialog { width: 100vw; max-height: 92dvh; margin: auto 0 0; border-radius: 22px 22px 0 0; }
  .settings-panel, .dialog-panel { max-height: 92dvh; }
  .privacy-status { display: none; }
  .header-actions { gap: 7px; }
  .auth-button { min-height: 44px; }
  .admin-main { padding: 18px 12px; }
  .admin-heading { align-items: stretch; flex-direction: column; }
  .metric-grid { grid-template-columns: 1fr; }
  .record > div { align-items: flex-start; flex-direction: column; gap: 4px; }
  .record small { text-align: left; }
}

@media (max-height: 700px) and (min-width: 821px) { .chat-app { height: calc(100dvh - 92px); min-height: 500px; } main { padding-block: 10px; } .site-header { height: 64px; flex-basis: 64px; } }
@media (prefers-reduced-motion: reduce) { *,*::before,*::after { animation: none !important; scroll-behavior: auto !important; transition: none !important; } }
