:root {
  --bg: #0b0f17;
  --bg-elev: #111827;
  --sidebar-bg: #0a0e16;
  --border: #1f2937;
  --border-strong: #2a3445;
  --text: #e5e7eb;
  --text-muted: #9ca3af;
  --text-subtle: #6b7280;
  --accent: #10a37f;
  --accent-hover: #0e8f6f;
  --user-bubble: #1f2937;
  --assistant-bubble: transparent;
  --code-bg: #0a0e16;
  --danger: #ef4444;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto,
    Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 15px;
  line-height: 1.55;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

kbd {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 11px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.app {
  display: grid;
  grid-template-columns: 260px 1fr;
  grid-template-rows: minmax(0, 1fr);
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
}

.app.collapsed {
  grid-template-columns: 0 1fr;
}

.app.collapsed .sidebar {
  transform: translateX(-100%);
}

/* ---------- Sidebar ---------- */
.sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.sidebar-header {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-logo-row {
  padding: 10px 10px 6px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-logo-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text);
  transition: background 0.15s ease;
}

.sidebar-logo-link:hover {
  background: var(--bg-elev);
}

.sidebar-logo-link img {
  width: 28px;
  height: 28px;
  display: block;
  flex-shrink: 0;
}

.sidebar-wordmark {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #10a37f, #0ea5e9);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.new-chat-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  transition: background 0.15s ease;
}

.new-chat-btn:hover {
  background: var(--bg-elev);
}

.history {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.history-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
  transition: background 0.15s ease, color 0.15s ease;
}

.history-item:hover {
  background: var(--bg-elev);
  color: var(--text);
}

.history-item.active {
  background: var(--bg-elev);
  color: var(--text);
}

.history-empty {
  padding: 12px;
  font-size: 12.5px;
  color: var(--text-subtle);
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  display: block;
  border-radius: 8px;
}

.brand-name {
  font-weight: 600;
  font-size: 14px;
}

.brand-sub {
  color: var(--text-subtle);
  font-size: 12px;
}

/* ---------- Main column ---------- */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--bg);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
  z-index: 5;
}

.icon-btn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--text-muted);
  transition: background 0.15s ease, color 0.15s ease;
}

.icon-btn:hover {
  background: var(--bg-elev);
  color: var(--text);
}

.model-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.model-label {
  font-size: 12px;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.model-input {
  background-color: var(--bg-elev);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  min-width: 180px;
  max-width: 240px;
  outline: none;
  transition: border-color 0.15s ease;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

.model-input:focus {
  border-color: var(--accent);
}

.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  border: 1px solid transparent;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.nav-link:hover {
  color: var(--text);
  background: var(--bg-elev);
  border-color: var(--border-strong);
}

/* ---------- Chat area ---------- */
.chat {
  flex: 1 1 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
}

.welcome {
  max-width: 760px;
  margin: 0 auto;
  padding: 64px 24px 32px;
  text-align: center;
}

.welcome-logo {
  line-height: 0;
  margin-bottom: 8px;
}

.welcome-logo-img {
  width: 56px;
  height: 56px;
  display: block;
  margin: 0 auto;
}

.welcome h1 {
  font-size: 26px;
  margin: 0 0 8px 0;
  font-weight: 600;
}

.welcome p {
  color: var(--text-muted);
  margin: 0 0 32px 0;
}

.suggestions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  max-width: 640px;
  margin: 0 auto;
}

.suggestion {
  text-align: left;
  padding: 14px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-elev);
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: border-color 0.15s ease, transform 0.05s ease;
}

.suggestion:hover {
  border-color: var(--accent);
}

.suggestion:active {
  transform: translateY(1px);
}

.suggestion-title {
  font-weight: 600;
  font-size: 14px;
}

.suggestion-sub {
  font-size: 12.5px;
  color: var(--text-muted);
}

.messages {
  max-width: 820px;
  margin: 0 auto;
  padding: 24px 24px 120px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.msg {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.avatar {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
  color: #fff;
  user-select: none;
}

.avatar.user {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
}

.avatar.assistant {
  background: linear-gradient(135deg, #10a37f, #0ea5e9);
}

.bubble {
  flex: 1;
  min-width: 0;
}

.role {
  font-size: 12px;
  color: var(--text-subtle);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.role .meta {
  color: var(--text-subtle);
  font-size: 11.5px;
}

.content {
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  color: var(--text);
}

.content code {
  background: var(--code-bg);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
}

.content pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  line-height: 1.5;
  margin: 8px 0;
}

.content pre code {
  background: transparent;
  border: none;
  padding: 0;
}

.msg.user .content {
  background: var(--user-bubble);
  border: 1px solid var(--border);
  padding: 10px 14px;
  border-radius: var(--radius);
}

.msg.error .content {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fecaca;
  padding: 10px 14px;
  border-radius: var(--radius);
}

.typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
}

.typing .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: blink 1.2s infinite ease-in-out;
}

.typing .dot:nth-child(2) {
  animation-delay: 0.15s;
}

.typing .dot:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes blink {
  0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-2px); }
}

