/* ============================================================
   Salles — Frontend (Azos Design System)
   ============================================================ */

@font-face {
  font-family: "Dazzed";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/dazzed-400.woff2") format("woff2");
}
@font-face {
  font-family: "Dazzed";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/static/fonts/dazzed-500.woff2") format("woff2");
}
@font-face {
  font-family: "Dazzed";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/static/fonts/dazzed-600.woff2") format("woff2");
}
@font-face {
  font-family: "Dazzed";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/static/fonts/dazzed-700.woff2") format("woff2");
}

:root {
  --azos-green:      #00B000;
  --azos-green-deep: #005700;
  --azos-green-soft: #C2EBC2;
  --azos-slate:      #505969;
  --azos-ink:        #090A0B;
  --azos-white:      #FFFFFF;

  --fg-1: #090A0B;
  --fg-2: #505969;
  --fg-3: #A3AAB9;
  --fg-disabled: #D0D4DC;
  --fg-inverse: #FFFFFF;

  --bg-0: #FFFFFF;
  --bg-1: #F3F4F6;
  --bg-2: #F6F6F6;
  --bg-dark: #505969;

  --border-1: #F3F4F6;
  --border-2: #D0D4DC;
  --border-3: #090A0B;

  --shadow-1: 0 1px 2px rgba(0,0,0,0.08);
  --shadow-2: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-3: 0 8px 24px rgba(0,0,0,0.15);

  --radius-0: 0px;
  --radius-1: 4px;
  --radius-pill: 999px;

  --font-sans: "Dazzed", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 14px;
  line-height: 1.44;
  color: var(--fg-1);
  background: var(--bg-0);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  height: 100%;
}
body { height: 100dvh; overflow: hidden; }

button {
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  padding: 0;
}
input, textarea {
  font-family: inherit;
  font-weight: 500;
  font-size: inherit;
  color: inherit;
  border: none;
  background: none;
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--azos-green);
  outline-offset: 2px;
}

/* ============================================================
   LOGIN SCREEN
   ============================================================ */
#login-screen {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  background: var(--bg-0);
  position: relative;
}
#login-screen.hidden { display: none; }

.login-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
}
.login-logo svg {
  display: block;
  height: 18px;
  width: auto;
}
.login-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-2);
  padding: 6px 12px;
  border: 1px solid var(--border-2);
  border-radius: var(--radius-pill);
  background: var(--bg-0);
}
.login-pill .dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--azos-green);
  box-shadow: 0 0 0 3px rgba(0,176,0,0.15);
}

.login-main {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow: auto;
}
.login-card {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.login-mark {
  display: flex;
  align-items: center;
  gap: 12px;
}
.login-mark .mark-sq {
  width: 44px;
  height: 44px;
  background: var(--azos-green-deep);
  color: #fff;
  font-weight: 600;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: -0.02em;
}
.login-mark .mark-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.login-mark .mark-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--fg-1);
}
.login-mark .mark-tag {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg-3);
}

.login-h {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.login-h h1 {
  margin: 0;
  font-size: 36px;
  line-height: 1.1;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--fg-1);
}
.login-h h1 em {
  font-style: normal;
  color: var(--azos-green-deep);
}
.login-h p {
  margin: 0;
  font-size: 15px;
  color: var(--fg-2);
  max-width: 36ch;
}

.login-actions {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px 20px;
  background: var(--azos-ink);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--radius-0);
  transition: transform 120ms ease-out, background 120ms ease-out;
}
.btn-google:hover { background: #1c1d1f; }
.btn-google:active { transform: scale(0.99); }
.btn-google[disabled] { opacity: 0.6; cursor: not-allowed; }
.btn-google svg { width: 18px; height: 18px; }

.login-domain {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--fg-2);
  padding: 12px 14px;
  background: var(--bg-1);
  border-left: 2px solid var(--azos-green-deep);
}
.login-domain strong { font-weight: 600; color: var(--fg-1); }

#login-error {
  display: none;
  padding: 12px 14px;
  font-size: 13px;
  color: #B00000;
  background: #FFEBEB;
  border-left: 2px solid #B00000;
}
#login-error.visible { display: block; }

.login-footnote {
  margin-top: 8px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg-3);
}

.login-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 32px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg-3);
}
.login-foot .ver { color: var(--fg-3); }

@media (max-width: 600px) {
  .login-topbar, .login-foot { padding: 16px 20px; }
  .login-h h1 { font-size: 28px; }
  .login-foot { display: none; }
}

/* ============================================================
   CHAT SCREEN
   ============================================================ */
#chat-screen {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  background: var(--bg-0);
}
#chat-screen.hidden { display: none; }

