/* ========================================
   chatgpt.yoga — Deep Research Terminal
   Dark editorial aesthetic with warmth
   ======================================== */

:root {
  --bg: #0c0c0c;
  --bg-raised: #141414;
  --bg-input: #1a1a1a;
  --border: #222;
  --border-focus: #444;
  --text: #d4d0c8;
  --text-muted: #6b6760;
  --text-dim: #3a3834;
  --accent: #c8a96e;
  --accent-dim: rgba(200, 169, 110, 0.12);
  --green: #5a9e6f;
  --red: #b85450;
  --orange: #c89b4e;
  --font-body: 'Newsreader', 'Georgia', serif;
  --font-mono: 'DM Mono', 'Menlo', monospace;
  --radius: 6px;
  --transition: 180ms ease;
}

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* Film grain overlay */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1000;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-size: 128px;
}

/* ---- Layout ---- */
.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 780px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---- Header ---- */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

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

.logo-mark {
  font-size: 18px;
  color: var(--accent);
  opacity: 0.7;
}

.logo-text {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--text-muted);
}

.logo-dot {
  color: var(--accent);
}

.connection-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  transition: all var(--transition);
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-dim);
  transition: background var(--transition);
}

.connection-badge.connected .badge-dot {
  background: var(--green);
  box-shadow: 0 0 6px rgba(90, 158, 111, 0.4);
}

.connection-badge.error .badge-dot {
  background: var(--red);
}

/* ---- Main area ---- */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* ---- Response area ---- */
.response-area {
  flex: 1;
  overflow-y: auto;
  padding: 32px 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.response-area::-webkit-scrollbar {
  width: 4px;
}
.response-area::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

/* ---- Empty state ---- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 80px 0;
  animation: fadeIn 600ms ease both;
}

.empty-icon {
  color: var(--text-dim);
  margin-bottom: 24px;
  animation: spin 30s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.empty-state h2 {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 22px;
  letter-spacing: -0.01em;
  color: var(--text);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 14px;
  color: var(--text-muted);
  max-width: 360px;
  line-height: 1.7;
}

/* ---- Status bar ---- */
.status-bar {
  padding: 12px 16px;
  background: var(--accent-dim);
  border: 1px solid rgba(200, 169, 110, 0.15);
  border-radius: var(--radius);
  margin-bottom: 20px;
  animation: slideDown 300ms ease both;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pulse-ring {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  position: relative;
  flex-shrink: 0;
}

.pulse-ring::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid var(--accent);
  animation: pulse 2s ease-out infinite;
}

@keyframes pulse {
  0% { opacity: 0.6; transform: scale(1); }
  100% { opacity: 0; transform: scale(2); }
}

.status-text {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  letter-spacing: 0.01em;
}

/* ---- Queue notice ---- */
.queue-notice {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  animation: slideDown 300ms ease both;
}

.queue-icon {
  font-size: 14px;
}

/* ---- Chat messages ---- */
.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-bubble {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 12px;
  animation: fadeIn 400ms ease both;
  line-height: 1.6;
}

.user-bubble {
  align-self: flex-end;
  background: var(--accent-dim);
  border: 1px solid rgba(200, 169, 110, 0.18);
  color: var(--text);
  font-size: 15px;
  white-space: pre-wrap;
}

.assistant-bubble {
  align-self: flex-start;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  color: var(--text);
}

/* ---- Response content ---- */
.response-content {
  line-height: 1.75;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.response-content h1,
.response-content h2,
.response-content h3,
.response-content h4 {
  font-family: var(--font-body);
  font-weight: 500;
  margin: 1.5em 0 0.6em;
  color: var(--text);
  letter-spacing: -0.01em;
}

.response-content h1 { font-size: 1.6em; }
.response-content h2 { font-size: 1.3em; }
.response-content h3 { font-size: 1.1em; }

.response-content p {
  margin-bottom: 0.35em;
}

.response-content a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(200, 169, 110, 0.3);
  transition: border-color var(--transition);
}

.response-content a:hover {
  border-color: var(--accent);
}

.response-content ul,
.response-content ol {
  margin: 0.6em 0 1em 1.4em;
}

.response-content li {
  margin-bottom: 0.4em;
}

.response-content code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--bg-raised);
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid var(--border);
}

.response-content pre {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  overflow-x: auto;
  margin: 1em 0;
}

.response-content pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 13px;
  line-height: 1.5;
}

/* Override highlight.js theme background to match app */
.response-content pre code.hljs {
  background: transparent;
  padding: 0;
}

.response-content blockquote {
  border-left: 2px solid var(--accent);
  margin: 1em 0;
  padding: 0.4em 0 0.4em 16px;
  color: var(--text-muted);
  font-style: italic;
}