/* ---------- Composer ---------- */
.composer {
  border-top: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(11,15,23,0.6), var(--bg) 40%);
  padding: 14px 16px 16px;
  flex-shrink: 0;
}

.composer-form {
  max-width: 820px;
  margin: 0 auto;
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  padding: 8px 8px 8px 14px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  box-shadow: var(--shadow-lg);
  transition: border-color 0.15s ease;
}

.composer-form:focus-within {
  border-color: var(--accent);
}

.prompt-input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  line-height: 1.5;
  resize: none;
  outline: none;
  max-height: 220px;
  padding: 9px 0;
}

.prompt-input::placeholder {
  color: var(--text-subtle);
}

.send-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  transition: background 0.15s ease, opacity 0.15s ease;
  flex: 0 0 auto;
}

.send-btn:hover:not(:disabled) {
  background: var(--accent-hover);
}

.send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.composer-hint {
  max-width: 820px;
  margin: 8px auto 0;
  text-align: center;
  color: var(--text-subtle);
  font-size: 12px;
}

/* ---------- Scrollbar ---------- */
.chat::-webkit-scrollbar,
.history::-webkit-scrollbar {
  width: 8px;
}

.chat::-webkit-scrollbar-thumb,
.history::-webkit-scrollbar-thumb {
  background: #1f2937;
  border-radius: 8px;
}

.chat::-webkit-scrollbar-thumb:hover,
.history::-webkit-scrollbar-thumb:hover {
  background: #2a3445;
}

/* ---------- About page ---------- */
.about-body {
  min-height: 100vh;
  background:
    radial-gradient(900px 500px at 10% -10%, rgba(16, 163, 127, 0.10), transparent 60%),
    radial-gradient(800px 500px at 100% 0%, rgba(14, 165, 233, 0.10), transparent 60%),
    var(--bg);
}

.about-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(11, 15, 23, 0.7);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 5;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.back-link:hover {
  color: var(--text);
  background: var(--bg-elev);
  border-color: var(--accent);
}

.inline-brand {
  align-items: center;
}

.about {
  max-width: 960px;
  margin: 0 auto;
  padding: 40px 24px 64px;
}

.about-hero {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 28px;
  align-items: center;
  padding: 28px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0));
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
}

.avatar-wrap {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  padding: 3px;
  background: linear-gradient(135deg, #10a37f, #0ea5e9, #8b5cf6);
  display: grid;
  place-items: center;
}

.author-photo {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  background: var(--bg);
  border: 3px solid var(--bg);
}

.hero-info h1 {
  margin: 0 0 6px 0;
  font-size: 30px;
  letter-spacing: -0.01em;
}

.hero-info .role {
  margin: 0 0 14px 0;
  color: var(--text-muted);
  font-size: 15px;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 18px;
}

.tag {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
}

.hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elev);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
}

.btn:hover {
  border-color: var(--accent);
}

.btn:active {
  transform: translateY(1px);
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 24px;
}

.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px 22px 20px;
}

.card h2 {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: 0 0 12px 0;
  font-weight: 600;
}

.card p {
  margin: 0 0 10px 0;
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.65;
}

.card p:last-child {
  margin-bottom: 0;
}

.card strong {
  color: #fff;
}

.bullet {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bullet li {
  position: relative;
  padding-left: 18px;
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.5;
}

.bullet li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10a37f, #0ea5e9);
}

.contact-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.contact-list li {
  display: flex;
  align-items: center;
  gap: 12px;
}

.contact-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(16, 163, 127, 0.1);
  color: var(--accent);
  border: 1px solid rgba(16, 163, 127, 0.25);
  flex: 0 0 36px;
}

.contact-label {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-subtle);
  margin-bottom: 2px;
}

.contact-value {
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  word-break: break-all;
}

a.contact-value:hover {
  color: var(--accent);
}

.text-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.text-link:hover {
  text-decoration: underline;
}

/* ---------- API credentials card ---------- */
.api-creds-card {
  grid-column: 1 / -1;
}

.api-creds-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.cred-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.cred-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-subtle);
}

.cred-field-wrap {
  display: flex;
  gap: 6px;
  align-items: center;
}

.cred-field {
  flex: 1;
  min-width: 0;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  outline: none;
  cursor: text;
}

