* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #0f172a;
  color: #e2e8f0;
  height: 100vh;
  overflow: hidden;
}

.app-shell {
  height: 100vh;
  display: flex;
  justify-content: center;
  padding: 24px;
  overflow: hidden;
}

.hidden {
  display: none !important;
}

.auth-panel,
.chat-panel {
  width: min(960px, 100%);
  height: calc(100vh - 48px);
}

.auth-panel {
  display: grid;
  place-items: center;
}

.auth-card {
  width: min(860px, 100%);
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 28px;
  align-items: center;
  background: #111827;
  border: 1px solid #1f2937;
  border-radius: 20px;
  padding: 32px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

.auth-copy h1 {
  margin: 0 0 14px;
  font-size: clamp(30px, 5vw, 48px);
  line-height: 1.1;
}

.auth-copy p {
  margin: 0;
  color: #94a3b8;
  line-height: 1.8;
}

.auth-copy .eyebrow {
  margin-bottom: 12px;
  color: #93c5fd;
  font-weight: 700;
}

.auth-box {
  background: #0b1220;
  border: 1px solid #1f2937;
  border-radius: 18px;
  padding: 20px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.auth-tabs button,
.ghost-button {
  border: 1px solid #334155;
  background: #111827;
  color: #e2e8f0;
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
}

.auth-tabs button.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-form label,
.shortcut-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #cbd5e1;
  font-size: 13px;
}

.auth-form input,
.shortcut-label select {
  width: 100%;
  border-radius: 12px;
  border: 1px solid #334155;
  background: #0f172a;
  color: #e2e8f0;
  padding: 12px;
  font: inherit;
}

.auth-form button,
.ghost-button {
  width: 100%;
}

.auth-form button {
  border: none;
  background: #2563eb;
  color: #fff;
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
}

.auth-form button:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.auth-error {
  min-height: 20px;
  margin: 0;
  color: #fca5a5;
  font-size: 13px;
}

.ghost-button {
  margin-top: 14px;
}

.chat-panel {
  display: flex;
  flex-direction: column;
  background: #111827;
  border: 1px solid #1f2937;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

.chat-header {
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid #1f2937;
}

.chat-header h1 {
  margin: 0 0 6px;
  font-size: 24px;
}

.chat-header p {
  margin: 0;
  color: #94a3b8;
}

.currency-status {
  margin-top: 4px !important;
  color: #93c5fd !important;
  font-size: 13px;
}

.currency-form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-top: 10px;
}

.currency-form label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  color: #cbd5e1;
  font-size: 12px;
}

.currency-form input {
  width: 180px;
  border-radius: 10px;
  border: 1px solid #334155;
  background: #0f172a;
  color: #e2e8f0;
  padding: 9px 10px;
  font: inherit;
}

.currency-form button {
  border: none;
  background: #2563eb;
  color: #fff;
  border-radius: 10px;
  padding: 9px 12px;
  cursor: pointer;
}

.currency-form button:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.currency-error {
  min-height: 18px;
  margin-top: 4px !important;
  color: #fca5a5 !important;
  font-size: 12px;
}

.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.header-actions button,
#sendBtn {
  border: none;
  background: #2563eb;
  color: #fff;
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
}

#logoutBtn,
#manualAuthBtn {
  background: #374151;
}

.message-list {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.message {
  max-width: 80%;
  padding: 14px 16px;
  border-radius: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
}

.message.user {
  align-self: flex-end;
  background: #1d4ed8;
}

.message.assistant {
  align-self: flex-start;
  background: #1f2937;
}

.message.system {
  align-self: center;
  background: #0b1220;
  color: #93c5fd;
  border: 1px dashed #334155;
}

.message a {
  color: #93c5fd;
  font-weight: 700;
}

.chat-form {
  border-top: 1px solid #1f2937;
  padding: 14px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.quick-inputs {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quick-row {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.quick-row span {
  flex: 0 0 72px;
  color: #93c5fd;
  font-size: 13px;
  font-weight: 700;
}

.quick-row .quick-separator {
  flex: 0 0 auto;
  color: #475569;
  font-weight: 700;
}

.quick-row button {
  flex: 0 0 auto;
  border: 1px solid #334155;
  background: #0b1220;
  color: #cbd5e1;
  border-radius: 999px;
  padding: 7px 10px;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
}

.quick-row button:hover {
  border-color: #60a5fa;
  color: #fff;
}

#messageInput {
  width: 100%;
  resize: none;
  border-radius: 14px;
  border: 1px solid #334155;
  background: #0f172a;
  color: #e2e8f0;
  padding: 14px;
  font: inherit;
}

.form-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.send-actions {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.shortcut-label {
  min-width: 150px;
}

.shortcut-label select {
  padding: 9px 10px;
}

.hint {
  color: #94a3b8;
  font-size: 13px;
}

@media (max-width: 720px) {
  .app-shell {
    padding: 0;
  }

  .auth-panel,
  .chat-panel {
    height: 100vh;
    border-radius: 0;
  }

  .auth-card {
    height: 100%;
    grid-template-columns: 1fr;
    align-content: center;
    border-radius: 0;
  }

  .chat-header,
  .form-actions {
    flex-direction: column;
    align-items: flex-start;
  }

  .currency-form {
    width: 100%;
    align-items: stretch;
  }

  .currency-form label {
    flex: 1;
  }

  .currency-form input {
    width: 100%;
  }

  .header-actions {
    flex-wrap: wrap;
  }

  .send-actions {
    width: 100%;
    align-items: stretch;
  }

  .quick-row span {
    flex-basis: 64px;
  }

  .shortcut-label {
    flex: 1;
  }

  .message {
    max-width: 100%;
  }
}
