:root {
  --color-bg: #ffffff;
  --color-fg: #1f2328;
  --color-muted: #6e7781;
  --color-border: #d0d7de;
  --color-accent: #0969da;
  --color-accent-bg: #ddf4ff;
  --color-success: #1a7f37;
  --color-success-bg: #dcfce7;
  --color-error: #cf222e;
  --color-error-bg: #ffebe9;
  --color-disabled: #f6f8fa;
  --color-assistant-bg: #f6f8fa;
  --color-user-bg: #0969da;
  --color-user-fg: #ffffff;
  --radius: 12px;
  --radius-sm: 6px;
  --gap: 1rem;
  --touch: 44px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--color-bg);
  color: var(--color-fg);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

html {
  height: 100%;
}

body {
  min-height: 100vh;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap);
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--color-border);
  flex-wrap: wrap;
}

.title {
  font-size: 1.1rem;
  margin: 0;
  font-weight: 600;
}

.topbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
}

.topbar-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
}

.lang-control {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.lang-label {
  color: var(--color-muted);
  font-size: 0.9rem;
}

/* Flag-pair language switch. Two radio-style buttons in a single pill;
   the active language is filled with the accent color, the inactive one
   stays ghosted. Emoji flags render cross-platform so no asset pipeline. */
.lang-switch {
  display: inline-flex;
  align-items: stretch;
  background: var(--color-disabled);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 2px;
  gap: 2px;
}

.lang-flag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.75rem;
  background: transparent;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-muted);
  transition: background 0.12s ease-out, color 0.12s ease-out;
}

.lang-flag:hover:not(.lang-flag--active) {
  background: rgba(9, 105, 218, 0.08);
  color: var(--color-fg);
}

.lang-flag--active {
  background: var(--color-bg);
  color: var(--color-accent);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.1);
}

.lang-flag:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.lang-flag-emoji {
  font-size: 1.05rem;
  line-height: 1;
}

.lang-flag-code {
  letter-spacing: 0.04em;
}

/* The new-chat button gets a pill silhouette with an accent left-edge "+"
   and a subtle accent hover. Heavier than the prior ghost button so it
   reads as the primary "start over" affordance, but still secondary to
   the Send button (composer-level). */
.new-chat-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 36px;
  padding: 0.35rem 0.95rem 0.35rem 0.75rem;
  background: linear-gradient(
    180deg,
    var(--color-bg) 0%,
    var(--color-disabled) 100%
  );
  color: var(--color-fg);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
  transition:
    transform 0.08s ease-out,
    border-color 0.12s ease-out,
    box-shadow 0.12s ease-out,
    background 0.12s ease-out;
}

.new-chat-btn:hover {
  border-color: var(--color-accent);
  box-shadow: 0 2px 6px rgba(9, 105, 218, 0.12);
  background: linear-gradient(
    180deg,
    #ffffff 0%,
    var(--color-accent-bg) 100%
  );
}

.new-chat-btn:active {
  transform: translateY(1px);
  box-shadow: 0 0 0 rgba(15, 23, 42, 0);
}

.new-chat-btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* Two pseudo-element bars draw the "+" so centering is pixel-geometry,
   not typographic. A literal "+" glyph drifts off-center in the 18px disc
   because most fonts seat the character slightly above the typographic
   baseline and below the visual midline. */
.new-chat-icon {
  position: relative;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--color-accent);
  flex: 0 0 auto;
}

.new-chat-icon::before,
.new-chat-icon::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  background: #ffffff;
  border-radius: 1px;
}

.new-chat-icon::before {
  /* horizontal bar */
  width: 9px;
  height: 2px;
  transform: translate(-50%, -50%);
}

.new-chat-icon::after {
  /* vertical bar */
  width: 2px;
  height: 9px;
  transform: translate(-50%, -50%);
}

