/* GhostMode App Styles */

body.app-body {
  background: var(--bg);
  color: var(--fg);
  font-family: 'DM Sans', system-ui, sans-serif;
  margin: 0;
  overflow: hidden;
  height: 100vh;
}

.app-shell {
  display: flex;
  height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 280px;
  background: var(--bg-alt);
  border-right: 1px solid rgba(255,255,255,0.05);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-header {
  padding: 24px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.sidebar-brand {
  font-family: 'Cormorant Garamond', serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--fg);
  text-decoration: none;
  display: block;
  margin-bottom: 4px;
}

.sidebar-tagline {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-muted);
}

.new-chat-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 16px;
  margin-top: 16px;
  background: var(--accent-dim);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
  text-decoration: none;
}

.new-chat-btn:hover { background: rgba(240,165,0,0.2); }

.conversations-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.conv-item {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--fg-muted);
  font-size: 13px;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  gap: 8px;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conv-item:hover { background: rgba(255,255,255,0.04); color: var(--fg); }
.conv-item.active { background: var(--accent-dim); color: var(--accent); }

.conv-icon { font-size: 14px; flex-shrink: 0; }

.conv-title { overflow: hidden; text-overflow: ellipsis; }

.empty-convs {
  padding: 24px 12px;
  text-align: center;
  color: var(--fg-muted);
  font-size: 13px;
}

/* Chat area */
.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.chat-header {
  padding: 16px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.chat-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
}

.chat-subtitle {
  font-size: 11px;
  color: var(--fg-muted);
  margin-top: 2px;
}

.chat-actions { display: flex; gap: 8px; }

.icon-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 6px;
  color: var(--fg-muted);
  cursor: pointer;
  font-size: 14px;
  transition: background 0.15s;
}

.icon-btn:hover { background: rgba(255,255,255,0.08); color: var(--fg); }

/* Messages */
.messages-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.message-wrap {
  max-width: 720px;
  margin: 0 auto 24px;
}

.msg-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

.msg-avatar.user { background: var(--accent); color: var(--bg); }
.msg-avatar.agent { background: var(--bg-card); border: 1px solid var(--border); color: var(--fg-muted); }

.msg-role { font-size: 12px; font-weight: 600; color: var(--fg-muted); }
.msg-time { font-size: 11px; color: var(--fg-muted); opacity: 0.6; }

.msg-content {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.04);
  border-radius: 12px;
  padding: 16px 20px;
  font-size: 15px;
  line-height: 1.7;
  color: var(--fg);
  white-space: pre-wrap;
}

.msg-content.user { background: rgba(240,165,0,0.08); border-color: rgba(240,165,0,0.15); }

.msg-content strong { color: var(--accent); }
.msg-content em { color: var(--terminal-green); font-style: normal; }
.msg-content code { background: rgba(255,255,255,0.06); padding: 2px 6px; border-radius: 4px; font-size: 13px; }

.broker-list {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.broker-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 8px;
  font-size: 13px;
}

.broker-icon { font-size: 16px; }
.broker-name { font-weight: 600; color: var(--fg); flex: 1; }
.broker-method { font-size: 11px; color: var(--fg-muted); background: rgba(255,255,255,0.04); padding: 2px 8px; border-radius: 4px; }

/* Welcome state */
.welcome-state {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
}

.welcome-inner {
  text-align: center;
  max-width: 480px;
}

.welcome-ghost {
  font-family: 'Cormorant Garamond', serif;
  font-size: 64px;
  color: var(--accent);
  margin-bottom: 16px;
  line-height: 1;
}

.welcome-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 36px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 12px;
}

.welcome-sub {
  font-size: 16px;
  color: var(--fg-muted);
  line-height: 1.7;
  margin-bottom: 32px;
}

.example-prompts {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
}

.example-prompt {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
  padding: 14px 18px;
  text-align: left;
  color: var(--fg-muted);
  font-size: 14px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.example-prompt:hover { border-color: var(--accent); color: var(--fg); }

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

.input-wrap {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.msg-input {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 12px 16px;
  color: var(--fg);
  font-size: 14px;
  font-family: 'DM Sans', system-ui, sans-serif;
  resize: none;
  min-height: 48px;
  max-height: 160px;
  outline: none;
  transition: border-color 0.15s;
}

.msg-input::placeholder { color: var(--fg-muted); opacity: 0.6; }
.msg-input:focus { border-color: var(--accent); }

.send-btn {
  width: 48px;
  height: 48px;
  background: var(--accent);
  border: none;
  border-radius: 12px;
  color: var(--bg);
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s;
  flex-shrink: 0;
}

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

/* Auth modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(4px);
}

.modal {
  background: var(--bg-alt);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  padding: 40px;
  width: 400px;
  max-width: 90vw;
}

.modal-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 28px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 8px;
}

.modal-sub {
  font-size: 14px;
  color: var(--fg-muted);
  margin-bottom: 28px;
}

.form-group { margin-bottom: 16px; }
.form-label { font-size: 12px; font-weight: 600; color: var(--fg-muted); letter-spacing: 0.05em; text-transform: uppercase; margin-bottom: 6px; display: block; }
.form-input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--fg);
  font-size: 14px;
  font-family: 'DM Sans', system-ui, sans-serif;
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
}
.form-input:focus { border-color: var(--accent); }

.btn-primary {
  width: 100%;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 8px;
  padding: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
  transition: opacity 0.15s;
}
.btn-primary:hover { opacity: 0.85; }

.modal-switch {
  text-align: center;
  margin-top: 16px;
  font-size: 13px;
  color: var(--fg-muted);
}

.modal-switch a { color: var(--accent); cursor: pointer; text-decoration: none; }
.modal-error { color: #ff6b6b; font-size: 13px; margin-top: 10px; text-align: center; }

/* Typing indicator */
.typing-dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  padding: 4px 0;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  background: var(--fg-muted);
  border-radius: 50%;
  animation: typing 1.2s infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* Profile sidebar toggle */
.profile-section {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.05);
}

.profile-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  cursor: pointer;
  color: var(--fg);
  font-size: 13px;
}

.profile-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 12px;
}

/* Dashboard */
.dash-header {
  padding: 24px 48px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dash-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 28px;
  font-weight: 600;
  color: var(--fg);
}

.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 2px;
  margin: 0;
}

.dash-card {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.04);
  padding: 32px;
}

.dash-card-label {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: 12px;
}

.dash-card-value {
  font-family: 'Cormorant Garamond', serif;
  font-size: 48px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.dash-card-sub {
  font-size: 12px;
  color: var(--fg-muted);
  margin-top: 8px;
}

/* Section */
.section { padding: 80px 48px; }
.section-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 32px;
  font-weight: 600;
  margin-bottom: 32px;
  color: var(--fg);
}

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

.requests-table th {
  text-align: left;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-muted);
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-weight: 600;
}

.requests-table td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  color: var(--fg);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.status-drafted { background: rgba(240,165,0,0.15); color: var(--accent); }
.status-sent { background: rgba(96,165,250,0.15); color: var(--terminal-blue); }
.status-completed { background: rgba(74,222,128,0.15); color: var(--terminal-green); }
.status-failed { background: rgba(255,107,107,0.15); color: #ff6b6b; }

/* Responsive */
@media (max-width: 768px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; border-right: none; border-bottom: 1px solid rgba(255,255,255,0.05); }
  .conversations-list { display: none; }
  .dash-grid { grid-template-columns: 1fr; }
}