.cred-copy-btn,
.cred-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-elev);
  color: var(--text-muted);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}

.cred-copy-btn:hover,
.cred-toggle-btn:hover {
  background: var(--bg);
  color: var(--text);
  border-color: var(--accent);
}

.api-example {
  margin-top: 20px;
  border-top: 1px solid var(--border);
  padding-top: 18px;
}

.api-example-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-subtle);
  margin-bottom: 10px;
}

.api-example-code {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--text-muted);
  overflow-x: auto;
  white-space: pre;
  margin: 0;
  line-height: 1.6;
}

/* ---------- API Docs page ---------- */
.api-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.tab-bar {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}

.tab-btn {
  padding: 7px 16px;
  border-radius: 8px 8px 0 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-subtle);
  background: transparent;
  border: 1px solid transparent;
  border-bottom: none;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
  position: relative;
  bottom: -1px;
}

.tab-btn:hover {
  color: var(--text);
}

.tab-btn.active {
  color: var(--text);
  background: var(--bg-elev);
  border-color: var(--border);
  border-bottom-color: var(--bg-elev);
}

.tab-panel {
  margin-top: 4px;
}

.code-block-wrap {
  position: relative;
}

.code-copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 4px 10px;
  font-size: 12px;
  font-family: inherit;
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  z-index: 2;
}

.code-copy-btn:hover {
  color: var(--text);
  border-color: var(--accent);
}

.ref-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow-x: auto;
}

.ref-url {
  font-size: 13px;
  color: var(--accent);
  word-break: break-all;
}

.method-badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  background: rgba(16, 163, 127, 0.15);
  color: var(--accent);
  border: 1px solid rgba(16, 163, 127, 0.3);
  white-space: nowrap;
  flex-shrink: 0;
}

.badge-req {
  display: inline-block;
  font-size: 10.5px;
  padding: 2px 7px;
  border-radius: 5px;
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.25);
  white-space: nowrap;
}

.badge-opt {
  display: inline-block;
  font-size: 10.5px;
  padding: 2px 7px;
  border-radius: 5px;
  background: rgba(107, 114, 128, 0.15);
  color: var(--text-muted);
  border: 1px solid var(--border-strong);
  white-space: nowrap;
}

.type-badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 5px;
  background: rgba(14, 165, 233, 0.1);
  color: #38bdf8;
  border: 1px solid rgba(14, 165, 233, 0.25);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: nowrap;
}

.status-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.status-badge.ok {
  background: rgba(16, 163, 127, 0.12);
  color: var(--accent);
  border: 1px solid rgba(16, 163, 127, 0.25);
}

.status-badge.warn {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.status-badge.err {
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

/* Tester */
.tester-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
}

.tester-status {
  display: inline-block;
  font-size: 12.5px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 6px;
}

.tester-status.ok {
  background: rgba(16, 163, 127, 0.12);
  color: var(--accent);
}

.tester-status.err {
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
}

.tester-status.pending {
  background: rgba(107, 114, 128, 0.15);
  color: var(--text-muted);
}

@media (max-width: 820px) {
  .tester-grid {
    grid-template-columns: 1fr;
  }
  .api-hero {
    flex-direction: column;
    align-items: flex-start;
  }
}

.about-footer {
  margin-top: 32px;
  text-align: center;
  color: var(--text-subtle);
  font-size: 12.5px;
}

/* ---------- Sidebar auth / user ---------- */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
}

.sidebar-user-avatar {
  width: 32px;
  height: 32px;
  font-size: 13px;
  flex-shrink: 0;
}

.sidebar-user-info {
  min-width: 0;
}

.sidebar-user-name {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-links {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 12px;
  color: var(--text-subtle);
  margin-top: 2px;
}

.sidebar-user-links a {
  color: var(--text-subtle);
  text-decoration: none;
  transition: color 0.15s;
}

.sidebar-user-links a:hover {
  color: var(--accent);
}

.sidebar-auth-row {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
}

.sidebar-auth-btn {
  flex: 1;
  text-align: center;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  background: transparent;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.sidebar-auth-btn:hover {
  background: var(--bg-elev);
  color: var(--text);
}

.sidebar-auth-btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.sidebar-auth-btn.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

/* ---------- User menu (topbar dropdown) ---------- */
.user-menu {
  position: relative;
}

.user-menu-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-elev);
  color: var(--text);
  font-size: 13.5px;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s;
}

.user-menu-btn:hover {
  border-color: var(--accent);
}

.user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10a37f, #0ea5e9);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  line-height: 1;
}

.user-menu-name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-menu-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  min-width: 180px;
  z-index: 50;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  padding: 4px;
}