.response-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1em 0;
  font-size: 14px;
}

.response-content th,
.response-content td {
  border: 1px solid var(--border);
  padding: 8px 12px;
  text-align: left;
}

.response-content th {
  background: var(--bg-raised);
  font-weight: 500;
  font-size: 12px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.response-content img {
  max-width: 100%;
  border-radius: var(--radius);
}

.response-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2em 0;
}

/* ---- Streaming cursor ---- */
.streaming-cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background: var(--accent);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: cursorBlink 600ms steps(2) infinite;
}

@keyframes cursorBlink {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

/* ---- Input area ---- */
.input-area {
  flex-shrink: 0;
  padding: 16px 0 24px;
  border-top: 1px solid var(--border);
}

.query-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.model-select-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.new-chat-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 6px 12px;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.new-chat-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.new-chat-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.new-chat-btn:disabled:hover {
  border-color: var(--border);
  color: var(--text-muted);
}

.model-select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 6px 28px 6px 10px;
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%236b6760' stroke-width='1.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.model-select:hover {
  border-color: var(--border-focus);
  color: var(--text);
}

.model-select:focus {
  outline: none;
  border-color: var(--accent);
  color: var(--text);
}

.model-select option {
  background: var(--bg-raised);
  color: var(--text);
}

.textarea-wrap {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  transition: border-color var(--transition);
}

.textarea-wrap:focus-within {
  border-color: var(--border-focus);
}

textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  resize: none;
  max-height: 180px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

textarea::placeholder {
  color: var(--text-dim);
}

.send-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  flex-shrink: 0;
}

.send-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.send-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.send-btn:disabled:hover {
  color: var(--text-muted);
  border-color: var(--border);
}

.input-hint {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  padding: 0 2px;
}

/* ---- Thinking sidebar ---- */
.thinking-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 340px;
  height: 100vh;
  background: var(--bg-raised);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 500;
  transform: translateX(100%);
  transition: transform 300ms ease;
  pointer-events: none;
}

.thinking-panel.visible {
  transform: translateX(0);
  pointer-events: auto;
}

.thinking-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.thinking-title {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.thinking-close {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 2px 6px;
  line-height: 1;
  transition: all var(--transition);
}

.thinking-close:hover {
  color: var(--text);
  border-color: var(--border-focus);
}

.thinking-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.thinking-body::-webkit-scrollbar {
  width: 4px;
}
.thinking-body::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.thinking-step {
  padding: 6px 0 6px 18px;
  position: relative;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-muted);
  border-left: 1px solid var(--border);
  margin-left: 4px;
}

.thinking-step::before {
  content: '';
  position: absolute;
  left: -3.5px;
  top: 11px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-dim);
}

.thinking-step:last-child {
  color: var(--text);
}

.thinking-step:last-child::before {
  background: var(--accent);
  box-shadow: 0 0 6px rgba(200, 169, 110, 0.4);
}

.thinking-step.done-marker {
  color: var(--green);
  border-left-color: transparent;
}

.thinking-step.done-marker::before {
  background: var(--green);
  box-shadow: 0 0 6px rgba(90, 158, 111, 0.3);
}

.thinking-screenshot {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  opacity: 0.95;
}

/* Wider sidebar when showing screenshots */
.thinking-body:has(.thinking-screenshot) {
  padding: 8px;
}

/* Shift main content when sidebar is open */
.app {
  transition: margin-right 300ms ease;
}

.app.sidebar-open {
  margin-right: 360px;
}

/* ---- Header right group ---- */
.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-badge {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

.logout-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 4px 10px;
  cursor: pointer;
  transition: all var(--transition);
}

.logout-btn:hover {
  border-color: var(--red);
  color: var(--red);
}

.admin-link {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  text-decoration: none;
  padding: 4px 10px;
  border: 1px solid rgba(200, 169, 110, 0.25);
  border-radius: var(--radius);
  transition: all var(--transition);
}

.admin-link:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
}

/* ---- Language toggle ---- */
.lang-toggle {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 4px 10px;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.lang-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.login-logo .lang-toggle {
  margin-left: auto;
}

/* ---- Login page ---- */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 340px;
  animation: fadeIn 600ms ease both;
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  margin-bottom: 40px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login-field label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.login-field input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  padding: 10px 12px;
  outline: none;
  transition: border-color var(--transition);
}

.login-field input:focus {
  border-color: var(--accent);
}

.login-error {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--red);
  padding: 8px 12px;
  background: rgba(184, 84, 80, 0.1);
  border: 1px solid rgba(184, 84, 80, 0.2);
  border-radius: var(--radius);
}

.login-btn {
  background: var(--accent-dim);
  border: 1px solid rgba(200, 169, 110, 0.25);
  border-radius: var(--radius);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 10px;
  cursor: pointer;
  transition: all var(--transition);
  margin-top: 4px;
}