.chat {
  position: relative;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  max-width: 880px;
  width: 100%;
  margin: 0 auto;
  padding: 0;
  min-width: 320px;
  /* `flex: 1` on a column child only grows when the parent has a resolved
     height. body sets `height: 100vh`, so .chat reliably fills the gap
     between topbar and footer. min-height: 0 lets the inner .chat-log
     scroll instead of expanding the page. */
  min-height: 0;
}

.chat-log {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.msg {
  display: flex;
  flex-direction: column;
  max-width: 80%;
  word-wrap: break-word;
}

.msg--user {
  align-self: flex-end;
  align-items: flex-end;
}

.msg--assistant,
.msg--system {
  align-self: flex-start;
  align-items: flex-start;
}

.msg-bubble {
  padding: 0.55rem 0.9rem;
  border-radius: var(--radius);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 0.95rem;
  border: 1px solid transparent;
}

/* Inline-markdown spans rendered by renderInlineMarkdown(). The bubble itself
   uses pre-wrap, so newlines render naturally without <br>. */
.msg-bubble strong {
  font-weight: 600;
}

.msg-bubble em {
  font-style: italic;
}

.msg-bubble code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88em;
  background: rgba(0, 0, 0, 0.06);
  padding: 0.05rem 0.3rem;
  border-radius: 4px;
}

.msg--user .msg-bubble code {
  background: rgba(255, 255, 255, 0.18);
}

.msg--user .msg-bubble {
  background: var(--color-user-bg);
  color: var(--color-user-fg);
  border-bottom-right-radius: 4px;
}

.msg--assistant .msg-bubble {
  background: var(--color-assistant-bg);
  color: var(--color-fg);
  border-bottom-left-radius: 4px;
}

.msg--system .msg-bubble {
  background: transparent;
  color: var(--color-muted);
  font-style: italic;
  font-size: 0.85rem;
  padding: 0.2rem 0;
}

.msg--status .msg-bubble {
  color: var(--color-muted);
  font-style: italic;
}

.msg--error .msg-bubble {
  background: var(--color-error-bg);
  color: var(--color-error);
  border-color: var(--color-error);
}

.msg--success .msg-bubble {
  background: var(--color-success-bg);
  color: var(--color-success);
  border-color: var(--color-success);
}

.msg-meta {
  font-size: 0.75rem;
  color: var(--color-muted);
  margin: 0.15rem 0.25rem 0;
}

.msg--user .msg-meta {
  text-align: right;
}

.upload-card {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--color-user-bg);
  color: var(--color-user-fg);
  padding: 0.55rem 0.9rem;
  border-radius: var(--radius);
  border-bottom-right-radius: 4px;
}

.upload-card-icon {
  font-size: 1.1rem;
}

.upload-card-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.2;
}

.upload-card-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.upload-card-size {
  font-size: 0.8rem;
  opacity: 0.8;
}

.result-card {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  background: var(--color-success-bg);
  color: var(--color-success);
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius);
  border: 1px solid var(--color-success);
  border-bottom-left-radius: 4px;
  max-width: 100%;
}

.result-card-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.result-card-filename {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
  background: rgba(0, 0, 0, 0.06);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  color: var(--color-fg);
}