.user-menu-dropdown[hidden] {
  display: none;
}

.user-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13.5px;
  border-radius: 8px;
  transition: background 0.1s, color 0.1s;
}

.user-menu-item:hover {
  background: var(--bg);
  color: var(--text);
}

.user-menu-item.danger:hover {
  color: var(--danger);
}

.user-menu-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* ---------- Auth modal ---------- */
.auth-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: grid;
  place-items: center;
  z-index: 100;
  backdrop-filter: blur(4px);
  padding: 16px;
}

.auth-modal-overlay[hidden] {
  display: none;
}

.auth-modal {
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  padding: 32px 28px;
  width: 100%;
  max-width: 380px;
  position: relative;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.auth-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--text-subtle);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.auth-modal-close:hover {
  background: var(--bg);
  color: var(--text);
}

.auth-modal-logo {
  margin-bottom: 14px;
}

.auth-modal-title {
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 8px;
}

.auth-modal-sub {
  color: var(--text-muted);
  font-size: 13.5px;
  margin: 0 0 24px;
  line-height: 1.5;
}

.auth-modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ---------- Auth pages (login / register) ---------- */
.auth-body {
  min-height: 100vh;
  background:
    radial-gradient(700px 400px at 5% -5%, rgba(16, 163, 127, 0.10), transparent 60%),
    radial-gradient(700px 400px at 100% 0%, rgba(14, 165, 233, 0.08), transparent 60%),
    var(--bg);
}

.auth-main {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 65px);
  padding: 24px 16px;
}

.auth-card {
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  padding: 32px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}

.auth-title {
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 6px;
}

.auth-sub {
  color: var(--text-muted);
  font-size: 14px;
  margin: 0 0 24px;
}

.auth-alert {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  margin-bottom: 18px;
  line-height: 1.5;
}

.auth-alert a {
  color: #fca5a5;
  text-decoration: underline;
}

.auth-alert.success {
  background: rgba(16, 163, 127, 0.1);
  border-color: rgba(16, 163, 127, 0.3);
  color: #6ee7b7;
}

.auth-form {
  display: flex;
  flex-direction: column;
}

.auth-switch {
  text-align: center;
  color: var(--text-muted);
  font-size: 13.5px;
  margin: 20px 0 0;
}

.auth-switch a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.auth-switch a:hover {
  text-decoration: underline;
}

/* ---------- Shared form controls ---------- */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-subtle);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
}

.form-input:focus {
  border-color: var(--accent);
}

.form-input::placeholder {
  color: var(--text-subtle);
}

.otp-input {
  text-align: center;
  font-size: 22px;
  letter-spacing: 0.35em;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.full-width {
  width: 100%;
  justify-content: center;
  padding: 11px 14px;
  font-size: 14.5px;
}

/* ---------- Profile page ---------- */
.profile-avatar-letter {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(135deg, #10a37f, #0ea5e9);
  display: grid;
  place-items: center;
  font-size: 32px;
  font-weight: 700;
  color: #fff;
}

.stat-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 16px;
  min-width: 80px;
}

.stat-pill-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.2;
}

.stat-pill-label {
  font-size: 11px;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 2px;
}

/* ---------- Usage page ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px 16px;
  text-align: center;
}

.stat-value {
  font-size: 30px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.1;
}

.stat-label {
  font-size: 11.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-top: 5px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.data-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-subtle);
  padding: 0 10px 10px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}

.data-table th.num,
.data-table td.num {
  text-align: right;
}

.data-table td {
  padding: 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.model-tag {
  display: inline-block;
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(16, 163, 127, 0.1);
  border: 1px solid rgba(16, 163, 127, 0.2);
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr);
    max-height: 100vh;
  }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 260px;
    z-index: 20;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }
  .app:not(.collapsed) .sidebar {
    transform: translateX(0);
  }
  .suggestions {
    grid-template-columns: 1fr;
  }
  .model-input {
    min-width: 120px;
    max-width: 55vw;
  }

  .about-hero {
    grid-template-columns: 1fr;
    text-align: center;
    padding: 24px 18px;
  }
  .avatar-wrap {
    margin: 0 auto;
    width: 140px;
    height: 140px;
  }
  .tags,
  .hero-actions {
    justify-content: center;
  }
  .about-grid {
    grid-template-columns: 1fr;
  }
  .inline-brand {
    display: none;
  }
  .about {
    padding: 24px 16px 48px;
  }
  .stat-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .stat-grid .stat-card:last-child {
    grid-column: 1 / -1;
  }
  .user-menu-name {
    display: none;
  }
  .data-table th,
  .data-table td {
    padding: 8px 6px;
  }
}
