* {
  box-sizing: border-box;
}

:root {
  --bg: #071725;
  --ink: #091524;
  --panel: #0b2134;
  --panel-2: #102a40;
  --cream: #fff8eb;
  --cream-2: #fff1d6;
  --paper: #fffaf0;
  --text: #122033;
  --muted: #6b7280;
  --border: rgba(185, 134, 54, 0.28);
  --gold: #d4a84f;
  --gold-2: #f4d37b;
  --teal: #0f766e;
  --teal-2: #14b8a6;
  --blue: #0e7490;
  --danger: #dc2626;
  --danger-dark: #991b1b;
  --success: #15803d;
  --shadow: 0 18px 45px rgba(8, 18, 31, 0.14);
}

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  font-family: Inter, Arial, Helvetica, sans-serif;
  background:
    radial-gradient(circle at 15% 8%, rgba(244, 211, 123, 0.18), transparent 28%),
    radial-gradient(circle at 92% 18%, rgba(20, 184, 166, 0.12), transparent 30%),
    linear-gradient(135deg, #06111f 0%, #0a2133 55%, #071725 100%);
  color: var(--text);
  font-size: 15px;
}

button,
select,
textarea,
input {
  font-family: inherit;
  font-size: 14px;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

.app-shell {
  height: 100vh;
  height: 100dvh;
  display: flex;
  overflow: hidden;
  padding: 8px;
  gap: 8px;
}

/* =========================
   SIDEBAR
========================= */

.sidebar {
  width: 288px;
  min-width: 288px;
  height: calc(100vh - 16px);
  height: calc(100dvh - 16px);
  background:
    linear-gradient(180deg, rgba(5, 23, 38, 0.98), rgba(5, 31, 47, 0.98)),
    radial-gradient(circle at top left, rgba(212, 168, 79, 0.16), transparent 34%);
  color: white;
  border: 1px solid rgba(212, 168, 79, 0.5);
  border-radius: 24px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(212, 168, 79, 0.55) transparent;
  box-shadow: var(--shadow);
  position: relative;
}

.sidebar::before {
  content: "";
  position: absolute;
  inset: 8px;
  pointer-events: none;
  border-radius: 18px;
  border: 1px solid rgba(244, 211, 123, 0.12);
}

.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(212, 168, 79, 0.55);
  border-radius: 999px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 2px 8px;
  position: relative;
  z-index: 1;
}

.brand-logo {
  width: 54px;
  height: 54px;
  min-width: 54px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(244, 211, 123, 0.18), rgba(20, 184, 166, 0.1));
  border: 1px solid rgba(244, 211, 123, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.brand-logo img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  display: block;
}

.brand h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.05;
  color: #f8d879;
  letter-spacing: 0.1px;
}

.brand p {
  margin: 6px 0 0;
  font-size: 13px;
  line-height: 1.4;
  color: #dbeafe;
}

.primary-btn {
  width: 100%;
  border: 1px solid rgba(244, 211, 123, 0.45);
  border-radius: 16px;
  padding: 12px 14px;
  background: linear-gradient(135deg, #067a75, #075985);
  color: white;
  font-weight: 900;
  box-shadow: 0 12px 25px rgba(7, 89, 133, 0.26);
  position: relative;
  z-index: 1;
}

.primary-btn:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  z-index: 1;
}

.nav-btn {
  width: 100%;
  padding: 13px 14px;
  border-radius: 14px;
  border: 1px solid rgba(212, 168, 79, 0.18);
  background: rgba(255, 255, 255, 0.045);
  color: #f8fafc;
  font-size: 14px;
  font-weight: 800;
  text-align: left;
  transition: 0.2s ease;
}

.nav-btn:hover {
  background: rgba(20, 184, 166, 0.14);
  border-color: rgba(244, 211, 123, 0.42);
}

