:root {
  --navy-950: #061727;
  --navy-900: #0a2239;
  --blue-700: #075e9e;
  --blue-600: #0878c8;
  --cyan-400: #35c6d4;
  --mint-100: #dff8f0;
  --mint-500: #36b98c;
  --white: #fff;
  --gray-50: #f5f8fa;
  --gray-100: #edf2f5;
  --gray-200: #dbe5eb;
  --gray-500: #687b89;
  --gray-700: #3c5060;
  --danger: #b33f55;
  --shadow: 0 24px 70px rgba(5, 31, 51, .14);
}

*, *::before, *::after { box-sizing: border-box; }
html { min-height: 100%; }
body { min-height: 100vh; margin: 0; overflow-x: hidden; color: var(--navy-900); background: var(--gray-50); font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; line-height: 1.5; }
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid rgba(21, 149, 220, .35); outline-offset: 3px; }
.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; }
.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 20; padding: .7rem 1rem; color: var(--white); background: var(--navy-950); border-radius: 8px; }
.skip-link:focus { top: 1rem; }

.agent-header { height: 72px; padding: 0 clamp(18px, 4vw, 54px); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--gray-200); background: rgba(255,255,255,.94); }
.brand { display: inline-flex; align-items: center; gap: .7rem; font-weight: 850; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; color: var(--white); background: linear-gradient(145deg, var(--blue-600), var(--cyan-400)); border-radius: 11px; font-size: 1.45rem; font-weight: 500; }
.agent-header nav { display: flex; gap: 24px; color: var(--gray-700); font-size: .9rem; font-weight: 700; }
.agent-header nav a:hover { color: var(--blue-600); }