/* THEME: SLATE (default) — slate header, white body */
#chat-screen[data-theme="slate"] .chat-header {
  background: var(--azos-slate);
  color: var(--fg-inverse);
  border-bottom: none;
}
#chat-screen[data-theme="slate"] .chat-header .agent-name,
#chat-screen[data-theme="slate"] .chat-header .user-name {
  color: var(--fg-inverse);
}
#chat-screen[data-theme="slate"] .chat-header .agent-sub,
#chat-screen[data-theme="slate"] .chat-header .user-meta {
  color: rgba(255,255,255,0.66);
}
#chat-screen[data-theme="slate"] .chat-header .logout-btn {
  color: rgba(255,255,255,0.86);
  border-color: rgba(255,255,255,0.22);
}
#chat-screen[data-theme="slate"] .chat-header .logout-btn:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}
#chat-screen[data-theme="slate"] .agent-sq {
  background: #fff;
  color: var(--azos-green-deep);
}
#chat-screen[data-theme="slate"] .chat-header .divider {
  background: rgba(255,255,255,0.18);
}

/* THEME: BRANCO — white header, ink text, thin border */
#chat-screen[data-theme="branco"] .chat-header {
  background: var(--bg-0);
  color: var(--fg-1);
  border-bottom: 1px solid var(--border-2);
}
#chat-screen[data-theme="branco"] .agent-sq {
  background: var(--azos-green-deep);
  color: #fff;
}
#chat-screen[data-theme="branco"] .chat-header .agent-sub,
#chat-screen[data-theme="branco"] .chat-header .user-meta {
  color: var(--fg-2);
}
#chat-screen[data-theme="branco"] .chat-header .logout-btn {
  color: var(--fg-2);
  border-color: var(--border-2);
}
#chat-screen[data-theme="branco"] .chat-header .logout-btn:hover {
  background: var(--bg-1);
  color: var(--fg-1);
}
#chat-screen[data-theme="branco"] .chat-header .divider {
  background: var(--border-2);
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 24px;
  flex-shrink: 0;
  transition: background 200ms ease-out;
}

.agent-block {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.agent-sq {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}
.agent-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
}
.agent-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.agent-name {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.005em;
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: var(--radius-pill);
  background: var(--azos-green);
  box-shadow: 0 0 0 3px rgba(0,176,0,0.18);
  flex-shrink: 0;
}
.agent-sub {
  font-size: 12px;
  margin-top: 2px;
}

.header-spacer { flex: 1 1 auto; }

.user-block {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.user-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.2;
  min-width: 0;
}
.user-name {
  font-size: 13px;
  font-weight: 600;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-meta {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.divider {
  width: 1px;
  height: 28px;
  flex-shrink: 0;
}
.logout-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 12px;
  border: 1px solid;
  background: transparent;
  border-radius: var(--radius-0);
  transition: background 120ms ease-out, color 120ms ease-out;
}
.logout-btn svg { width: 13px; height: 13px; }

/* Roleplay banner */
.roleplay-banner {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 24px;
  background: #FFF7E0;
  border-bottom: 1px solid #F2E1A8;
  font-size: 12.5px;
  color: #6B4D00;
  font-weight: 500;
}
.roleplay-banner.hidden { display: none; }
.roleplay-banner .rp-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #B07A00;
}
.roleplay-banner .rp-text {
  flex: 1 1 auto;
  line-height: 1.4;
}
.roleplay-banner .rp-text strong {
  font-weight: 600;
  color: #5A3F00;
}
.roleplay-banner .rp-dismiss {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #8A6300;
  border-radius: var(--radius-0);
  transition: background 120ms ease-out;
}
.roleplay-banner .rp-dismiss:hover { background: rgba(0,0,0,0.06); }
.roleplay-banner .rp-dismiss svg { width: 14px; height: 14px; }

/* Messages area */
.chat-main {
  flex: 1 1 auto;
  overflow-y: auto;
  background: var(--bg-0);
  scroll-behavior: smooth;
}
.chat-scroller {
  max-width: 740px;
  margin: 0 auto;
  padding: 36px 28px 32px 28px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  min-height: 100%;
}

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px 20px;
  gap: 18px;
  flex: 1 1 auto;
}
.empty-state.hidden { display: none; }
.empty-mark {
  width: 56px;
  height: 56px;
  background: var(--azos-green-deep);
  color: #fff;
  font-weight: 600;
  font-size: 24px;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  justify-content: center;
}
.empty-state h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--fg-1);
}
.empty-state p {
  margin: 0;
  font-size: 14px;
  color: var(--fg-2);
  max-width: 44ch;
  line-height: 1.5;
}

.suggestions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 14px;
  width: 100%;
  max-width: 560px;
}
.suggestion {
  padding: 12px 14px;
  border: 1px solid var(--border-2);
  background: var(--bg-0);
  text-align: left;
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-1);
  line-height: 1.4;
  transition: border-color 120ms ease-out, background 120ms ease-out;
}
.suggestion:hover {
  border-color: var(--azos-green-deep);
  background: var(--bg-1);
}
.suggestion .sg-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--azos-green-deep);
  margin-bottom: 4px;
}