.panel,
.sidebar-account-box,
.sidebar-recent-panel {
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(212, 168, 79, 0.24);
  border-radius: 18px;
  padding: 14px;
  position: relative;
  z-index: 1;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.panel h3 {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 900;
  color: #f8d879;
}

.prompt-btn {
  width: 100%;
  margin-top: 8px;
  border: 1px solid rgba(212, 168, 79, 0.18);
  border-radius: 13px;
  padding: 10px 12px;
  background: rgba(3, 22, 35, 0.72);
  color: white;
  text-align: left;
  font-weight: 700;
}

.prompt-btn:hover {
  background: rgba(20, 184, 166, 0.13);
  border-color: rgba(244, 211, 123, 0.4);
}

.sidebar-footer {
  margin-top: auto;
  font-size: 12px;
  color: #cbd5e1;
  position: relative;
  z-index: 1;
}

/* Account / recent chats */
.account-user-name {
  margin: 0;
  color: #ffffff;
  font-size: 16px;
  font-weight: 900;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-user-email {
  margin: 4px 0 9px;
  color: rgba(255, 255, 255, 0.66);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.34);
  color: #bbf7d0;
  font-size: 11px;
  font-weight: 900;
  margin-bottom: 10px;
}

.account-status-badge.logged-out {
  background: rgba(251, 191, 36, 0.14);
  border-color: rgba(251, 191, 36, 0.3);
  color: #fde68a;
}

.account-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.account-action-btn {
  min-height: 38px;
  border: 1px solid rgba(212, 168, 79, 0.2);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  font-size: 12px;
  font-weight: 900;
}

.account-action-btn.logout {
  background: rgba(239, 68, 68, 0.18);
  color: #fecaca;
}

.sidebar-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.sidebar-section-header h3 {
  margin: 0;
  color: #f8d879;
  font-size: 14px;
  font-weight: 900;
}

.view-all-chats-btn {
  border: none;
  background: transparent;
  color: #7dd3fc;
  font-size: 12px;
  font-weight: 900;
  padding: 0;
}

.sidebar-recent-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-height: 230px;
  overflow-y: auto;
  padding-right: 2px;
}

.sidebar-empty-chats {
  margin: 0;
  color: rgba(255, 255, 255, 0.62);
  font-size: 12px;
  line-height: 1.4;
}

.sidebar-chat-item {
  width: 100%;
  border: 1px solid rgba(212, 168, 79, 0.12);
  background: rgba(255, 255, 255, 0.07);
  color: #ffffff;
  border-radius: 14px;
  padding: 10px 11px;
  text-align: left;
  transition: 0.2s ease;
}

.sidebar-chat-item:hover,
.sidebar-chat-item.active {
  background: linear-gradient(135deg, rgba(15, 118, 110, 0.58), rgba(7, 89, 133, 0.58));
  border-color: rgba(244, 211, 123, 0.34);
}

.sidebar-chat-title {
  display: block;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-chat-meta {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.65);
}

/* =========================
   MAIN CHAT PAGE
========================= */

.chat-page {
  flex: 1;
  height: calc(100vh - 16px);
  height: calc(100dvh - 16px);
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(212, 168, 79, 0.5);
  border-radius: 24px;
  background:
    radial-gradient(circle at 18% 10%, rgba(212, 168, 79, 0.11), transparent 28%),
    radial-gradient(circle at 94% 42%, rgba(20, 184, 166, 0.10), transparent 24%),
    linear-gradient(180deg, #fffaf0 0%, #fff6e8 100%);
  box-shadow: var(--shadow);
  position: relative;
}

.chat-page::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.16;
  background:
    radial-gradient(circle at 14% 16%, transparent 0 80px, rgba(212, 168, 79, 0.22) 82px, transparent 84px),
    radial-gradient(circle at 78% 56%, transparent 0 115px, rgba(15, 118, 110, 0.18) 118px, transparent 120px);
}

.chat-page::after {
  content: "✦";
  position: absolute;
  right: 36px;
  bottom: 110px;
  color: rgba(212, 168, 79, 0.22);
  font-size: 96px;
  pointer-events: none;
}

.topbar {
  min-height: 78px;
  background:
    linear-gradient(135deg, rgba(5, 23, 38, 0.98), rgba(7, 42, 65, 0.98));
  border-bottom: 1px solid rgba(212, 168, 79, 0.38);
  padding: 13px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
  position: relative;
  z-index: 3;
  box-shadow: 0 10px 22px rgba(5, 23, 38, 0.10);
}

