.agent-page { min-height: 100svh; background: var(--paper-2); }
.agent-page::before { opacity: .1; }
.agent-header { min-height: 74px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 0 max(24px, calc((100vw - 1100px) / 2)); border-bottom: 1px solid var(--line); background: rgba(255, 253, 248, .92); }
.agent-home-link { color: var(--sage-dark); font-size: .86rem; font-weight: 800; }
.agent-shell { width: min(1440px, calc(100% - 32px)); min-height: calc(100svh - 74px); display: grid; place-items: center; margin-inline: auto; padding: 32px 0; }
.password-panel { width: min(540px, 100%); padding: clamp(28px, 6vw, 52px); border: 1px solid var(--line); border-radius: 12px; background: var(--paper); box-shadow: var(--shadow); }
.agent-mark { width: 58px; height: 58px; display: grid; place-items: center; margin-bottom: 25px; border-radius: 50%; background: var(--sage-dark); color: var(--white); font-family: var(--serif); font-size: 1.8rem; }
.agent-kicker { margin-bottom: 8px; color: var(--orange-dark); font-size: .74rem; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.password-panel h1, .chat-heading h1 { margin-bottom: 14px; font-size: clamp(2.2rem, 5vw, 3.7rem); }
.password-panel > p:not(.agent-kicker) { color: var(--muted); }
.password-form { margin-top: 28px; }
.password-form label { margin-bottom: 8px; }
.password-row { display: grid; grid-template-columns: 1fr auto; gap: 9px; }
.password-row input { min-width: 0; height: 48px; border: 1px solid var(--line); border-radius: 6px; padding: 0 14px; background: var(--white); }
.form-message { min-height: 24px; margin: 10px 0 0; color: var(--orange-dark); font-size: .84rem; font-weight: 700; }

.agent-workspace { width: 100%; min-height: min(780px, calc(100svh - 138px)); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: var(--paper); box-shadow: var(--shadow); }
.agent-workspace[hidden] { display: none; }
.avatar-panel { position: relative; min-width: 0; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; padding: clamp(30px, 4vw, 58px); border-right: 1px solid var(--line); background: linear-gradient(145deg, #edf1e8 0%, #f9eee4 100%); }
.avatar-panel::before { content: ""; position: absolute; width: 70%; aspect-ratio: 1; top: 24%; left: 15%; border-radius: 50%; background: rgba(255, 255, 255, .58); filter: blur(2px); }
.avatar-copy { position: relative; z-index: 1; }
.avatar-copy h2 { margin-bottom: 8px; font-size: clamp(2.2rem, 4vw, 4.3rem); }
.avatar-copy > p:last-child { margin: 0; color: var(--muted); font-weight: 700; }
.avatar-frame { position: relative; z-index: 1; width: min(100%, 580px); aspect-ratio: 1; align-self: center; overflow: hidden; margin-top: 28px; border: 6px solid rgba(255, 255, 255, .82); border-radius: 50% 50% 10% 10%; background: #f3f1f1; box-shadow: 0 22px 60px rgba(47, 67, 48, .18); }
.avatar-frame img { width: 100%; height: 100%; display: block; object-fit: cover; }
.avatar-panel.is-speaking .avatar-frame { box-shadow: 0 22px 60px rgba(47, 67, 48, .18), 0 0 0 8px rgba(216, 111, 63, .13); }
.speaking-indicator { position: absolute; right: 20px; bottom: 20px; display: flex; align-items: center; gap: 4px; padding: 10px 12px; border-radius: 999px; background: rgba(47, 67, 48, .88); opacity: 0; transform: translateY(8px); transition: opacity .2s ease, transform .2s ease; }
.avatar-panel.is-speaking .speaking-indicator { opacity: 1; transform: translateY(0); }
.speaking-indicator i { width: 4px; height: 7px; border-radius: 4px; background: var(--white); animation: voiceBar .7s ease-in-out infinite alternate; }
.speaking-indicator i:nth-child(2) { height: 14px; animation-delay: -.25s; }
.speaking-indicator i:nth-child(3) { height: 10px; animation-delay: -.45s; }
@keyframes voiceBar { to { transform: scaleY(1.8); } }
.chat-panel { min-width: 0; display: flex; flex-direction: column; overflow: hidden; background: var(--paper); }
.chat-heading { display: flex; align-items: start; justify-content: space-between; gap: 24px; padding: 34px 38px 24px; }
.chat-heading h1 { margin-bottom: 8px; font-size: clamp(2rem, 5vw, 3.4rem); }
.chat-heading p:last-child { margin-bottom: 0; color: var(--muted); }
.sound-toggle { flex: 0 0 auto; border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; background: var(--paper-2); color: var(--sage-dark); font-size: .78rem; font-weight: 800; }
.suggestions { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 38px 24px; }
.suggestions button { border: 1px solid #c8d2c2; border-radius: 999px; padding: 8px 13px; background: #edf1e8; color: var(--sage-dark); font-size: .79rem; font-weight: 750; text-align: left; }
.suggestions button:hover { border-color: var(--sage); background: var(--sage-pale); }
.messages { min-height: 300px; flex: 1 1 320px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; padding: 25px 38px; border-block: 1px solid var(--line); background: var(--paper-2); scroll-behavior: smooth; }
.message { max-width: min(76%, 680px); padding: 15px 18px; border-radius: 5px 16px 16px; background: #e7ede2; color: var(--ink); }
.message p { margin-bottom: 0; white-space: pre-wrap; }
.message-user { align-self: flex-end; border-radius: 16px 5px 16px 16px; background: var(--sage-dark); color: var(--white); }
.message-error { border: 1px solid #e4b9a5; background: #fff0e9; }
.message-label { display: block; margin-bottom: 5px; color: var(--orange-dark); font-size: .68rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.message-user .message-label { color: #f7c69e; }
.typing p::after { content: ""; display: inline-block; width: 1.2em; animation: dots 1.2s steps(4, end) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75%, 100% { content: "..."; } }
.composer { display: grid; grid-template-columns: 1fr auto auto; align-items: end; gap: 9px; padding: 18px 38px 10px; }
.composer textarea { min-height: 48px; max-height: 130px; resize: none; border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; background: var(--white); color: var(--ink); line-height: 1.45; }
.voice-button, .send-button { height: 48px; border: 0; border-radius: 8px; padding: 0 16px; font-weight: 800; }
.voice-button { width: 48px; padding: 0; border: 1px solid var(--line); background: var(--paper-2); }
.voice-button.listening { border-color: var(--orange); background: #ffe4d4; animation: pulse 1s ease infinite alternate; }
@keyframes pulse { to { box-shadow: 0 0 0 5px rgba(216, 111, 63, .16); } }
.send-button { background: var(--sage-dark); color: var(--white); }
.send-button:disabled, .voice-button:disabled { cursor: not-allowed; opacity: .55; }
.agent-status { min-height: 22px; margin: 0; padding: 0 38px; color: var(--sage-dark); font-size: .78rem; font-weight: 700; }
.agent-disclaimer { margin: 4px 0 0; padding: 0 38px 22px; color: var(--muted); font-size: .72rem; }

@media (max-width: 900px) {
  .agent-workspace { grid-template-columns: 1fr; }
  .avatar-panel { min-height: 460px; padding: 30px; border-right: 0; border-bottom: 1px solid var(--line); }
  .avatar-frame { width: min(360px, 80vw); margin-top: 20px; }
}

@media (max-width: 650px) {
  .agent-header { min-height: 64px; padding-inline: 16px; }
  .agent-shell { width: min(100% - 20px, 1440px); min-height: calc(100svh - 64px); padding: 18px 0; }
  .password-panel { padding: 28px 22px; }
  .password-row { grid-template-columns: 1fr; }
  .avatar-panel { min-height: 390px; padding: 24px 20px; }
  .avatar-copy h2 { font-size: 2.4rem; }
  .avatar-frame { width: min(300px, 78vw); }
  .chat-heading { flex-direction: column; padding: 25px 20px 18px; }
  .suggestions { padding: 0 20px 18px; }
  .suggestions button { width: 100%; }
  .messages { height: 46svh; min-height: 280px; padding: 20px; }
  .message { max-width: 91%; }
  .composer { grid-template-columns: 1fr auto; padding: 14px 20px 9px; }
  .composer textarea { grid-column: 1 / -1; }
  .voice-button { grid-column: 1; justify-self: start; }
  .send-button { grid-column: 2; }
  .agent-status, .agent-disclaimer { padding-inline: 20px; }
}