/* Conversational linear style: no bubbles */
.message {
  display: flex;
  flex-direction: column;
  gap: 6px;
  animation: msg-in 220ms ease-out;
}
@keyframes msg-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.message .msg-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg-3);
}
.message.from-agent .msg-label { color: var(--azos-green-deep); }
.message .msg-label .msg-author-sq {
  width: 16px;
  height: 16px;
  background: var(--azos-green-deep);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0;
}
.message.from-user .msg-label .msg-author-sq {
  background: var(--azos-ink);
}
.message.from-error .msg-label { color: #B00000; }
.message.from-error .msg-body { color: #B00000; }
.message .msg-body {
  font-size: 15.5px;
  line-height: 1.55;
  color: var(--fg-1);
  font-weight: 500;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.message.from-user .msg-body {
  color: var(--fg-1);
  font-weight: 500;
}

.message .msg-sources {
  margin: 0;
  padding: 0;
}
.message .msg-sources > summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-2);
  cursor: pointer;
  user-select: none;
  padding: 2px 0;
}
.message .msg-sources > summary::-webkit-details-marker { display: none; }
.message .msg-sources > summary::before {
  content: "";
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--fg-3);
  transition: transform 160ms ease;
  transform: rotate(-90deg);
}
.message .msg-sources[open] > summary::before {
  transform: rotate(0deg);
}
.message .msg-sources > summary:hover { color: var(--azos-green-deep); }
.message .msg-sources ul {
  margin: 6px 0 0;
  padding: 0 0 0 14px;
  list-style: disc;
  color: var(--fg-2);
  font-size: 12.5px;
  line-height: 1.5;
  font-weight: 500;
}
.message .msg-sources li { margin: 2px 0; }

/* Typing indicator */
#typing {
  display: none;
  flex-direction: column;
  gap: 6px;
}
#typing.visible { display: flex; }
#typing .msg-label { color: var(--azos-green-deep); }
#typing .dots {
  display: inline-flex;
  gap: 5px;
  padding: 6px 0;
}
#typing .dots span {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--azos-green-deep);
  animation: dot-bounce 1.1s infinite ease-in-out;
}
#typing .dots span:nth-child(2) { animation-delay: 0.16s; }
#typing .dots span:nth-child(3) { animation-delay: 0.32s; }
@keyframes dot-bounce {
  0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

/* Composer */
.composer-wrap {
  flex-shrink: 0;
  background: var(--bg-0);
  border-top: 1px solid var(--border-1);
}
.composer {
  max-width: 740px;
  margin: 0 auto;
  padding: 16px 28px 22px 28px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.composer-box {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 10px 10px 10px 16px;
  border: 1px solid var(--border-2);
  background: var(--bg-0);
  transition: border-color 150ms ease-out, box-shadow 150ms ease-out;
}
.composer-box:focus-within {
  border-color: var(--azos-green-deep);
  box-shadow: 0 0 0 3px rgba(0,87,0,0.08);
}
#msg-input {
  flex: 1 1 auto;
  resize: none;
  min-height: 24px;
  max-height: 160px;
  padding: 6px 0;
  font-size: 15px;
  line-height: 1.5;
  font-weight: 500;
  color: var(--fg-1);
  background: transparent;
}
#msg-input::placeholder { color: var(--fg-3); }

#send-btn {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--azos-green-deep);
  color: #fff;
  transition: background 120ms ease-out, transform 120ms ease-out, opacity 120ms ease-out;
}
#send-btn:hover { background: var(--azos-green); }
#send-btn:active { transform: scale(0.96); }
#send-btn[disabled] {
  background: var(--fg-disabled);
  cursor: not-allowed;
  opacity: 0.7;
}
#send-btn svg { width: 16px; height: 16px; }

.composer-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  font-weight: 500;
  color: var(--fg-3);
}
.composer-foot kbd {
  font-family: inherit;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 5px;
  background: var(--bg-1);
  border: 1px solid var(--border-2);
  color: var(--fg-2);
}

@media (max-width: 720px) {
  .chat-header { padding: 12px 16px; gap: 10px; }
  .agent-sub { display: none; }
  .user-info { display: none; }
  .divider { display: none; }
  .logout-btn span { display: none; }
  .logout-btn { padding: 7px 9px; }
  .roleplay-banner { padding: 10px 16px; font-size: 12px; }
  .chat-scroller { padding: 22px 16px 24px 16px; gap: 22px; }
  .composer { padding: 12px 16px 18px 16px; }
  .empty-state { padding: 20px 8px; }
  .empty-state h2 { font-size: 19px; }
}

