body.mobile-ui {
  background: radial-gradient(circle at top, #0e1a2b 0%, #05070d 55%, #010203 100%);
  color: #eaf2ff;
  min-height: 100vh;
  margin: 0;
  font-family: "Segoe UI", "Inter", system-ui, sans-serif;
}
.mobile-shell {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: 16px 16px 90px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.mobile-header {
  text-align: center;
  padding: 20px 12px 8px;
  border-radius: 20px;
  background: rgba(11,19,33,.65);
  box-shadow: 0 10px 40px rgba(3,9,21,.6);
}
.title-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 8px;
}
.title-logo {
  width: 56px;
  height: 56px;
  object-fit: contain;
  filter: drop-shadow(0 0 10px rgba(125,211,252,.45));
}
.neon-title {
  margin: 0;
  font-size: 1.65rem;
  color: #f8fbff;
  text-shadow: 0 0 12px rgba(248,251,255,.9), 0 0 32px rgba(125,211,252,.8);
  text-align: center;
}
.subtitle {
  margin: 6px 0 0;
  color: rgba(226,232,240,.8);
  font-size: 0.9rem;
}
.mobile-auth {
  margin-top: 10px;
  font-size: 0.85rem;
  color: rgba(148,163,184,.95);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  text-align: center;
}
.link-btn {
  background: transparent;
  color: #7dd3fc;
  border: 1px solid rgba(125,211,252,.6);
  border-radius: 999px;
  padding: 4px 12px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.75rem;
}
.link-btn.hidden {
  display: none;
}
.mobile-ui.locked .chat-shell,
.mobile-ui.locked .composer {
  opacity: .35;
  pointer-events: none;
}
.mobile-ui.locked .mobile-auth {
  color: #f87171;
}
.mobile-ui .domain-row,
.mobile-ui .llm-row,
.mobile-ui .auto-controls {
  display: none;
}
.chat-shell {
  flex: 1;
  min-height: 0;
}
.chat-feed {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 12px;
  border-radius: 18px;
  background: rgba(7,12,23,.85);
  height: 100%;
  overflow-y: auto;
  box-shadow: inset 0 0 25px rgba(0,0,0,.4);
}
.chat-feed.resetting {
  animation: feedReset 0.5s ease;
}
@keyframes feedReset {
  0% { opacity: 1; }
  40% { opacity: 0.25; }
  100% { opacity: 1; }
}
body.mobile-ui .chat-feed::after {
  content: "";
  display: block;
  height: 120px;
  width: 100%;
}
.chat-message {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.chat-message.user {
  justify-content: flex-end;
}
.chat-message.user .chat-bubble {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  border-radius: 16px 16px 4px 16px;
  color: #f8fbff;
}
.chat-message.bot .chat-bubble {
  background: rgba(15,23,42,.8);
  border-radius: 16px 16px 16px 4px;
  color: #e2e8f0;
  box-shadow: 0 0 20px rgba(56,189,248,.2);
}
.chat-notice {
  margin: 10px 0 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255,196,107,.12);
  border: 1px solid rgba(255,196,107,.35);
  color: #ffe9b8;
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.35;
}
.chat-message.bot.intro-selector .chat-bubble {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.domain-shortcuts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.domain-shortcuts button {
  border-radius: 999px;
  padding: 10px 8px;
  border: 1px solid rgba(148,163,184,.45);
  background: rgba(59,130,246,.12);
  color: #e2e8f0;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s ease;
}
.domain-shortcuts button.active {
  background: linear-gradient(130deg, #2563eb, #1d4ed8);
  border-color: transparent;
  box-shadow: 0 0 18px rgba(37,99,235,.45);
}
.domain-shortcuts button:focus-visible {
  outline: 2px solid rgba(125,211,252,.7);
  outline-offset: 2px;
}
.chat-message.bot.disambiguation .chat-bubble {
  background: rgba(12,18,30,.78);
  box-shadow: 0 0 12px rgba(125,211,252,.15);
}
.chat-avatar {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  object-fit: cover;
  background: linear-gradient(#0f172a,#020617);
  box-shadow: 0 0 12px rgba(59,130,246,.35);
}
.chat-bubble {
  padding: 12px 16px;
  max-width: 85%;
  font-size: 0.92rem;
  line-height: 1.35;
  position: relative;
}
.chat-bubble.has-export {
  padding-top: 36px;
}
.chat-bubble-body {
  width: 100%;
}
.chat-download-btn {
  position: absolute;
  top: 8px;
  right: 12px;
  border: 1px solid rgba(125,211,252,.45);
  background: rgba(37,99,235,.2);
  color: #bbf7d0;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 4px 10px;
  cursor: pointer;
  box-shadow: 0 0 12px rgba(59,130,246,.35);
}
.chat-download-btn:focus-visible {
  outline: 2px solid rgba(125,211,252,.8);
  outline-offset: 2px;
}
.chat-narrative {
  margin-bottom: 8px;
  color: #e0f2fe;
  font-size: 0.9rem;
}
.chat-table-collapsed {
  margin-top: 6px;
}
.chat-table-collapsed summary {
  cursor: pointer;
  color: #7dd3fc;
  margin-bottom: 4px;
}
.disambiguation-options {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.disambiguation-options button {
  border: 1px solid rgba(125,211,252,.35);
  background: rgba(15,23,42,.7);
  color: #e2e8f0;
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 0.9rem;
}
.disambiguation-options button.ghost {
  border-style: dashed;
  background: transparent;
  color: rgba(226,232,240,.7);
}
.chat-bubble table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.chat-bubble table th,
.chat-bubble table td {
  border-bottom: 1px solid rgba(148,163,184,.2);
  padding: 6px 4px;
}
.chat-bubble table th {
  text-transform: uppercase;
  font-size: 0.7rem;
  color: #94a3b8;
}
#mobile-loading.hidden {
  display: none;
}
#mobile-loading .chat-bubble {
  display: flex;
  align-items: center;
  gap: 6px;
}
.loading-text {
  animation: pulse 1.2s ease-in-out infinite;
  letter-spacing: 0.5px;
}
@keyframes pulse {
  0% { opacity: .2; }
  50% { opacity: 1; }
  100% { opacity: .2; }
}
.composer {
  position: sticky;
  bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(6,10,19,.95);
  box-shadow: 0 8px 30px rgba(0,0,0,.45);
}
.composer-row {
  display: flex;
  gap: 10px;
  align-items: center;
  color: #cfd8e3;
}
.composer-row label {
  font-size: 0.85rem;
  color: #94a3b8;
}
.composer-row select,
.composer-row input {
  flex: 1;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(148,163,184,.4);
  background: rgba(15,23,42,.8);
  color: #e2e8f0;
}
.composer-row.toggles {
  justify-content: flex-start;
  gap: 20px;
}
.composer-row.toggles label {
  display: flex;
  align-items: center;
  gap: 6px;
}
.composer-row button#btn-reload-domains {
  width: 42px;
  border-radius: 12px;
  background: rgba(30,64,175,.8);
  color: #e0f2fe;
}
.composer-actions {
  display: flex;
  gap: 10px;
}
.composer button {
  flex: 1;
  border: none;
  border-radius: 14px;
  padding: 12px 16px;
  font-weight: 600;
  cursor: pointer;
}
.composer .btn-primary {
  background: linear-gradient(135deg,#0ea5e9,#2563eb);
  color: #fff;
  box-shadow: 0 10px 25px rgba(14,165,233,.35);
}
.composer button:not(.btn-primary) {
  background: rgba(15,23,42,.8);
  color: #e2e8f0;
  border: 1px solid rgba(59,130,246,.4);
}
.composer button.btn-ghost {
  background: transparent;
  border: 1px dashed rgba(148,163,184,.5);
  color: #cbd5f5;
}
.composer-row.recognition {
  justify-content: flex-end;
}
.composer-row.recognition small {
  color: #94a3b8;
}
.hidden-mobile {
  display: none;
}
.history-modal {
  max-height: 70vh;
  overflow: hidden;
}
.history-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0 8px;
  font-size: 0.8rem;
  color: #94a3b8;
}
.history-toggle input {
  transform: scale(1.05);
}
.history-list {
  max-height: 250px;
  overflow-y: auto;
  margin: 12px 0;
  border: 1px solid rgba(148,163,184,.3);
  border-radius: 12px;
}
.history-list button {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  padding: 10px 12px;
  color: #e2e8f0;
  border-bottom: 1px solid rgba(148,163,184,.2);
}
.history-list button:last-child {
  border-bottom: none;
}
.history-list button:hover {
  background: rgba(59,130,246,.15);
}
.history-list button.validated {
  color: #31ff96;
  text-shadow: 0 0 6px rgba(49,255,150,.6);
}
.extra-rows {
  margin-top: 8px;
  border-radius: 12px;
  border: 1px solid rgba(148,163,184,.3);
  background: rgba(15,23,42,.5);
  padding: 6px 10px;
}
.extra-rows summary {
  cursor: pointer;
  list-style: none;
  font-size: 0.8rem;
  color: #7dd3fc;
  display: flex;
  align-items: center;
  gap: 6px;
}
.extra-rows summary::-webkit-details-marker {
  display: none;
}
.extra-rows summary::before {
  content: '+';
  font-weight: 700;
  color: #38bdf8;
}
.extra-rows[open] summary::before {
  content: '-';
}
.extra-rows .chat-table {
  margin-top: 6px;
}
.sql-hint {
  margin-top: 6px;
  font-size: 0.75rem;
  color: #94a3b8;
  font-style: italic;
}
.context-marker {
  text-align: center;
  margin: 8px 0;
  position: relative;
}
.context-marker span {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #60a5fa;
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(15,23,42,.7);
  box-shadow: 0 0 12px rgba(59,130,246,.35);
}
#loading-modal {
  display: none !important;
}
.sql-modal pre {
  max-height: 50vh;
  overflow: auto;
  background: rgba(2,6,23,.9);
  color: #e2e8f0;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(59,130,246,.4);
}
.sql-modal-context {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(148,163,184,.25);
  font-size: 0.85rem;
  color: #cbd5f5;
}
.sql-modal-context.hidden {
  display: none;
}
.sql-modal-processors {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(148,163,184,.35);
  border-radius: 12px;
  background: rgba(15,23,42,.7);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sql-modal-processors.hidden {
  display: none;
}
.sql-modal-processors p {
  margin: 0 0 4px;
  font-size: 0.82rem;
  color: #cbd5f5;
}
.sql-modal-processor-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sql-modal-processors label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: #e2e8f0;
}
.sql-modal-processors input[type="checkbox"] {
  transform: scale(1.1);
}
.sql-modal-meta {
  margin-top: 2px;
  font-size: 0.8rem;
  color: rgba(148, 197, 255, 0.85);
}
.sql-modal-meta.hidden {
  display: none;
}
.sql-modal-questions {
  margin-bottom: 6px;
  font-size: 0.78rem;
  color: #94a3b8;
  line-height: 1.4;
}
.sql-modal-questions.hidden {
  display: none;
}
.sql-editor {
  width: 100%;
  min-height: 180px;
  background: rgba(2,6,23,.9);
  color: #e2e8f0;
  border: 1px solid rgba(59,130,246,.4);
  border-radius: 12px;
  padding: 10px;
  font-family: "Fira Code", "SFMono-Regular", Consolas, monospace;
  font-size: 0.85rem;
  resize: vertical;
}
.sql-modal-actions {
  justify-content: space-between;
  gap: 10px;
}
.sql-modal-actions button {
  flex: 1;
}
.chat-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
}
.chat-table th,
.chat-table td {
  font-size: 0.78rem;
  border-bottom: 1px solid rgba(148,163,184,.25);
  padding: 6px;
}
.chat-table th {
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #94a3b8;
}
@media (max-width: 520px) {
  .chat-bubble {
    max-width: 100%;
  }
  .composer-row {
    flex-wrap: wrap;
  }
}