.result-card-buttons {
  display: inline-flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.result-card-xml {
  margin: 0;
  padding: 0.6rem;
  background: var(--color-bg);
  color: var(--color-fg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  max-width: 100%;
  max-height: 40vh;
  overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8rem;
  white-space: pre;
}

/* Status bubbles (extracting / stillExtracting) cycle "." -> ".." -> "..."
   by toggling opacity on three real dot spans. Each dot shares a 1.2s loop;
   dot 1 is always visible, dot 2 appears after 33%, dot 3 after 66%. All three
   reset at the loop boundary. Real DOM elements avoid the Safari quirk where
   animating `content` on a ::after pseudo can leave the static fallback
   painted next to the keyframe value. */
.status-bubble {
  display: inline-flex;
  align-items: baseline;
}

.status-dots {
  display: inline-flex;
  /* Reserve width for "..." so the bubble does not jitter as dots appear. */
  min-width: 1.6ch;
}

.status-dot {
  opacity: 0;
}

.status-dot:nth-child(1) {
  animation: status-dot-1 1.2s linear infinite;
}

.status-dot:nth-child(2) {
  animation: status-dot-2 1.2s linear infinite;
}

.status-dot:nth-child(3) {
  animation: status-dot-3 1.2s linear infinite;
}

@keyframes status-dot-1 {
  0%, 100% { opacity: 1; }
}

@keyframes status-dot-2 {
  0%, 33% { opacity: 0; }
  33.01%, 100% { opacity: 1; }
}

@keyframes status-dot-3 {
  0%, 66% { opacity: 0; }
  66.01%, 100% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .status-dot {
    animation: none;
    opacity: 1;
  }
}

.thinking-dots {
  display: inline-flex;
  gap: 0.2rem;
}

.thinking-dots span {
  width: 6px;
  height: 6px;
  background: var(--color-muted);
  border-radius: 50%;
  animation: thinking 1.2s infinite ease-in-out;
}

.thinking-dots span:nth-child(2) {
  animation-delay: 0.15s;
}

.thinking-dots span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes thinking {
  0%,
  80%,
  100% {
    transform: scale(0.7);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

.composer {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  padding: 0.75rem 1rem 1rem;
  border-top: 1px solid var(--color-border);
  background: var(--color-bg);
}

.attach-btn {
  min-width: var(--touch);
  min-height: var(--touch);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 1.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.attach-btn:hover {
  background: var(--color-disabled);
}

.attach-btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.attach-btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.composer-input {
  flex: 1 1 auto;
  resize: none;
  min-height: var(--touch);
  max-height: 200px;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 1rem;
  color: var(--color-fg);
  background: var(--color-bg);
  line-height: 1.4;
}

.composer-input:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.composer-input:disabled {
  background: var(--color-disabled);
  cursor: not-allowed;
}

.primary-btn {
  min-height: var(--touch);
  padding: 0 1rem;
  background: var(--color-accent);
  color: #ffffff;
  border: 1px solid var(--color-accent);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font: inherit;
  font-weight: 600;
}

.primary-btn:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}

.primary-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.link-btn {
  background: none;
  border: 1px solid currentColor;
  color: var(--color-accent);
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
  padding: 0.3rem 0.7rem;
  border-radius: var(--radius-sm);
}

.link-btn:hover {
  background: var(--color-disabled);
}

.link-btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.drop-overlay {
  position: absolute;
  inset: 0;
  background: rgba(9, 105, 218, 0.12);
  border: 3px dashed var(--color-accent);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 10;
}

.drop-overlay[hidden] {
  display: none;
}

.drop-overlay-text {
  color: var(--color-accent);
  font-weight: 600;
  font-size: 1.1rem;
  background: var(--color-bg);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
}

.footer {
  text-align: center;
  color: var(--color-muted);
  padding: 0.5rem;
  font-size: 0.8rem;
  border-top: 1px solid var(--color-border);
}

@media (max-width: 480px) {
  .topbar {
    padding: 0.5rem 0.75rem;
  }
  .topbar-brand,
  .topbar-controls {
    gap: 0.5rem;
  }
  .msg {
    max-width: 92%;
  }
  .composer {
    padding: 0.5rem 0.5rem 0.75rem;
  }
}

/* ====================================================================
   Backend status pill (header)
   ==================================================================== */

.be-status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.85rem;
  color: var(--color-muted);
  background: var(--color-disabled);
  border: 1px solid var(--color-border);
  user-select: none;
  white-space: nowrap;
}

.be-status-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-muted);
  flex: 0 0 auto;
}

.be-status--checking .be-status-dot {
  background: #d97706; /* amber */
  animation: be-pulse 1.2s ease-in-out infinite;
}

.be-status--online .be-status-dot {
  background: var(--color-success);
  box-shadow: 0 0 0 0 rgba(26, 127, 55, 0.6);
}

.be-status--offline .be-status-dot {
  background: var(--color-error);
}

@keyframes be-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

/* ====================================================================
   Stop button (replaces Send while in-flight)
   ==================================================================== */

.stop-btn {
  background: var(--color-error);
  color: #ffffff;
  border: 1px solid var(--color-error);
  border-radius: var(--radius-sm);
  padding: 0 1rem;
  height: var(--touch);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.stop-btn:hover {
  filter: brightness(0.92);
}

.stop-btn:focus-visible {
  outline: 2px solid var(--color-error);
  outline-offset: 2px;
}

.stop-btn[hidden] {
  display: none;
}

/* ====================================================================
   Upload card "View PDF" link
   ==================================================================== */

/* Override .link-btn coloring: the upload card sits on the blue user-bubble
   background, where the link-btn's accent-blue text would be camouflaged.
   White-on-blue with a translucent hover keeps the button always legible. */
.upload-card-view {
  margin-left: 0.75rem;
  align-self: center;
  color: var(--color-user-fg);
  border-color: rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.08);
}

.upload-card-view:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.85);
}

