:root {
  color-scheme: light;
  --navy: #142b47;
  --blue: #1f5f9e;
  --blue-dark: #174b7e;
  --ink: #1c2939;
  --muted: #6d7886;
  --line: #e4e8ee;
  --surface: #ffffff;
  --page: #f7f8fa;
  --danger: #aa3030;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--page); }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.login-layout { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 85% 12%, #e9f2fc 0, transparent 36%), var(--page); }
.login-card { width: min(100%, 420px); padding: 40px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 18px 55px #142b4712; }
.brand-mark { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 13px; background: var(--navy); color: white; font-weight: 800; font-size: 24px; }
.brand-mark.small { width: 30px; height: 30px; font-size: 16px; border-radius: 9px; }
.brand-mark.large { width: 54px; height: 54px; font-size: 28px; border-radius: 16px; margin: 0 auto 20px; }
.eyebrow { margin: 22px 0 8px; color: var(--blue); font-size: 11px; font-weight: 800; letter-spacing: .14em; }
h1 { margin: 0; color: var(--navy); font-size: 30px; letter-spacing: -.035em; }
.muted { color: var(--muted); line-height: 1.6; }
.login-card .muted { margin: 10px 0 28px; }
label { display: block; margin: 18px 0 8px; color: #3e4a58; font-size: 13px; font-weight: 650; }
input { width: 100%; height: 46px; padding: 0 13px; border: 1px solid #d6dce4; border-radius: 9px; outline: none; }
input:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px #1f5f9e1b; }
.primary-button { height: 46px; color: #fff; border: 0; border-radius: 9px; background: var(--blue); font-weight: 700; }
.primary-button:hover { background: var(--blue-dark); }
.full-width { width: 100%; margin-top: 24px; }
.error-text { min-height: 18px; margin: 12px 2px 0; color: var(--danger); font-size: 13px; }
.app-layout { height: 100dvh; min-height: 540px; display: grid; grid-template-columns: 280px minmax(0, 1fr); background: var(--surface); }
.sidebar { display: flex; flex-direction: column; min-height: 0; padding: 20px 14px 14px; color: #eef3f8; background: var(--navy); }
.sidebar-head { display: grid; gap: 20px; }
.admin-open { margin-top: 12px; padding: 9px 10px; color: #e9f2fa; border: 1px solid #ffffff38; border-radius: 8px; background: #ffffff0c; text-align: left; font-size: 12px; font-weight: 650; }
.admin-open:hover { background: #ffffff1a; }
.brand-lockup { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 750; }
.new-chat-button { height: 40px; text-align: left; padding: 0 12px; color: #f3f7fb; border: 1px solid #ffffff35; border-radius: 9px; background: #ffffff0c; font-weight: 650; }
.new-chat-button:hover { background: #ffffff1a; }
.sidebar-caption { margin: 26px 8px 9px; color: #aebdd0; font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: .09em; }
.conversation-list { display: grid; gap: 4px; align-content: start; overflow: auto; }
.conversation-row { display: flex; align-items: center; gap: 4px; min-width: 0; border-radius: 8px; }
.conversation-row.active, .conversation-row:hover { background: #ffffff16; }
.conversation-open { flex: 1; min-width: 0; padding: 10px 9px; overflow: hidden; color: #eaf0f6; border: 0; background: none; text-align: left; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.conversation-delete { margin-right: 5px; color: #c1cedc; border: 0; background: none; font-size: 17px; opacity: .7; }
.conversation-delete:hover { opacity: 1; color: white; }
.sidebar-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding: 16px 7px 4px; border-top: 1px solid #ffffff26; color: #d4deea; font-size: 12px; }
.sidebar-foot span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-button { padding: 5px; color: inherit; border: 0; background: none; font-size: 12px; white-space: nowrap; }
.text-button:hover { text-decoration: underline; }
.chat-column { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--surface); }
.mobile-head { display: none; }
.welcome-view { width: min(720px, calc(100% - 40px)); margin: auto; padding: 40px 0 24px; text-align: center; }
.welcome-view .eyebrow { margin-top: 0; }
.welcome-view h1 { font-size: clamp(26px, 3vw, 36px); }
.welcome-view .muted { margin: 10px 0 28px; }
.suggestions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; text-align: left; }
.suggestions button { min-height: 64px; padding: 13px 15px; color: #304256; border: 1px solid var(--line); border-radius: 11px; background: white; text-align: left; font-size: 13px; }
.suggestions button:hover { border-color: #a6bfd9; background: #f8fbff; }
.messages { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 20px; width: min(820px, calc(100% - 40px)); margin: 0 auto; padding: 30px 0; }
.message { max-width: min(760px, 90%); }
.message.user { align-self: flex-end; padding: 12px 16px; color: #fff; background: var(--blue); border-radius: 16px 16px 4px 16px; line-height: 1.55; white-space: pre-wrap; }
.message.assistant { align-self: flex-start; line-height: 1.7; white-space: pre-wrap; }
.message.assistant .message-content { white-space: normal; }
.message-content p { margin: 0; }
.message-content p + p { margin-top: .75em; }
.message-content h1, .message-content h2, .message-content h3, .message-content h4 { margin: .7em 0 .3em; font-size: 1.12em; line-height: 1.4; }
.message-content ul, .message-content ol { margin: .45em 0; padding-inline-start: 1.5em; }
.message-content li + li { margin-top: .2em; }
.message-content code { padding: 1px 4px; border-radius: 4px; background: #f0f3f6; font-size: .92em; }
.message.assistant a, .error-text a { color: var(--blue); text-decoration: underline; text-underline-offset: 2px; }
.thinking-indicator { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 13px; }
.thinking-dots { overflow: hidden; display: inline-block; width: 1.8em; animation: thinking-pulse 1.2s steps(4, end) infinite; }
@keyframes thinking-pulse { from { width: 0; } to { width: 1.8em; } }
@media (prefers-reduced-motion: reduce) { .thinking-dots { animation: none; } }
.message-meta { margin-top: 9px; color: var(--muted); font-size: 11px; }
.answer-feedback { display: flex; align-items: center; gap: 7px; margin-top: 8px; }
.answer-feedback button, .answer-feedback select { min-height: 30px; padding: 4px 9px; color: #536476; border: 1px solid var(--line); border-radius: 7px; background: white; font-size: 11px; }
.answer-feedback button:hover { border-color: #9ab4cf; color: var(--navy); }
.composer-wrap { flex: 0 0 auto; width: min(820px, calc(100% - 40px)); margin: 0 auto; padding-bottom: 15px; }
.privacy-note { margin: 0 0 8px; color: #84909d; text-align: center; font-size: 11px; }
.composer { display: flex; align-items: end; gap: 9px; padding: 8px 8px 8px 15px; border: 1px solid #dce1e8; border-radius: 15px; box-shadow: 0 4px 16px #142b470b; }
.composer:focus-within { border-color: #a4bdd6; }
.composer textarea { flex: 1; max-height: 160px; resize: none; padding: 8px 0; color: var(--ink); border: 0; outline: 0; background: none; line-height: 1.5; }
.composer textarea:focus { box-shadow: none; }
.send-button { flex: 0 0 38px; width: 38px; height: 38px; color: white; border: 0; border-radius: 11px; background: var(--blue); font-size: 22px; line-height: 1; }
.send-button:disabled { opacity: .45; cursor: wait; }
.send-button.is-thinking { opacity: 1; background: #075b91; animation: send-pulse 1.1s ease-in-out infinite; }
.send-spinner { display: block; width: 21px; height: 21px; margin: auto; border: 3px solid #ffffff70; border-top-color: #fff; border-right-color: #fff; border-radius: 50%; animation: send-spin .7s linear infinite; }
@keyframes send-spin { to { transform: rotate(360deg); } }
@keyframes send-pulse { 50% { box-shadow: 0 0 0 4px #0874b944; } }
@media (prefers-reduced-motion: reduce) { .send-button.is-thinking, .send-spinner { animation: none; } }
.composer-wrap .error-text { text-align: center; }
.admin-view { overflow: auto; width: min(1280px, 100%); height: 100dvh; margin: 0 auto; padding: 28px; background: #f6f8fb; }
.admin-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.admin-header h1 { margin: 0; color: var(--navy); font-size: 27px; }
.admin-header .muted { margin: 5px 0 0; }
.admin-header .new-chat-button { color: var(--navy); border-color: var(--line); background: white; }
.admin-summary { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.admin-stat { min-width: 140px; padding: 14px 17px; border: 1px solid var(--line); border-radius: 12px; background: white; }
.admin-stat strong { display: block; color: var(--navy); font-size: 23px; }
.admin-stat span { color: var(--muted); font-size: 12px; }
.admin-grid { display: grid; grid-template-columns: minmax(230px, .8fr) minmax(0, 1.6fr); gap: 14px; }
.admin-panel { min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: white; }
.admin-panel h2 { margin: 0 0 12px; color: var(--navy); font-size: 16px; }
.admin-panel input[type=search] { box-sizing: border-box; width: 100%; margin-bottom: 10px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; }
.admin-list { max-height: 360px; overflow: auto; }
.admin-row { display: block; width: 100%; padding: 10px; color: var(--ink); border: 0; border-bottom: 1px solid #edf0f3; background: white; text-align: left; cursor: pointer; }
.admin-row:hover, .admin-row[aria-current=true] { background: #f0f6fb; }
.admin-row strong, .admin-row small { display: block; }
.admin-row small { margin-top: 3px; color: var(--muted); overflow-wrap: anywhere; }
.admin-transcript { max-height: 460px; overflow: auto; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.admin-message { margin: 10px 0; padding: 11px 13px; border-radius: 10px; background: #f3f6f9; white-space: pre-wrap; overflow-wrap: anywhere; }
.admin-message.user { background: #edf5fb; }
.admin-message small { display: block; margin-bottom: 5px; color: var(--muted); font-size: 11px; }
.admin-feedback-panel { margin-top: 14px; }
.admin-feedback-item { padding: 12px 0; border-bottom: 1px solid #edf0f3; }
.admin-feedback-item:last-child { border-bottom: 0; }
.admin-feedback-item p { margin: 5px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.admin-feedback-item button { padding: 5px 8px; color: #075b91; border: 1px solid #c7d8e6; border-radius: 7px; background: white; }
@media (max-width: 700px) {
  .app-layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .admin-view { padding: 18px 12px; }
  .admin-header { align-items: flex-start; flex-direction: column; }
  .admin-grid { grid-template-columns: 1fr; }
  .mobile-head { display: flex; align-items: center; justify-content: space-between; min-height: 55px; padding: 0 17px; border-bottom: 1px solid var(--line); color: var(--navy); }
  .mobile-actions { display: flex; align-items: center; gap: 10px; }
  .mobile-actions .text-button { color: var(--blue); }
  .welcome-view { margin: auto; padding-top: 30px; }
  .suggestions { grid-template-columns: 1fr; }
  .messages { padding-top: 20px; }
}