.login-btn:hover {
  background: rgba(200, 169, 110, 0.18);
  border-color: var(--accent);
}

.login-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---- Admin page ---- */
.admin-page {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.admin-main {
  flex: 1;
  padding: 32px 0;
  overflow-y: auto;
}

.admin-title {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 20px;
  color: var(--text);
  margin-bottom: 24px;
}

.admin-add-form {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.admin-add-form input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  padding: 8px 12px;
  outline: none;
  transition: border-color var(--transition);
}

.admin-add-form input:focus {
  border-color: var(--accent);
}

.admin-add-form .login-btn {
  white-space: nowrap;
  padding: 8px 16px;
  margin-top: 0;
}

.admin-error {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--red);
  padding: 8px 12px;
  background: rgba(184, 84, 80, 0.1);
  border: 1px solid rgba(184, 84, 80, 0.2);
  border-radius: var(--radius);
  margin-bottom: 16px;
}

.admin-success {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--green);
  padding: 8px 12px;
  background: rgba(90, 158, 111, 0.1);
  border: 1px solid rgba(90, 158, 111, 0.2);
  border-radius: var(--radius);
  margin-bottom: 16px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.admin-table th {
  background: var(--bg-raised);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: 8px 12px;
  text-align: left;
  border: 1px solid var(--border);
}

.admin-table td {
  padding: 8px 12px;
  border: 1px solid var(--border);
  color: var(--text);
}

.role-admin {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  padding: 2px 6px;
  border: 1px solid rgba(200, 169, 110, 0.25);
  border-radius: 3px;
}

.role-user {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.actions-cell {
  display: flex;
  gap: 6px;
}

.action-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 3px 8px;
  cursor: pointer;
  transition: all var(--transition);
}

.action-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.action-btn.danger:hover {
  border-color: var(--red);
  color: var(--red);
}

/* ---- Dialog ---- */
.dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 600;
}

.dialog-card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  width: 320px;
  animation: fadeIn 200ms ease both;
}

.dialog-card h3 {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 16px;
  color: var(--text);
  margin-bottom: 4px;
}

.dialog-user {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.dialog-card input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  padding: 8px 12px;
  outline: none;
  margin-bottom: 16px;
  transition: border-color var(--transition);
}

.dialog-card input:focus {
  border-color: var(--accent);
}

.dialog-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.dialog-actions .login-btn {
  margin-top: 0;
  padding: 6px 14px;
}

.dialog-actions .logout-btn {
  padding: 6px 14px;
}

/* ---- Utilities ---- */
[hidden] {
  display: none !important;
}

/* ---- Responsive ---- */
@media (max-width: 1200px) {
  .app.sidebar-open {
    margin-right: 0;
  }

  .thinking-panel {
    width: 300px;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.5);
  }
}