.upload-card-view:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}

/* ====================================================================
   Modal shell (PDF preview + XML tree)
   ==================================================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 1.5rem;
}

.modal-overlay[hidden] {
  display: none;
}

.modal-container {
  background: var(--color-bg);
  border-radius: var(--radius);
  box-shadow:
    0 8px 24px rgba(15, 23, 42, 0.25),
    0 2px 4px rgba(15, 23, 42, 0.08);
  width: min(960px, 100%);
  height: min(85vh, 100%);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--color-border);
}

.modal-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.modal-close {
  background: transparent;
  border: 0;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  color: var(--color-muted);
}

.modal-close:hover {
  background: var(--color-disabled);
  color: var(--color-fg);
}

.modal-close:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.modal-body {
  flex: 1 1 auto;
  overflow: auto;
  padding: 0;
}

/* PDF preview body fills the modal so the <embed> stretches. */
.pdf-modal-body {
  width: 100%;
  height: 100%;
}

.pdf-modal-embed {
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
}

/* ====================================================================
   XML tree
   ==================================================================== */

.xml-tree-modal-body {
  padding: 1rem 1.25rem;
  font-family:
    ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.9rem;
  color: var(--color-fg);
}

.xml-tree-error {
  color: var(--color-error);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  margin: 0 0 0.75rem;
}

.xml-tree-raw {
  white-space: pre-wrap;
  background: var(--color-disabled);
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  font-size: 0.85rem;
  margin: 0;
}

.xml-tree-node {
  margin: 0;
}

.xml-tree-summary {
  cursor: pointer;
  padding: 1px 0;
  list-style: none;
  user-select: none;
}

.xml-tree-summary::-webkit-details-marker {
  display: none;
}

/* Custom twisty: rotated chevron next to each summary. */
.xml-tree-summary::before {
  content: "▸";
  display: inline-block;
  width: 1em;
  color: var(--color-muted);
  transition: transform 0.1s ease-out;
}

.xml-tree-node[open] > .xml-tree-summary::before {
  transform: rotate(90deg);
}

.xml-tree-tag {
  color: var(--color-accent);
  font-weight: 600;
}

.xml-tree-count {
  color: var(--color-muted);
}

.xml-tree-attr {
  color: var(--color-success);
  font-style: italic;
}

.xml-tree-children {
  padding-left: 1.25rem;
  border-left: 1px dotted var(--color-border);
  margin-left: 0.35em;
}

.xml-tree-leaf,
.xml-tree-text {
  padding: 1px 0 1px 1em; /* align with the chevron column above */
}

.xml-tree-key {
  color: var(--color-muted);
}

.xml-tree-colon {
  color: var(--color-muted);
}

.xml-tree-value {
  color: #6f42c1; /* purple value, evokes the screenshot's coloring */
  word-break: break-word;
}

