
:root {
  color-scheme: dark;
  --bg: #10161d;
  --panel: #171f28;
  --panel-2: #1c2731;
  --line: rgba(226, 237, 242, .12);
  --text: #eef3f4;
  --muted: #a0adb3;
  --soft: #829197;
  --mint: #94e1c4;
  --mint-dark: #10251f;
  --gold: #edcb90;
  --danger: #ffb1a8;
  --radius: 16px;
  font-family: "DM Sans", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); min-height: 100vh; min-height: 100dvh; }
button, textarea, select, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--mint);
  outline-offset: 3px;
}

.login-page {
  display: grid;
  place-items: center;
  padding: clamp(20px, 5vw, 56px);
  background: radial-gradient(ellipse at 50% 35%, #202d34 0, transparent 55%), var(--bg);
}
.login-shell {
  width: min(100%, 660px);
  padding: clamp(30px, 7vw, 56px);
  border: 1px solid var(--line);
  border-radius: 28px;
  background: linear-gradient(145deg, rgba(31,43,51,.98), rgba(20,28,35,.98));
  box-shadow: 0 30px 100px #060a0e66;
}
.login-mark, .brand-mark {
  display: grid;
  place-items: center;
  background: var(--mint);
  color: var(--mint-dark);
  font-family: Manrope, sans-serif;
  font-weight: 800;
}
.login-mark { width: 48px; height: 48px; border-radius: 15px; font-size: 28px; margin-bottom: 34px; }
.eyebrow { font-size: 10px; letter-spacing: .15em; font-weight: 700; color: var(--mint); margin: 0 0 12px; }
.login-shell h1, .side-note h1 { font: 700 clamp(32px, 5vw, 48px)/1.12 Manrope, sans-serif; letter-spacing: -.045em; margin: 0; }
.login-shell h1 span, .side-note h1 span { color: var(--mint); }
.login-copy { max-width: 490px; color: #b5c0c4; line-height: 1.7; margin: 20px 0 24px; }
.button {
  border: 0; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 44px; padding: 0 16px; border-radius: 11px; font-weight: 700; cursor: pointer;
  transition: transform .15s, background .15s, color .15s;
}
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .55; cursor: wait; transform: none; }
.button-primary { background: var(--mint); color: var(--mint-dark); }
.button-primary:hover { background: #b3f0da; }
.login-button { min-height: 52px; padding: 0 20px; }
.login-button.is-disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }
.inline-message { font-size: 13px; color: var(--danger); margin: 16px 0 0; line-height: 1.55; }
.login-foot { display: flex; gap: 9px 12px; flex-wrap: wrap; color: var(--soft); font-size: 11px; margin-top: 36px; }
.login-state {
  margin-top: 28px; padding: 16px 18px; border: 1px solid rgba(237,203,144,.26);
  border-left: 3px solid var(--gold); border-radius: 12px; background: rgba(75,59,36,.22);
}
.login-state strong { display: block; color: var(--gold); font-size: 12px; margin-bottom: 6px; }
.login-state p { margin: 0; color: #c4b9a4; font-size: 12px; line-height: 1.65; }

.topbar {
  min-height: 82px; border-bottom: 1px solid var(--line); display: flex; align-items: center;
  justify-content: space-between; gap: 20px; padding: 14px clamp(20px, 4vw, 64px);
}
.brand { display: flex; align-items: center; gap: 11px; font: 600 15px Manrope, sans-serif; letter-spacing: -.02em; white-space: nowrap; }
.brand b { color: #a5b3b7; font-weight: 500; }
.brand-mark { width: 32px; height: 32px; border-radius: 10px; font-size: 19px; }
.account-bar { display: flex; align-items: center; gap: 14px; }
.account-copy { display: flex; flex-direction: column; gap: 3px; max-width: 210px; }
.account-copy .eyebrow { font-size: 8px; margin: 0; color: var(--soft); }
.account-copy span:last-child { font-size: 12px; color: #c5cfd1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.balance-card { padding: 7px 13px; border: 1px solid var(--line); border-radius: 11px; display: flex; flex-direction: column; gap: 3px; min-width: 105px; }
.balance-card span { font-size: 10px; color: var(--muted); }
.balance-card strong { font: 700 15px Manrope, sans-serif; color: var(--mint); }
.button-outline { background: transparent; border: 1px solid #49685f; color: var(--mint); font-size: 12px; }
.button-outline:hover { background: #1a322a; }
.button-quiet { background: transparent; color: #acb8bc; padding: 0 8px; font-size: 12px; }

.studio-layout {
  width: min(1200px, calc(100% - 48px)); margin: 48px auto 64px;
  display: grid; grid-template-columns: 285px minmax(0, 1fr); gap: clamp(34px, 6vw, 78px); align-items: start;
}
.side-note { padding-top: 20px; }
.side-note h1 { font-size: 35px; }
.side-note > p:not(.eyebrow) { font-size: 14px; color: var(--muted); line-height: 1.7; margin: 18px 0 25px; }
.cost-note { display: flex; align-items: center; gap: 9px; font-size: 12px; color: #c4d2cf; }
.cost-dot, .provider-pulse { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: var(--mint); }
.privacy-note { display: flex; gap: 10px; border-top: 1px solid var(--line); margin-top: 26px; padding-top: 18px; color: var(--soft); font-size: 11px; line-height: 1.6; }
.privacy-icon { color: var(--mint); font-size: 15px; }
.text-button { border: 0; background: transparent; color: #aab5b8; padding: 5px 0; cursor: pointer; font-size: 11px; text-decoration: underline; text-decoration-color: #536166; text-underline-offset: 3px; }
.side-note > .text-button { margin-top: 18px; }
.text-button:hover { color: var(--mint); }
.migration-note {
  margin-top: 26px; padding: 15px 15px 16px; border: 1px solid rgba(237,203,144,.25);
  border-radius: 12px; background: rgba(75,59,36,.2);
}
.migration-note .eyebrow { color: var(--gold); font-size: 9px; margin-bottom: 8px; }
.migration-note p { margin: 0; color: #c4b9a4; font-size: 11px; line-height: 1.65; }

.workspace { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(150deg,#19232c,#151d25); padding: 28px 30px 18px; box-shadow: 0 25px 80px #070b0f2e; }
.workspace-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.workspace-heading .eyebrow { color: var(--soft); font-size: 9px; }
.workspace-heading h2 { font: 650 24px Manrope, sans-serif; letter-spacing: -.03em; margin: 0; }
.provider-pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 99px; color: #b2bec0; font-size: 10px; white-space: nowrap; }
.provider-pulse { width: 6px; height: 6px; }
.tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--line); margin-top: 24px; overflow-x: auto; scrollbar-width: thin; }
.tab { position: relative; flex: 0 0 auto; border: 0; background: transparent; color: #a0adb3; padding: 0 2px 12px; font-size: 12px; cursor: pointer; }
.tab[aria-selected="true"] { color: var(--mint); font-weight: 700; }
.tab[aria-selected="true"]:after { content: ""; height: 2px; position: absolute; bottom: -1px; left: 0; right: 0; background: var(--mint); border-radius: 2px; }
.tool-panel { padding-top: 19px; }
.field-label { display: block; color: #cad2d3; font-size: 11px; font-weight: 600; margin: 0 0 8px; }
.select-control, .prompt-form textarea, .image-form textarea, .audio-card textarea { width: 100%; background: #111920; border: 1px solid #39474e; border-radius: 10px; color: var(--text); }
.select-control { height: 44px; padding: 0 12px; font-size: 12px; }
.select-control:focus, .prompt-form textarea:focus, .image-form textarea:focus, .audio-card textarea:focus { border-color: #80cdb0; }
.chat-output { min-height: 245px; max-height: 380px; overflow: auto; padding: 16px 2px; display: flex; flex-direction: column; gap: 14px; }
.empty-state { margin: auto; text-align: center; color: var(--soft); display: grid; justify-items: center; gap: 4px; }
.empty-icon { font-size: 24px; color: var(--mint); margin-bottom: 8px; }
.empty-state p { font: 600 14px Manrope, sans-serif; color: #bac4c5; margin: 0; }
.empty-state span:last-child { font-size: 11px; }
.chat-message { max-width: 90%; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.65; font-size: 13px; padding: 12px 14px; border-radius: 13px; }
.chat-message.user { align-self: flex-end; background: #233d36; color: #e3f7ee; border-bottom-right-radius: 4px; }
.chat-message.assistant { align-self: flex-start; background: #202b33; color: #e0e8e9; border-bottom-left-radius: 4px; }
.chat-meta { display: block; margin-top: 8px; color: #95cbb5; font-size: 10px; }
.prompt-form, .image-form { border: 1px solid #39474e; border-radius: 12px; background: #111920; padding: 9px; }
.prompt-form textarea, .image-form textarea, .audio-card textarea { resize: vertical; padding: 10px 9px; line-height: 1.5; font-size: 12px; min-height: 68px; }
.prompt-form textarea, .image-form textarea { border: 0; background: transparent; }
.prompt-form textarea:focus, .image-form textarea:focus { box-shadow: none; }
.prompt-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 5px 3px 2px; }
.prompt-footer span { color: var(--soft); font-size: 10px; line-height: 1.5; }
.prompt-footer .button { font-size: 11px; min-height: 38px; }
.image-form { margin-top: 18px; }
.image-output { margin-top: 16px; }
.image-output img { display: block; max-width: 100%; max-height: 540px; border-radius: 12px; border: 1px solid var(--line); margin: 0 auto; }
.notice { margin-top: 16px; padding: 11px 13px; border-radius: 10px; background: #352922; color: #ffcfaa; font-size: 12px; line-height: 1.5; }
.notice.success { background: #1b332b; color: #aee9d2; }
.notice[hidden], .tool-panel[hidden] { display: none; }
.workspace-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); margin-top: 22px; padding: 14px 0 1px; color: var(--soft); font-size: 10px; line-height: 1.5; }
.notice { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.notice-detail { flex-basis: 100%; font-size: 11px; }
.retry-button { display: inline-flex; align-items: center; border: 1px solid #49685f; border-radius: 8px; padding: 8px 10px; color: var(--mint); background: #172720; font-size: 11px; cursor: pointer; text-decoration: none; }
.retry-button:hover { background: #1a322a; }
.usage-section { margin-top: 22px; padding: 16px 0 0; border-top: 1px solid var(--line); }
.usage-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.usage-heading .eyebrow { color: var(--soft); font-size: 9px; margin-bottom: 5px; }
.usage-heading h3 { margin: 0; font: 650 16px Manrope, sans-serif; letter-spacing: -.02em; }
.usage-caption, .history-empty { margin: 8px 0 10px; color: var(--soft); font-size: 10px; line-height: 1.5; }
.history-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.history-list li { display: grid; grid-template-columns: minmax(100px, 1fr) auto auto minmax(125px, auto); gap: 12px; align-items: center; padding: 9px 2px; border-bottom: 1px solid var(--line); font-size: 10px; }
.history-endpoint { color: #cad2d3; overflow-wrap: anywhere; }
.history-status { color: var(--soft); }
.history-status.succeeded { color: var(--mint); }
.history-status.uncertain { color: var(--gold); }
.history-cost { color: #c4d2cf; white-space: nowrap; }
.history-date { color: var(--soft); text-align: right; }
.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; }

@media (max-width: 850px) {
  .studio-layout { grid-template-columns: 1fr; gap: 25px; margin: 30px auto 48px; }
  .side-note { padding-top: 0; }
  .side-note h1 { font-size: 30px; }
  .side-note > p:not(.eyebrow) { max-width: 620px; margin: 12px 0; }
  .privacy-note { display: none; }
  .side-note > .text-button { margin-top: 10px; }
  .migration-note { max-width: 720px; margin-top: 16px; }
  .workspace { padding: 22px; }
  .topbar { align-items: flex-start; }
}
@media (max-width: 560px) {
  .login-shell { padding: 32px 24px 28px; border-radius: 22px; }
  .login-foot { margin-top: 28px; }
  .topbar { padding: 12px 16px; flex-wrap: wrap; gap: 12px; }
  .account-bar { width: 100%; gap: 7px; flex-wrap: wrap; }
  .account-copy { display: flex; flex: 1 0 100%; max-width: none; }
  .balance-card { margin-left: auto; min-width: 78px; padding: 6px 9px; }
  .account-bar .button { min-height: 40px; font-size: 10px; padding: 0 9px; }
  .studio-layout { width: calc(100% - 28px); margin: 23px auto 36px; }
  .workspace { padding: 18px 15px; }
  .workspace-heading { align-items: flex-start; flex-wrap: wrap; }
  .workspace-heading h2 { font-size: 20px; }
  .provider-pill { font-size: 9px; padding: 7px; }
  .tabs { gap: 19px; }
  .chat-output { min-height: 200px; }
  .workspace-footer { align-items: flex-start; flex-direction: column; }
  .prompt-footer { align-items: flex-end; }
  .prompt-footer span { max-width: 170px; }
  .history-list li { grid-template-columns: 1fr auto; gap: 5px 10px; }
  .history-status { text-align: right; }
  .history-date { text-align: left; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

/* Seletor de idioma (pt-BR, en, es) e primeira linha do título do login sem a cor de destaque. */
.seletor-idioma { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin: 0 0 18px; }
.seletor-idioma select { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; }
.login-shell h1 .h1-linha { color: inherit; }