.menu-btn {
  display: none;
  border: 1px solid rgba(212, 168, 79, 0.35);
  background: rgba(255, 255, 255, 0.08);
  color: #fff8eb;
  border-radius: 12px;
  padding: 9px 12px;
  font-weight: 900;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-logo {
  width: 50px;
  height: 50px;
  object-fit: contain;
}

.topbar h2 {
  margin: 0;
  font-size: 28px;
  color: #f8d879;
  line-height: 1.05;
}

.topbar p {
  margin: 4px 0 0;
  color: #99f6e4;
  font-size: 13px;
  font-weight: 700;
}

.clear-btn {
  margin-left: auto;
  border: 1px solid rgba(212, 168, 79, 0.36);
  background: rgba(255, 255, 255, 0.1);
  color: #fff8eb;
  border-radius: 14px;
  padding: 10px 14px;
  font-weight: 900;
}

.clear-btn:hover {
  background: rgba(244, 211, 123, 0.14);
}

.beta-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(244, 211, 123, 0.16);
  color: #f8d879;
  font-size: 12px;
  font-weight: 900;
  border: 1px solid rgba(244, 211, 123, 0.36);
  white-space: nowrap;
}

/* =========================
   WELCOME
========================= */

.welcome {
  max-width: 920px;
  width: calc(100% - 40px);
  margin: 0 auto;
  padding: 36px 20px 12px;
  position: relative;
  z-index: 1;
}

.welcome h2 {
  margin: 0 0 8px;
  font-size: 32px;
  color: #0b2134;
}

.welcome p {
  margin: 0 0 22px;
  color: #5b6472;
  line-height: 1.6;
  font-weight: 600;
}

.welcome-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.welcome-card {
  border: 1px solid rgba(212, 168, 79, 0.28);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  padding: 17px;
  text-align: left;
  color: var(--text);
  font-weight: 900;
  box-shadow: 0 10px 24px rgba(17, 24, 39, 0.06);
  transition: 0.18s ease;
}

.welcome-card:hover {
  border-color: rgba(15, 118, 110, 0.52);
  transform: translateY(-2px);
}

/* =========================
   MESSAGES
========================= */

.messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 34px 24px 24px;
  scroll-padding-top: 28px;
  position: relative;
  z-index: 1;
}

.messages::-webkit-scrollbar {
  width: 7px;
}

.messages::-webkit-scrollbar-thumb {
  background: rgba(212, 168, 79, 0.5);
  border-radius: 999px;
}

.message-row {
  display: flex;
  margin-bottom: 16px;
}

.message-row.user {
  justify-content: flex-end;
}

.message-row.bot {
  justify-content: flex-start;
}

.message {
  max-width: min(78%, 760px);
  padding: 15px 17px;
  border-radius: 19px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.message.user {
  background: linear-gradient(135deg, #075985, #0f766e);
  color: white;
  border-bottom-right-radius: 7px;
  border: 1px solid rgba(244, 211, 123, 0.25);
}

.message.bot {
  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
  border: 1px solid rgba(212, 168, 79, 0.26);
  border-bottom-left-radius: 7px;
}

.message.error {
  color: #991b1b;
  border-color: #fecaca;
  background: #fff7f7;
}

.message-actions {
  margin-top: 9px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.copy-btn {
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: 10px;
  background: #ecfeff;
  color: #0f766e;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 900;
}

.speak-btn {
  border-color: rgba(212, 168, 79, 0.28);
  background: #fff7db;
  color: #8a5a08;
}

.speak-btn.speaking {
  border-color: rgba(220, 38, 38, 0.22);
  background: #fff1f2;
  color: #be123c;
}

/* =========================
   COMPOSER
========================= */

.composer {
  background: rgba(255, 250, 240, 0.9);
  border-top: 1px solid rgba(212, 168, 79, 0.28);
  padding: 13px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}

.composer::before {
  content: "";
  position: absolute;
  inset: 8px 14px;
  border: 1px solid rgba(212, 168, 79, 0.22);
  border-radius: 18px;
  pointer-events: none;
}

.composer-tools,
.composer-input-row {
  max-width: 1080px;
  width: 100%;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.composer-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.composer-mode-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.composer-mode-control label {
  color: #675434;
  font-size: 12px;
  font-weight: 900;
}

.composer-mode-select {
  min-height: 40px;
  border: 1px solid rgba(212, 168, 79, 0.38);
  border-radius: 999px;
  background: #fffaf0;
  color: #0b2134;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 900;
  outline: none;
}

.composer-mode-select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.12);
}

.composer-mode-hint {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.composer-input-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.composer textarea {
  flex: 1;
  min-height: 50px;
  max-height: 140px;
  resize: none;
  border: 1px solid rgba(212, 168, 79, 0.3);
  border-radius: 17px;
  padding: 15px 16px;
  outline: none;
  line-height: 1.4;
  background: rgba(255, 255, 255, 0.9);
  color: #102033;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.9);
}

.composer textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.12);
}

.composer-icon-btn {
  width: 52px;
  min-width: 52px;
  height: 52px;
  border: 1px solid rgba(212, 168, 79, 0.32);
  border-radius: 17px;
  background: rgba(255, 247, 219, 0.92);
  color: #0b2134;
  font-size: 19px;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.06);
}