.auth-view { min-height: calc(100vh - 72px); display: grid; place-items: center; padding: 40px 20px; background: radial-gradient(circle at 75% 15%, #dff8f0 0, transparent 27%), linear-gradient(145deg, #f7fbfe, #fff); }
.auth-card { width: min(100%, 550px); padding: clamp(30px, 6vw, 54px); background: var(--white); border: 1px solid var(--gray-200); border-radius: 28px; box-shadow: var(--shadow); }
.lock-icon { display: grid; place-items: center; width: 52px; height: 52px; margin-bottom: 28px; color: var(--blue-600); background: #eaf6fc; border-radius: 15px; font-size: 1.3rem; }
.eyebrow { margin: 0 0 8px; color: var(--blue-700); font-size: .72rem; font-weight: 850; letter-spacing: .11em; text-transform: uppercase; }
.auth-card h1, .mascot-panel h1 { margin: 0 0 14px; color: var(--navy-950); font-size: clamp(2rem, 5vw, 3rem); line-height: 1.08; letter-spacing: -.04em; }
.auth-card > p:not(.eyebrow, .privacy-note) { color: var(--gray-700); }
.auth-card form { margin-top: 28px; }
.auth-card label { display: block; margin-bottom: 8px; font-size: .84rem; font-weight: 800; }
.password-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
input, textarea { width: 100%; border: 1px solid var(--gray-200); color: var(--navy-900); background: var(--white); }
input { min-height: 49px; padding: 0 14px; border-radius: 11px; }
input:focus, textarea:focus { border-color: var(--blue-600); outline: 3px solid rgba(8,120,200,.11); }
.button { min-height: 49px; padding: 0 20px; border: 0; border-radius: 11px; font-weight: 800; }
.button-primary { color: var(--white); background: var(--blue-600); }
.button-primary:hover { background: var(--blue-700); }
.form-error { min-height: 1.4em; margin: 9px 0 0; color: var(--danger); font-size: .8rem; }
.privacy-note { margin: 18px 0 0; color: var(--gray-500); font-size: .74rem; }

.chat-view { min-height: calc(100vh - 72px); padding: clamp(14px, 3vw, 34px); background: #eaf0f4; }
.chat-shell { width: min(100%, 1440px); height: calc(100vh - 72px - clamp(28px, 6vw, 68px)); min-height: 620px; margin: auto; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); overflow: hidden; background: var(--white); border: 1px solid var(--gray-200); border-radius: 24px; box-shadow: var(--shadow); }
.mascot-panel { position: relative; min-width: 0; min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; padding: 30px; overflow: hidden; color: #d8e7ef; background: linear-gradient(155deg, #0a2944 0%, var(--navy-950) 65%); border-right: 1px solid rgba(255,255,255,.08); }
.mascot-panel::before { content: ""; position: absolute; width: 420px; height: 420px; left: -170px; top: -200px; background: rgba(53,198,212,.15); border-radius: 50%; filter: blur(8px); pointer-events: none; }
.mascot-copy { position: relative; z-index: 2; }
.mascot-panel h1 { margin-bottom: 5px; color: var(--white); font-size: clamp(1.7rem, 2.5vw, 2.4rem); }
.mascot-panel .eyebrow { color: #69d9e4; }
.mascot-copy > p:last-child { display: inline-flex; align-items: center; gap: 8px; margin: 0; color: #b9ced9; font-size: .82rem; font-weight: 700; }
.mascot-copy > p:last-child::before { content: ""; width: 8px; height: 8px; background: var(--mint-500); border-radius: 50%; box-shadow: 0 0 0 4px rgba(54,185,140,.14); }
.mascot-panel.is-speaking .mascot-copy > p:last-child::before { background: var(--cyan-400); animation: speaking-pulse 1s ease-in-out infinite; }
@keyframes speaking-pulse { 50% { box-shadow: 0 0 0 7px rgba(53,198,212,.08); transform: scale(.85); } }
.mascot-stage { position: relative; min-height: 0; width: min(100%, 430px); margin: 18px auto 0; overflow: hidden; border: 1px solid rgba(255,255,255,.12); border-radius: 220px 220px 28px 28px; background: #d9e0dc; box-shadow: 0 22px 48px rgba(0,0,0,.25); }
.mascot-stage::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); pointer-events: none; }
.mascot-image { width: 100%; height: 100%; display: block; object-fit: cover; object-position: 50% 18%; user-select: none; -webkit-user-drag: none; }
.voice-setting { position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 15px 0 0; margin-top: 15px; border-top: 1px solid rgba(255,255,255,.12); }
.voice-setting strong, .voice-setting span { display: block; }
.voice-setting strong { color: var(--white); font-size: .8rem; }
.voice-setting div > span { color: #90a9b8; font-size: .68rem; }
.switch { position: relative; flex: 0 0 42px; height: 24px; }
.switch input { position: absolute; opacity: 0; }
.switch > span:not(.sr-only) { position: absolute; inset: 0; background: #526b7b; border-radius: 30px; transition: .2s; }
.switch > span:not(.sr-only)::after { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: var(--white); border-radius: 50%; transition: .2s; }
.switch input:checked + span { background: var(--mint-500); }
.switch input:checked + span::after { transform: translateX(18px); }
.text-button { padding: 6px 0; color: var(--gray-500); background: none; border: 0; font-size: .72rem; font-weight: 750; }
.text-button:hover { color: var(--blue-700); }

.conversation-panel { min-width: 0; min-height: 0; display: grid; grid-template-rows: auto 1fr auto auto auto; }
.status-bar { min-height: 55px; padding: 0 24px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--gray-100); color: var(--gray-700); font-size: .75rem; font-weight: 750; }
.status-bar span:first-child { display: flex; align-items: center; gap: 8px; }
.status-bar i { width: 8px; height: 8px; background: var(--mint-500); border-radius: 50%; box-shadow: 0 0 0 4px rgba(54,185,140,.14); }
.model-label { padding: 5px 9px; color: var(--blue-700); background: #eaf6fc; border-radius: 30px; }
.status-actions { display: flex; align-items: center; gap: 12px; }
.messages { overflow-y: auto; padding: 30px clamp(20px, 5vw, 56px); scroll-behavior: smooth; }
.message { max-width: 760px; display: flex; gap: 12px; margin-bottom: 24px; }
.message-user { margin-left: auto; flex-direction: row-reverse; }
.avatar { flex: 0 0 33px; height: 33px; display: grid; place-items: center; color: var(--white); background: var(--blue-600); border-radius: 10px; font-weight: 850; }
.message-user .avatar { background: var(--navy-900); }
.message-content { min-width: 0; padding: 14px 17px; background: var(--gray-50); border: 1px solid var(--gray-100); border-radius: 4px 15px 15px 15px; }
.message-user .message-content { background: #eaf6fc; border-color: #d8ecf6; border-radius: 15px 4px 15px 15px; }
.message-content strong { font-size: .72rem; }
.message-content p { margin: 5px 0 0; color: var(--gray-700); font-size: .9rem; white-space: pre-wrap; }
.speak-reply { margin-top: 9px; padding: 4px 0; color: var(--blue-700); background: none; border: 0; font-size: .7rem; font-weight: 750; }
.typing-dots { display: inline-flex; gap: 4px; padding: 5px 0; }
.typing-dots i { width: 6px; height: 6px; background: var(--gray-500); border-radius: 50%; animation: bounce 1s infinite alternate; }
.typing-dots i:nth-child(2) { animation-delay: .2s; }
.typing-dots i:nth-child(3) { animation-delay: .4s; }
@keyframes bounce { to { opacity: .25; transform: translateY(-3px); } }
.suggestions { padding: 0 clamp(20px, 5vw, 56px) 14px; display: flex; flex-wrap: wrap; gap: 8px; }
.suggestions button { padding: 9px 12px; color: var(--blue-700); background: var(--white); border: 1px solid #cfe3ee; border-radius: 30px; font-size: .75rem; font-weight: 700; }
.suggestions button:hover { background: #eff8fc; border-color: var(--blue-600); }
.composer { margin: 0 clamp(20px, 5vw, 56px); display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 10px; border: 1px solid var(--gray-200); border-radius: 16px; box-shadow: 0 8px 24px rgba(8,35,55,.08); }
.composer textarea { min-height: 44px; max-height: 130px; padding: 10px; resize: none; border: 0; outline: 0; line-height: 1.45; }
.composer textarea:focus { border: 0; outline: 0; }
.composer-actions { display: flex; align-items: end; gap: 6px; }
.icon-button, .send-button { height: 42px; border: 0; border-radius: 10px; }
.icon-button { width: 42px; display: grid; place-items: center; color: var(--blue-700); background: #eaf6fc; }
.icon-button svg { width: 19px; }
.icon-button.listening { color: var(--white); background: var(--danger); animation: voice-pulse 1.2s infinite; }
@keyframes voice-pulse { 50% { box-shadow: 0 0 0 6px rgba(179,63,85,.15); } }
.send-button { padding: 0 15px; color: var(--white); background: var(--blue-600); font-weight: 800; }
.send-button:disabled { opacity: .55; cursor: wait; }
.medical-note { margin: 10px 20px 13px; color: var(--gray-500); font-size: .66rem; text-align: center; }

@media (max-width: 760px) {
  .agent-header { height: 64px; }
  .chat-view { min-height: calc(100vh - 64px); padding: 0; }
  .chat-shell { height: auto; min-height: calc(100vh - 64px); grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(280px, 38vh) minmax(560px, 1fr); border: 0; border-radius: 0; }
  .mascot-panel { grid-template-columns: minmax(0, 1fr) minmax(150px, 42%); grid-template-rows: 1fr auto; gap: 8px 18px; padding: 20px; border-right: 0; border-bottom: 1px solid var(--gray-200); }
  .mascot-copy { align-self: center; }
  .mascot-panel h1 { font-size: clamp(1.45rem, 7vw, 2.1rem); overflow-wrap: anywhere; }
  .mascot-stage { grid-column: 2; grid-row: 1 / 3; width: 100%; height: 100%; margin: 0; border-radius: 100px 100px 20px 20px; }
  .voice-setting { align-self: end; padding-top: 12px; margin-top: 0; }
  .voice-setting div > span { display: none; }
  .status-bar { padding: 0 14px; }
  .messages { padding: 22px 14px; }
  .message { max-width: 100%; }
  .message-user { max-width: 90%; }
  .message-content p { overflow-wrap: anywhere; }
  .suggestions { padding: 0 14px 12px; flex-wrap: nowrap; overflow-x: auto; }
  .suggestions button { flex: 0 0 auto; }
  .composer { margin: 0 14px; }
  .password-row { grid-template-columns: 1fr; }
  .agent-header nav { gap: 15px; }
}

@media (max-width: 430px) {
  .chat-shell { grid-template-rows: minmax(245px, 34vh) minmax(560px, 1fr); }
  .mascot-panel { grid-template-columns: minmax(0, 1fr) minmax(125px, 40%); padding: 16px; }
  .mascot-copy > p:last-child { font-size: .72rem; }
  .model-label { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