.settings-modal {
  max-width: 540px;
}
.settings-menu {
  display: flex;
  gap: 8px;
  margin: 10px 0 14px;
}
.settings-tab {
  border-radius: 12px;
  border: 1px solid rgba(148,163,184,.4);
  background: rgba(15,23,42,.8);
  color: #e2e8f0;
  padding: 6px 14px;
  font-weight: 600;
  cursor: pointer;
}
.settings-section {
  margin-bottom: 12px;
}
.settings-hint {
  font-size: 0.85rem;
  color: #94a3b8;
  margin-bottom: 8px;
}
.settings-hint.error {
  color: #fca5a5;
}
.log-list {
  border: 1px solid rgba(148,163,184,.25);
  border-radius: 12px;
  max-height: 320px;
  overflow-y: auto;
}
.log-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(148,163,184,.2);
}
.log-entry .log-meta {
  flex: 1;
}
.log-entry:last-child {
  border-bottom: none;
}
.log-entry strong {
  display: block;
  font-size: 0.9rem;
}
.log-entry small {
  display: block;
  color: #94a3b8;
  font-size: 0.75rem;
}
.log-entry button {
  border-radius: 999px;
  padding: 6px 12px;
  border: 1px solid rgba(125,211,252,.45);
  background: rgba(37,99,235,.2);
  color: #bbf7d0;
  font-weight: 600;
  cursor: pointer;
}