@media (max-width: 600px) {
  /* ---- Layout ---- */
  .app {
    padding: 0 12px;
  }

  .app.sidebar-open {
    margin-right: 0;
  }

  /* ---- Header compact ---- */
  .header {
    padding: 12px 0;
  }

  .logo-mark {
    font-size: 16px;
  }

  .logo-text {
    font-size: 13px;
  }

  .header-right {
    gap: 6px;
  }

  .lang-toggle {
    font-size: 10px;
    padding: 4px 8px;
  }

  .user-badge {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0;
    overflow: hidden;
    text-align: center;
  }

  .user-badge::after {
    content: attr(data-initial);
    font-size: 11px;
    font-family: var(--font-mono);
    color: var(--text-muted);
  }

  .admin-link {
    padding: 4px 8px;
    font-size: 10px;
  }

  .logout-btn {
    font-size: 0;
    padding: 6px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
  }

  .logout-btn::after {
    content: '';
    display: block;
    width: 14px;
    height: 14px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b6760' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4'/%3E%3Cpolyline points='16 17 21 12 16 7'/%3E%3Cline x1='21' y1='12' x2='9' y2='12'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    font-size: 14px;
  }

  .logout-btn:hover::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23b85450' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4'/%3E%3Cpolyline points='16 17 21 12 16 7'/%3E%3Cline x1='21' y1='12' x2='9' y2='12'/%3E%3C/svg%3E");
  }

  .connection-badge {
    padding: 4px;
    border: none;
    gap: 0;
  }

  .connection-badge .badge-text {
    display: none;
  }

  /* ---- Empty state ---- */
  .empty-state {
    padding: 40px 16px;
  }

  .empty-state h2 {
    font-size: 18px;
  }

  .empty-state p {
    font-size: 13px;
  }

  .empty-icon svg {
    width: 36px;
    height: 36px;
  }

  /* ---- Response area ---- */
  .response-area {
    padding: 16px 0;
  }

  /* ---- Chat bubbles ---- */
  .chat-bubble {
    max-width: 95%;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 15px;
  }

  .response-content pre {
    padding: 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .response-content pre code {
    font-size: 12px;
  }

  .response-content table {
    font-size: 12px;
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .response-content th,
  .response-content td {
    padding: 6px 8px;
    white-space: nowrap;
  }

  /* ---- Input area ---- */
  .input-area {
    padding: 10px 0 16px;
  }

  .model-select-wrap {
    margin-bottom: 8px;
  }

  .model-select {
    font-size: 11px;
    padding: 8px 28px 8px 10px;
    min-height: 36px;
  }

  .new-chat-btn {
    font-size: 11px;
    padding: 8px 12px;
    min-height: 36px;
  }

  .textarea-wrap {
    padding: 8px 10px;
  }

  textarea {
    font-size: 16px; /* prevents iOS zoom on focus */
  }

  .send-btn {
    padding: 8px 10px;
    min-width: 40px;
    min-height: 40px;
  }

  .input-hint {
    display: none;
  }

  /* ---- Status bar ---- */
  .status-bar {
    padding: 10px 12px;
    margin-bottom: 12px;
  }

  .status-text {
    font-size: 11px;
  }

  .queue-notice {
    font-size: 11px;
    padding: 8px 12px;
  }

  /* ---- Thinking panel — bottom sheet ---- */
  .thinking-panel {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 70vh;
    border-left: none;
    border-top: 1px solid var(--border);
    border-radius: 16px 16px 0 0;
    transform: translateY(100%);
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.6);
  }

  .thinking-panel.visible {
    transform: translateY(0);
  }

  .thinking-header {
    padding: 16px 16px 12px;
    position: relative;
  }

  /* Bottom sheet drag handle */
  .thinking-header::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 4px;
    border-radius: 2px;
    background: var(--border-focus);
  }

  .thinking-body {
    padding: 12px 16px;
  }

  .thinking-step {
    font-size: 11px;
  }

  /* ---- Bottom sheet backdrop ---- */
  .thinking-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 499;
    opacity: 0;
    pointer-events: none;
    transition: opacity 300ms ease;
  }

  .thinking-backdrop.visible {
    opacity: 1;
    pointer-events: auto;
  }

  /* ---- Login page mobile ---- */
  .login-page {
    padding: 24px 16px;
    align-items: flex-start;
    padding-top: 20vh;
  }

  .login-card {
    max-width: 100%;
  }

  .login-field input {
    padding: 12px;
    font-size: 16px; /* prevents iOS zoom */
    min-height: 44px;
  }

  .login-btn {
    padding: 12px;
    font-size: 14px;
    min-height: 44px;
  }

  /* ---- Admin page mobile ---- */
  .admin-page {
    padding: 0 12px;
  }

  .admin-main {
    padding: 20px 0;
  }

  .admin-title {
    font-size: 18px;
    margin-bottom: 16px;
  }

  /* Stack the add-user form vertically */
  .admin-add-form {
    flex-direction: column;
    gap: 10px;
  }

  .admin-add-form input {
    font-size: 16px;
    padding: 10px 12px;
    min-height: 44px;
  }

  .admin-add-form .login-btn {
    min-height: 44px;
    font-size: 14px;
  }

  /* Card-style user table */
  .admin-table thead {
    display: none;
  }

  .admin-table,
  .admin-table tbody {
    display: block;
    width: 100%;
  }

  .admin-table tr {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 14px;
    margin-bottom: 10px;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius);
  }

  .admin-table td {
    border: none;
    padding: 0;
    display: block;
  }

  /* Username takes full first row */
  .admin-table td:nth-child(1) {
    font-weight: 500;
    font-size: 15px;
    flex: 1;
  }

  /* Role badge beside username */
  .admin-table td:nth-child(2) {
    flex-shrink: 0;
  }

  /* Date on second row, full width */
  .admin-table td:nth-child(3) {
    width: 100%;
    font-size: 12px;
    color: var(--text-muted);
    font-family: var(--font-mono);
  }

  /* Actions on third row */
  .admin-table td:nth-child(4) {
    width: 100%;
    padding-top: 6px;
    border-top: 1px solid var(--border);
    margin-top: 4px;
  }

  .actions-cell {
    gap: 8px;
  }

  .action-btn {
    padding: 6px 12px;
    font-size: 12px;
    min-height: 32px;
  }

  /* Dialog mobile */
  .dialog-card {
    width: calc(100vw - 32px);
    max-width: 340px;
  }

  .dialog-card input {
    font-size: 16px;
    min-height: 44px;
  }
}