/* ====================================================================
   Fixed-width button slots
   --------------------------------------------------------------------
   `min-width`s sized for the wider of EN / RO so toggling languages
   does not reflow the topbar, composer, upload card, or result card.
   `white-space: nowrap` prevents a long RO label ("Conversație nouă",
   "Vizualizare arbore") from wrapping inside its slot. text-align +
   inline-flex centering keep the shorter EN label centered.
   ==================================================================== */

.new-chat-btn,
.primary-btn,
.stop-btn,
.link-btn,
.sign-out-btn {
  white-space: nowrap;
  justify-content: center;
  text-align: center;
}

/* New chat: "New chat" (8ch) vs "Conversație nouă" (16ch). */
.new-chat-btn {
  min-width: 11rem;
}

/* Sign out: "Sign out" (8ch) vs "Deconectare" (11ch). */
.sign-out-btn {
  min-width: 8rem;
}

/* Composer Send: "Send" (4ch) vs "Trimite" (7ch). Stop ("Stop"/"Oprește")
   shares the slot so both pin to the same width and the swap is silent. */
.composer .primary-btn,
.stop-btn {
  min-width: 6rem;
}

/* Result-card primary action (Download / Descarcă). */
.result-card .primary-btn {
  min-width: 7rem;
}

/* Result-card link buttons (Show XML / Tree view). Pin both to the
   widest RO variant ("Vizualizare arbore", ~18ch at 0.9rem) so the
   whole row stays stable across language and toggle state. */
.result-card-buttons .link-btn {
  min-width: 11rem;
}

/* Upload-card View PDF. "View PDF" vs "Vezi PDF" -- both ~8ch. */
.upload-card-view {
  min-width: 6.5rem;
}

/* Status pill. Widest content is RO "Se verifică…" (~11 chars + dot).
   Tight min-width keeps "Online" / "Offline" from looking lost while
   still absorbing the checking → online transition silently. */
.be-status {
  min-width: 7.5rem;
  justify-content: center;
}

/* ====================================================================
   Auth lock screen
   ==================================================================== */

/* Visually hidden but accessible to screen readers. Used for the
   password-input label so the input has an a11y name without showing
   redundant text next to the placeholder. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.auth-lock {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1.5rem;
}

.auth-lock[hidden] {
  display: none;
}

.auth-lock-card {
  background: var(--color-bg);
  border-radius: var(--radius);
  box-shadow:
    0 10px 30px rgba(15, 23, 42, 0.3),
    0 2px 6px rgba(15, 23, 42, 0.12);
  width: min(420px, 100%);
  padding: 1.75rem 1.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.auth-lock-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
}

.auth-lock-subtitle {
  margin: 0;
  color: var(--color-muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.auth-lock-label {
  display: block;
}

.auth-lock-input {
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  color: var(--color-fg);
}

.auth-lock-input:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 1px;
}

.auth-lock-submit {
  align-self: stretch;
}

.auth-lock-error {
  margin: 0;
  font-size: 0.9rem;
  color: #b42318;
  background: #fef3f2;
  border: 1px solid #fecdca;
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.7rem;
}

.auth-lock-error[hidden] {
  display: none;
}

/* Sign-out button in the topbar. Shares the new-chat pill silhouette so the
   topbar stays visually consistent; muted accent so it does not compete
   with "New chat" or the language toggle. Width is pinned in the
   "Fixed-width button slots" section above so language toggling between
   "Sign out" and "Deconectare" does not reflow the topbar. */
.sign-out-btn {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0.35rem 0.95rem;
  background: var(--color-bg);
  color: var(--color-muted);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition:
    transform 0.08s ease-out,
    border-color 0.12s ease-out,
    box-shadow 0.12s ease-out,
    color 0.12s ease-out,
    background 0.12s ease-out;
}

.sign-out-btn:hover {
  color: var(--color-fg);
  border-color: var(--color-fg);
  background: var(--color-disabled);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
}

.sign-out-btn:active {
  transform: translateY(1px);
  box-shadow: 0 0 0 rgba(15, 23, 42, 0);
}

.sign-out-btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.sign-out-btn[hidden] {
  display: none;
}
