:root {
  --bg: #0D1B2A;
  --panel: #1B2838;
  --panel-dark: #0D1B2A;
  --text: #FFFFFF;
  --muted: #8899aa;
  --accent: #00B4D8;
  --border: #2a3f5f;
  --error: #ff8888;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.noise {
  display: none;
}

.page {
  padding: 24px;
  max-width: 1320px;
  margin: 0 auto;
}

h1 {
  font-weight: 600;
  font-size: 28px;
  margin: 6px 0;
}

.tagline {
  color: var(--accent);
  font-size: 12px;
  font-weight: 300;
  letter-spacing: 2px;
  text-align: center;
  margin: 6px 0 18px;
}

.subtle {
  color: var(--muted);
}

.logo-row {
  display: flex;
  justify-content: center;
  margin-bottom: 8px;
}

.logo {
  width: 150px;
}

.logo-sm {
  width: 120px;
}

.auth-shell {
  min-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 32px;
  width: min(520px, 100%);
  text-align: center;
}

.auth-form input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-dark);
  color: var(--text);
  margin-bottom: 14px;
}

.auth-form button {
  width: 100%;
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 500;
}

.auth-form button:hover {
  background: var(--accent);
  color: var(--panel-dark);
}

.auth-foot {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  margin-top: 16px;
}

.auth-foot a {
  color: var(--text);
}

.error {
  background: #3d1f1f;
  border: 1px solid #ff4444;
  color: var(--error);
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 12px;
}

.chat-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 20px;
  min-height: calc(100vh - 48px);
}

.chat-shell[data-show-history="false"] {
  grid-template-columns: 1fr;
}

.chat-shell[data-show-history="false"] .chat-main {
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
}

.chat-sidebar {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.sidebar-brand .tagline {
  margin: 10px 0 0;
}

.sidebar-cta {
  width: 100%;
}

.sidebar-section h2 {
  font-size: 14px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 10px;
}

.conversation-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.conversation-item {
  border: 1px solid transparent;
  background: var(--panel-dark);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1.4;
}

.conversation-item span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-top: 6px;
}

.conversation-item.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.conversation-empty {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.sidebar-footer {
  margin-top: auto;
  display: flex;
  justify-content: center;
}

.chat-main {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel);
}

.brand-mini {
  display: flex;
  gap: 12px;
  align-items: center;
}

.header-actions {
  display: flex;
  gap: 12px;
}

.ghost {
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  padding: 8px 14px;
  border-radius: 10px;
  text-decoration: none;
  cursor: pointer;
}

.ghost:hover {
  background: var(--accent);
  color: var(--panel-dark);
}

.chat-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  min-height: 55vh;
  display: flex;
  flex-direction: column;
}

.welcome-text {
  text-align: center;
  color: var(--muted);
  padding: 16px 0 24px;
}

.hint-text {
  color: #4a6072;
  font-size: 12px;
  font-style: italic;
}

.starter-text {
  color: inherit;
  font-size: inherit;
  font-style: normal;
  margin: 8px 0 0;
}

.prompt-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  color: #5a7a8a;
  font-size: 15px;
  font-weight: 500;
}

.prompt-list li {
  margin: 6px 0;
}

.chat-messages {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  padding-right: 6px;
}

.bubble {
  padding: 12px 14px;
  border-radius: 10px;
  max-width: 80%;
  line-height: 1.5;
  white-space: pre-wrap;
  border-left: 3px solid var(--accent);
  position: relative;
}

.bubble-content {
  padding-right: 42px;
}

.copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 8px;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.bubble:hover .copy-btn {
  opacity: 1;
  border-color: var(--accent);
  color: var(--accent);
}

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

.bubble.user {
  background: linear-gradient(135deg, #1B2838 0%, #2a3f5f 100%);
  align-self: flex-end;
}

.bubble.agent {
  background: linear-gradient(135deg, #0D1B2A 0%, #1B2838 100%);
  align-self: flex-start;
}

.bubble.thinking {
  font-style: italic;
  color: var(--muted);
  border-left-style: dashed;
  animation: thinkingPulse 1.6s ease-in-out infinite;
}

.bubble.thinking::after {
  content: " ...";
  display: inline-block;
  margin-left: 4px;
}

@keyframes thinkingPulse {
  0% {
    opacity: 0.55;
  }
  50% {
    opacity: 0.95;
  }
  100% {
    opacity: 0.55;
  }
}

#token-usage {
  transition: color 0.2s ease, text-shadow 0.2s ease;
}

.token-warning {
  color: #ff6b6b;
  text-shadow: 0 0 8px rgba(255, 107, 107, 0.35);
  animation: tokenPulse 1.6s ease-in-out infinite;
}

@keyframes tokenPulse {
  0% {
    opacity: 0.85;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0.85;
  }
}

@keyframes pulseDots {
  0% {
    opacity: 0.2;
  }
  50% {
    opacity: 0.8;
  }
  100% {
    opacity: 0.2;
  }
}

.composer {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
}

.composer-inner {
  display: flex;
  gap: 10px;
}

.composer textarea {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--panel-dark);
  color: var(--text);
  font-size: 14px;
  resize: vertical;
}

.composer button {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 10px;
  padding: 0 20px;
  cursor: pointer;
  font-weight: 500;
}

.composer button:hover {
  background: var(--accent);
  color: var(--panel-dark);
}

.composer-foot {
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
}

.composer-foot a {
  color: var(--text);
}

.privacy-shell {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  max-width: 1100px;
  margin: 0 auto;
  min-height: calc(100vh - 96px);
}

.privacy-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.privacy-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.privacy-actions {
  display: flex;
  justify-content: flex-end;
}

.privacy-body {
  line-height: 1.7;
  color: var(--muted);
}

.privacy-content {
  background: var(--panel-dark);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
}

.privacy-body h2 {
  color: var(--text);
  margin-top: 20px;
}

.privacy-body h3 {
  color: var(--text);
  margin-top: 18px;
  font-size: 18px;
}

.privacy-body p {
  margin: 10px 0;
}

.privacy-body ul,
.privacy-body ol {
  margin: 10px 0 14px 20px;
}

.privacy-body li {
  margin: 6px 0;
}

.privacy-body a {
  color: var(--accent);
}

.privacy-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0;
  font-size: 13px;
}

.privacy-body th,
.privacy-body td {
  border: 1px solid var(--border);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

.privacy-body th {
  background: #142438;
  color: var(--text);
}

@media (max-width: 720px) {
  .chat-shell {
    grid-template-columns: 1fr;
  }
  .chat-sidebar {
    order: 2;
  }
  .chat-main {
    order: 1;
  }
  .chat-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .composer-inner {
    flex-direction: column;
  }
  .bubble {
    max-width: 100%;
  }
  .auth-foot {
    flex-direction: column;
    gap: 8px;
    align-items: center;
  }
}