.composer-icon-btn:hover {
  border-color: rgba(15, 118, 110, 0.52);
  background: #ecfeff;
}

.composer-icon-btn.listening {
  border-color: rgba(220, 38, 38, 0.32);
  background: #fff1f2;
  color: #be123c;
  animation: voicePulse 1s ease-in-out infinite;
}

@keyframes voicePulse {
  0% {
    box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.22);
  }

  70% {
    box-shadow: 0 0 0 9px rgba(220, 38, 38, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(220, 38, 38, 0);
  }
}

.composer button[type="submit"] {
  border: 1px solid rgba(244, 211, 123, 0.44);
  border-radius: 17px;
  background: linear-gradient(135deg, #083344, #0f766e);
  color: white;
  padding: 15px 22px;
  font-weight: 900;
  box-shadow: 0 12px 25px rgba(15, 118, 110, 0.24);
}

.composer button[type="submit"]:hover {
  filter: brightness(1.08);
}

.composer button[type="submit"]:disabled {
  background: #94a3b8;
  border-color: #cbd5e1;
}


/* Compact launch composer */
.compact-composer-row {
  align-items: center;
}

.inline-mode-control {
  min-height: 50px;
  min-width: 238px;
  border: 1px solid rgba(212, 168, 79, 0.3);
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.76);
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 11px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.9);
}

.inline-mode-control label {
  color: #675434;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.inline-mode-control .composer-mode-select {
  min-height: 34px;
  width: 100%;
  border-color: transparent;
  background: transparent;
  padding: 0 4px;
}

.inline-mode-control:focus-within {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.12);
}

.composer-bottom-row {
  max-width: 1080px;
  width: 100%;
  margin: -2px auto 0;
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.attachment-input {
  display: none;
}

.attach-file-btn {
  background: #fff7db;
  color: #8a5a08;
}

.attach-file-btn:hover {
  background: #fff1d6;
}


.attachment-type-menu {
  display: none;
  position: absolute;
  left: 258px;
  bottom: 78px;
  width: 170px;
  padding: 8px;
  border: 1px solid rgba(212, 168, 79, 0.32);
  border-radius: 16px;
  background: rgba(255, 250, 240, 0.98);
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.16);
  z-index: 10;
}

.attachment-type-menu.active {
  display: grid;
  gap: 6px;
}

.attachment-type-option {
  width: 100%;
  min-height: 36px;
  border: 1px solid rgba(212, 168, 79, 0.22);
  border-radius: 11px;
  background: #ffffff;
  color: #0b2134;
  font-size: 12px;
  font-weight: 900;
  text-align: left;
  padding: 8px 10px;
}

.attachment-type-option:hover {
  border-color: rgba(15, 118, 110, 0.4);
  background: #ecfeff;
  color: #0f766e;
}


.attachment-preview {
  min-height: 24px;
  flex: 0 1 auto;
  max-width: 440px;
  color: #675434;
  font-size: 12px;
  line-height: 1.35;
}

.attachment-preview:not(.has-attachment) {
  display: none;
}

.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  border: 1px solid rgba(212, 168, 79, 0.36);
  border-radius: 999px;
  background: rgba(255, 247, 219, 0.95);
  color: #675434;
  padding: 5px 7px 5px 9px;
  font-size: 12px;
  font-weight: 900;
}

