:root {
  --ink: #20221f;
  --muted: #6e7069;
  --cream: #f4f0e8;
  --clay: #b39279;
  --moss: #747d67;
  --white: #fffdf9;
  --line: rgba(32, 34, 31, 0.14);
  --shadow: 0 24px 70px rgba(62, 52, 43, 0.13);
}

* { box-sizing: border-box; }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--cream);
  font-family: "DM Sans", sans-serif;
}

button, input, textarea { font: inherit; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }

[hidden] { display: none !important; }

.password-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 90px 24px 40px;
  background:
    radial-gradient(circle at 82% 18%, rgba(179, 146, 121, .38), transparent 30%),
    linear-gradient(140deg, #f4f0e8 25%, #d9cabb 100%);
}

.password-logo, .logo {
  font-family: "Manrope", sans-serif;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: .18em;
}

.password-logo { position: absolute; top: 30px; left: 4vw; }

.password-card {
  width: min(100%, 570px);
  padding: clamp(34px, 6vw, 64px);
  border: 1px solid rgba(255,255,255,.55);
  border-radius: 32px;
  background: rgba(255, 253, 249, .7);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.eyebrow::before { content: ""; width: 25px; height: 1px; background: currentColor; }

h1 { margin: 20px 0; font-family: "Manrope", sans-serif; font-weight: 500; letter-spacing: -.055em; }
.password-card h1 { font-size: clamp(48px, 7vw, 72px); line-height: .98; }
.password-card > p { color: var(--muted); }
.password-card label { display: block; margin: 30px 0 8px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; }

.password-row { display: flex; padding: 5px; border: 1px solid rgba(32,34,31,.4); border-radius: 999px; }
.password-row input { flex: 1; min-width: 0; padding: 0 18px; border: 0; outline: 0; background: transparent; }
.password-row button, .send-button {
  border: 0;
  background: var(--ink);
  color: white;
  cursor: pointer;
}
.password-row button { min-height: 50px; padding: 0 23px; border-radius: 999px; font-weight: 600; }
.form-message { min-height: 20px; margin: 12px 0 0 !important; color: #9a352d !important; font-size: 13px; }

.agent-app { min-height: 100vh; }
.agent-header {
  height: 78px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 4vw;
  border-bottom: 1px solid var(--line);
}
.agent-status { display: flex; align-items: center; gap: 9px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }
.agent-status span { width: 8px; height: 8px; border-radius: 50%; background: #6f8b66; box-shadow: 0 0 0 5px rgba(111,139,102,.13); }
.header-actions { display: flex; justify-content: flex-end; gap: 8px; }
.text-button { padding: 9px 13px; border: 0; border-radius: 999px; background: transparent; cursor: pointer; }
.text-button:hover { background: rgba(32,34,31,.07); }

.agent-layout { min-height: calc(100vh - 78px); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.avatar-panel { min-width: 0; display: flex; flex-direction: column; gap: 20px; padding: clamp(24px, 3vw, 42px); overflow: hidden; background: #d8c7b8; }
.avatar-copy { display: grid; grid-template-columns: minmax(0, 1fr) minmax(200px, .9fr); align-items: end; gap: 22px; }
.avatar-copy .eyebrow { grid-column: 1 / -1; }
.avatar-copy h1 { margin: 0; font-size: clamp(39px, 4vw, 66px); line-height: .95; }
.avatar-copy p { margin: 0; color: #5f5d57; font-size: 15px; line-height: 1.55; }
.avatar-stage { position: relative; flex: 1; min-height: 360px; margin: 0; overflow: hidden; border: 1px solid rgba(255,255,255,.38); border-radius: 28px; background: #aa9381; box-shadow: 0 24px 65px rgba(62, 52, 43, .2); isolation: isolate; }
.avatar-stage::after { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; border-radius: inherit; box-shadow: inset 0 0 0 1px rgba(255,255,255,.22); transition: box-shadow .25s ease; }
.avatar-stage.is-speaking::after { box-shadow: inset 0 0 0 2px rgba(255,253,249,.72), inset 0 -85px 80px rgba(32,34,31,.16); }
.avatar-stage img { width: 100%; height: 100%; display: block; object-fit: cover; object-position: center 42%; }
.avatar-presence { position: absolute; right: 18px; bottom: 18px; left: 18px; z-index: 2; display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 10px; padding: 12px 15px; border: 1px solid rgba(255,255,255,.35); border-radius: 16px; color: white; background: rgba(32,34,31,.58); box-shadow: 0 10px 30px rgba(32,34,31,.18); backdrop-filter: blur(13px); }
.avatar-presence strong { font-size: 14px; }
.avatar-presence small { grid-column: 2; opacity: .78; font-size: 11px; }
.presence-dot { grid-row: 1 / 3; width: 9px; height: 9px; border-radius: 50%; background: #b8d3a5; box-shadow: 0 0 0 5px rgba(184,211,165,.15); }
.avatar-stage.is-speaking .presence-dot { animation: avatar-pulse .9s infinite; }
.voice-setting { margin-top: auto; }
.switch-label { display: flex; align-items: center; gap: 12px; font-weight: 600; cursor: pointer; }
.switch-label input { position: absolute; opacity: 0; pointer-events: none; }
.switch { width: 43px; height: 25px; padding: 3px; border-radius: 99px; background: rgba(32,34,31,.2); transition: .2s; }
.switch::after { content: ""; display: block; width: 19px; height: 19px; border-radius: 50%; background: white; transition: .2s; }
.switch-label input:checked + .switch { background: var(--moss); }
.switch-label input:checked + .switch::after { transform: translateX(18px); }
.voice-setting small { display: block; margin: 10px 0 0 55px; color: #69665f; }
.agent-disclaimer { margin: 0; color: #5f5d57; font-size: 11px !important; line-height: 1.45; }

.chat-panel { min-height: 0; display: grid; grid-template-rows: 1fr auto; background: var(--white); }
.messages { height: calc(100vh - 190px); overflow-y: auto; padding: clamp(30px, 5vw, 72px) clamp(22px, 4vw, 64px) 35px; scroll-behavior: smooth; }
.message { max-width: 720px; margin-bottom: 25px; }
.message p { margin: 7px 0 0; white-space: pre-wrap; font-size: 17px; line-height: 1.65; }
.message-label { color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.user-message { margin-left: auto; padding: 18px 22px; border-radius: 22px 22px 5px 22px; background: #e8e1d8; }
.user-message .message-label { text-align: right; }
.assistant-message { padding-left: 19px; border-left: 2px solid var(--clay); }
.message-tools { margin-top: 10px; }
.speak-button { padding: 5px 9px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--muted); font-size: 11px; cursor: pointer; }

.suggestions { max-width: 760px; display: grid; gap: 9px; margin-top: 35px; }
.suggestions button { padding: 15px 18px; border: 1px solid var(--line); border-radius: 15px; background: transparent; text-align: left; cursor: pointer; transition: .2s; }
.suggestions button:hover { border-color: var(--clay); background: #f5f0e9; transform: translateX(4px); }

.composer { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: end; margin: 0 clamp(18px, 4vw, 60px) 28px; padding: 8px; border: 1px solid var(--line); border-radius: 22px; background: white; box-shadow: 0 15px 45px rgba(55,48,42,.09); }
.composer textarea { min-height: 50px; max-height: 150px; resize: none; padding: 13px; border: 0; outline: 0; background: transparent; }
.voice-button, .send-button { width: 46px; height: 46px; border-radius: 50%; cursor: pointer; }
.voice-button { border: 1px solid var(--line); background: transparent; font-size: 24px; }
.voice-button.listening { color: white; background: #9a352d; animation: pulse 1s infinite; }
.send-button { font-size: 20px; }
.send-button:disabled, .voice-button:disabled { opacity: .42; cursor: not-allowed; }
.typing p { color: var(--muted); }
.typing p::after { content: "…"; animation: blink 1s infinite; }

.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; }
@keyframes pulse { 50% { transform: scale(.94); } }
@keyframes blink { 50% { opacity: .25; } }
@keyframes avatar-pulse { 50% { transform: scale(.75); opacity: .65; } }

@media (max-width: 900px) {
  .agent-header { grid-template-columns: 1fr auto; }
  .agent-status { display: none; }
  .agent-layout { grid-template-columns: 1fr; }
  .avatar-panel { min-height: 760px; padding: 38px 25px 30px; }
  .avatar-copy h1 { font-size: 58px; }
  .avatar-stage { min-height: 500px; }
  .voice-setting { margin-top: 20px; padding-top: 15px; }
  .agent-disclaimer { margin-bottom: 0; }
  .messages { height: 62vh; padding: 38px 24px 25px; }
  .composer { margin: 0 18px 20px; }
}

@media (max-width: 560px) {
  .password-row { flex-direction: column; border-radius: 20px; }
  .password-row input { min-height: 50px; text-align: center; }
  .agent-header { height: 68px; padding: 0 18px; }
  .text-button { padding: 8px; font-size: 12px; }
  .avatar-panel { min-height: 680px; padding: 28px 18px 24px; }
  .avatar-copy { grid-template-columns: 1fr; gap: 10px; }
  .avatar-copy .eyebrow { grid-column: auto; }
  .avatar-copy h1 { font-size: 47px; }
  .avatar-copy p { font-size: 14px; }
  .avatar-stage { min-height: 410px; }
  .messages { height: 66vh; }
}

@media (prefers-reduced-motion: reduce) {
  .avatar-stage.is-speaking .presence-dot { animation: none; }
}