.attachment-name {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-meta {
  color: #8a5a08;
  font-size: 11px;
  white-space: nowrap;
}

.attachment-remove-btn {
  width: 22px;
  height: 22px;
  border: 1px solid rgba(220, 38, 38, 0.22);
  border-radius: 999px;
  background: #fff1f2;
  color: #be123c;
  font-size: 16px;
  line-height: 1;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.attachment-remove-btn:hover {
  background: #ffe4e6;
}

.voice-status {
  margin: 0;
  color: #0f766e;
  font-size: 12px;
  line-height: 1.35;
  font-weight: 900;
  white-space: nowrap;
}

.ai-accuracy-warning {
  margin: 0;
  color: #675434;
  font-size: 12px;
  line-height: 1.35;
  font-weight: 800;
  text-align: right;
  white-space: nowrap;
}

.ai-accuracy-warning::before {
  content: "⚠ ";
  color: #b98636;
}

/* =========================
   MODAL BASE
========================= */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 18, 30, 0.72);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 18px;
  backdrop-filter: blur(5px);
}

.modal-overlay.active {
  display: flex;
}

.settings-modal {
  width: 92%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  background: #fffaf0;
  color: var(--text);
  border: 1px solid rgba(212, 168, 79, 0.42);
  border-radius: 24px;
  padding: 24px;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.28);
}

.onboarding-modal {
  width: min(780px, calc(100vw - 28px));
}

.settings-modal::-webkit-scrollbar {
  width: 7px;
}

.settings-modal::-webkit-scrollbar-thumb {
  background: rgba(212, 168, 79, 0.52);
  border-radius: 999px;
}

.settings-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.settings-header h2,
.onboarding-hero h2 {
  margin: 0;
  font-size: 26px;
  color: #0b2134;
}

.modal-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.modal-close {
  border: none;
  background: #f5e8cc;
  color: #111827;
  width: 38px;
  min-width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 22px;
}

.settings-section {
  margin-bottom: 16px;
}

.settings-section label,
.onboarding-field label {
  display: block;
  font-weight: 900;
  margin-bottom: 7px;
  color: #0b2134;
}

.settings-section select,
.settings-section input,
.onboarding-field input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(212, 168, 79, 0.38);
  background: #ffffff;
  color: #0b2134;
  font-size: 15px;
  outline: none;
}

.settings-section select:focus,
.settings-section input:focus,
.onboarding-field input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.12);
}

.settings-section small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.save-settings-btn,
.onboarding-primary-btn,
.onboarding-secondary-btn {
  border-radius: 14px;
  min-height: 44px;
  font-size: 14px;
  font-weight: 900;
}

.save-settings-btn,
.onboarding-primary-btn {
  width: 100%;
  padding: 13px 16px;
  border: 1px solid rgba(244, 211, 123, 0.42);
  background: linear-gradient(135deg, #075985, #0f766e);
  color: white;
  margin-top: 10px;
}

.onboarding-secondary-btn {
  border: 1px solid rgba(212, 168, 79, 0.35);
  background: #fffaf0;
  color: #0b2134;
  padding: 0 14px;
}

.settings-note,
.onboarding-status {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.success-note {
  color: var(--success);
  font-weight: 900;
}

.error-note {
  color: #991b1b;
  font-weight: 900;
}

/* Onboarding blocks */
.onboarding-hero {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.onboarding-logo {
  width: 62px;
  height: 62px;
  border-radius: 20px;
  background: #0b2134;
  border: 1px solid rgba(212, 168, 79, 0.36);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  overflow: hidden;
}

.onboarding-logo img {
  width: 58px;
  height: 58px;
  object-fit: contain;
}

.onboarding-hero p {
  margin: 0;
  color: #5b6472;
  line-height: 1.5;
  font-size: 14px;
}

.beta-test-warning,
.onboarding-warning,
.byok-info-box,
.onboarding-card,
.chat-summary-card {
  border: 1px solid rgba(212, 168, 79, 0.28);
  background: rgba(255, 255, 255, 0.66);
  border-radius: 18px;
  padding: 15px;
  margin-bottom: 16px;
}

.beta-test-warning strong,
.byok-info-box h3,
.onboarding-card h3,
.chat-summary-card h3 {
  display: block;
  color: #8a5a08;
  font-size: 15px;
  margin: 0 0 8px;
  font-weight: 900;
}

.beta-test-warning,
.onboarding-warning {
  color: #713f12;
  background: #fff7db;
}

.byok-info-box ul {
  margin: 0;
  padding-left: 20px;
  color: #1f2937;
  font-size: 14px;
  line-height: 1.7;
}

.onboarding-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.onboarding-card p,
.chat-summary-card p {
  margin: 0;
  color: #5b6472;
  font-size: 13px;
  line-height: 1.5;
}

.onboarding-form {
  border: 1px solid rgba(212, 168, 79, 0.28);
  background: rgba(255, 255, 255, 0.48);
  border-radius: 18px;
  padding: 16px;
  margin-bottom: 14px;
}

.onboarding-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.api-key-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 12px;
}

.get-api-key-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 14px;
  background: #0b2134;
  color: #ffffff;
  text-decoration: none;
  font-size: 14px;
  font-weight: 900;
}

/* Chats modal / saved chats */
.chats-modal {
  max-width: 580px;
}

.chat-actions-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.chat-action-wide {
  grid-column: 1 / -1;
}

.export-action-btn {
  background: linear-gradient(135deg, #0f766e, #0e7490);
}

.pdf-action-btn {
  background: linear-gradient(135deg, #8a5a08, #0b2134);
}

.chat-export-note {
  margin: 0 0 18px;
  border: 1px solid rgba(212, 168, 79, 0.25);
  background: rgba(255, 244, 214, 0.62);
  color: #675434;
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.45;
  font-weight: 800;
}

#clearChatFromModalBtn {
  background: linear-gradient(135deg, #b91c1c, #7f1d1d);
}

.saved-chats-section {
  border-top: 1px solid rgba(212, 168, 79, 0.25);
  padding-top: 18px;
  margin-top: 4px;
}

.saved-chats-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.saved-chats-header h3 {
  margin: 0;
  font-size: 18px;
  color: #0b2134;
}

.saved-chats-header span {
  background: #fff4d6;
  color: #8a5a08;
  border: 1px solid rgba(212, 168, 79, 0.28);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.chat-search-input {
  display: block;
  width: 100%;
  height: 44px;
  border: 1px solid rgba(212, 168, 79, 0.35);
  border-radius: 14px;
  padding: 0 14px;
  font-size: 14px;
  outline: none;
  margin-bottom: 12px;
  background: white;
  color: var(--text);
}

.saved-chats-list {
  width: 100%;
  max-height: 260px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 4px;
}

.empty-chat-state {
  border: 1px dashed rgba(212, 168, 79, 0.4);
  background: rgba(255, 255, 255, 0.55);
  border-radius: 16px;
  padding: 18px;
  text-align: center;
}

.empty-chat-state h4 {
  margin: 0 0 6px;
  font-size: 16px;
  color: #0b2134;
}

.empty-chat-state p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.saved-chat-item {
  border: 1px solid rgba(212, 168, 79, 0.25);
  background: rgba(255,255,255,0.72);
  border-radius: 16px;
  padding: 12px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.saved-chat-main {
  flex: 1;
  min-width: 0;
}

.saved-chat-title {
  margin: 0 0 5px;
  font-size: 14px;
  font-weight: 900;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.saved-chat-meta,
.saved-chat-preview {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.saved-chat-actions {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.small-chat-btn {
  border: 1px solid rgba(15, 118, 110, 0.22);
  background: #ecfeff;
  color: #0f766e;
  border-radius: 10px;
  padding: 6px 9px;
  font-size: 12px;
  font-weight: 900;
}

.small-chat-btn.delete {
  border-color: rgba(220, 38, 38, 0.18);
  background: #fff1f2;
  color: #be123c;
}

.small-chat-btn.export {
  border-color: rgba(212, 168, 79, 0.24);
  background: #fff7db;
  color: #8a5a08;
}


.mode-guidance-strip {
  flex: 1;
  min-width: 0;
  color: #675434;
  font-size: 12px;
  line-height: 1.35;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.api-help-card,
.settings-help-card {
  border: 1px solid rgba(15, 118, 110, 0.18);
  background:
    linear-gradient(135deg, rgba(236, 254, 255, 0.82), rgba(255, 247, 219, 0.74));
  border-radius: 16px;
  padding: 13px;
  margin-top: 12px;
  color: #123047;
}

.api-help-card h3 {
  margin: 0 0 8px;
  color: #0b2134;
  font-size: 14px;
  font-weight: 900;
}

.api-help-card ol {
  margin: 0;
  padding-left: 20px;
  font-size: 13px;
  line-height: 1.65;
}

.api-help-card p {
  margin: 9px 0 0;
  color: #713f12;
  font-size: 12px;
  line-height: 1.45;
  font-weight: 800;
}

.settings-help-card {
  display: grid;
  gap: 7px;
  font-size: 13px;
  line-height: 1.45;
}

.settings-help-card strong {
  color: #0b2134;
  font-weight: 900;
}

.settings-help-card span {
  color: #475569;
}

.settings-help-card a {
  width: fit-content;
  color: #0f766e;
  font-weight: 900;
  text-decoration: none;
}

.settings-help-card a:hover {
  text-decoration: underline;
}


/* =========================
   RESPONSIVE
========================= */



/* =========================
   LEGAL / LAUNCH SAFETY
========================= */

.legal-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 11px;
}

.legal-link-btn {
  border: none;
  background: transparent;
  color: #f8d879;
  padding: 0;
  font-size: 11px;
  font-weight: 900;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.legal-link-btn:hover {
  color: #99f6e4;
}

.legal-modal {
  max-width: 720px;
}

.legal-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
  color: #253247;
  line-height: 1.58;
}

.legal-content p {
  margin: 0;
}

.legal-content h3 {
  margin: 10px 0 0;
  color: #0b2134;
  font-size: 16px;
}

.legal-content ul {
  margin: 0;
  padding-left: 20px;
}

.legal-content li {
  margin-bottom: 7px;
}

@media (max-width: 920px) {
  .app-shell {
    padding: 0;
    gap: 0;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1000;
    transform: translateX(-105%);
    transition: transform 0.25s ease;
    height: 100vh;
    height: 100dvh;
    border-radius: 0 24px 24px 0;
    width: min(84vw, 306px);
    min-width: 0;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .chat-page {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    border-radius: 0;
    border: none;
  }

  .menu-btn {
    display: inline-flex;
  }

  .topbar {
    min-height: 78px;
    padding: 11px 12px;
  }

  .topbar-logo {
    width: 42px;
    height: 42px;
  }

  .topbar h2 {
    font-size: 22px;
  }

  .topbar p {
    font-size: 12px;
  }

  .beta-badge {
    display: none;
  }

  .clear-btn {
    padding: 9px 11px;
  }

  .messages {
    padding: 16px 12px;
  }

  .message {
    max-width: 88%;
  }

  .welcome {
    width: 100%;
    padding: 26px 14px 10px;
  }

  .welcome h2 {
    font-size: 22px;
  }

  .welcome-grid {
    grid-template-columns: 1fr;
  }

  .composer {
    padding: 11px 12px 13px;
  }

  .composer-input-row {
    gap: 8px;
  }

  .compact-composer-row {
    align-items: stretch;
  }

  .inline-mode-control {
    min-width: 214px;
  }

  .composer-bottom-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .ai-accuracy-warning {
    text-align: left;
    white-space: normal;
  }

  .composer textarea {
    min-height: 52px;
  }

  .composer button[type="submit"] {
    padding: 15px 16px;
  }

  .onboarding-grid,
  .onboarding-form-row,
  .chat-actions-grid {
    grid-template-columns: 1fr;
  }

  .onboarding-hero {
    align-items: center;
  }
}

@media (max-width: 520px) {
  body {
    font-size: 14px;
  }

  .topbar {
    min-height: 72px;
  }

  .topbar-logo {
    width: 38px;
    height: 38px;
  }

  .topbar h2 {
    font-size: 20px;
  }

  .topbar p {
    display: none;
  }

  .message {
    max-width: 92%;
    padding: 13px 14px;
  }

  .composer-input-row {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .inline-mode-control {
    flex: 1 1 100%;
    min-width: 0;
  }

  .composer-mode-select {
    max-width: none;
  }

  .composer textarea {
    min-height: 52px;
    padding: 14px;
  }

  .composer button[type="submit"] {
    min-width: 82px;
  }

  .composer-icon-btn {
    width: 52px;
    min-width: 52px;
  }

  .attachment-preview {
    max-width: 100%;
  }

  .attachment-name {
    max-width: 150px;
  }
}


@media (max-width: 520px) {
  .mode-guidance-strip,
  .attachment-preview,
  .voice-status,
  .ai-accuracy-warning {
    font-size: 11px;
  }

  .mode-guidance-strip {
    white-space: normal;
  }

  .api-help-card ol {
    padding-left: 18px;
  }
}

@media (max-width: 720px) {

  .attachment-type-menu {
    left: 16px;
    right: 16px;
    bottom: 92px;
    width: auto;
  }

}
