/* Mill AI Console — Dark Theme */
:root {
  --bg-primary: #0f0f23;
  --bg-secondary: #1a1a2e;
  --bg-tertiary: #2d2d44;
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #667eea;
  --accent-hover: #764ba2;
  --accent-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --border: #2d2d44;
  --danger: #ef4444;
  --success: #22c55e;
  --warning: #f59e0b;
  --radius: 8px;
  --sidebar-width: 260px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
}

.screen { height: 100vh; }
.hidden { display: none !important; }

/* LOGIN */
#login-screen {
  display: flex;
  justify-content: center;
  align-items: center;
}

.login-box {
  background: var(--bg-secondary);
  border-radius: 16px;
  padding: 48px;
  width: 100%;
  max-width: 420px;
  text-align: center;
  box-shadow: 0 25px 50px rgba(0,0,0,0.3);
}

.login-logo h1 {
  font-size: 32px;
  font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-logo p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 4px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

#login-form {
  margin-top: 32px;
}

#login-form input {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
}

#login-form input:focus {
  border-color: var(--accent);
}

#login-form button {
  width: 100%;
  margin-top: 16px;
  padding: 14px;
  background: var(--accent-gradient);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

#login-form button:hover { opacity: 0.9; }
#login-form button:disabled { opacity: 0.5; cursor: not-allowed; }

.login-message {
  margin-top: 16px;
  font-size: 14px;
  color: var(--text-secondary);
  min-height: 20px;
}

.login-message.error { color: var(--danger); }
.login-message.success { color: var(--success); }

/* ========== APP LAYOUT ========== */
#app-screen {
  display: flex;
  height: 100vh;
}

/* SIDEBAR */
#sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.sidebar-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-header h2 {
  font-size: 20px;
  font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.user-badge {
  font-size: 12px;
  color: var(--text-muted);
  display: block;
  margin-top: 4px;
}

/* TAB BAR in sidebar */
.tab-bar {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px;
  border-bottom: 1px solid var(--border);
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  background: transparent;
  border: none;
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
}

.tab-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.tab-btn.active {
  background: var(--accent-gradient);
  color: white;
  font-weight: 600;
}

.tab-btn .tab-icon {
  font-size: 16px;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

/* SIDEBAR AGENT LIST (Chat tab) */
#agent-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.agent-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  background: transparent;
  border: none;
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 14px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}

.agent-btn:hover { background: var(--bg-tertiary); }
.agent-btn.active { background: var(--accent); color: white; }

.agent-btn .agent-icon {
  font-size: 18px;
  width: 28px;
  text-align: center;
  flex-shrink: 0;
}

.agent-btn .agent-info { min-width: 0; }

.agent-btn .agent-name {
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agent-btn .agent-desc {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agent-btn.active .agent-desc { color: rgba(255,255,255,0.7); }

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border);
}

.btn-logout {
  width: 100%;
  padding: 10px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}

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

.role-select {
  width: 100%;
  padding: 8px 10px;
  margin-bottom: 8px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
  outline: none;
}

.role-select:focus { border-color: var(--accent); }

.role-banner {
  padding: 6px 12px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius);
  color: #fca5a5;
  font-size: 12px;
  text-align: center;
  margin-bottom: 8px;
}

/* ========== MAIN CONTENT AREA ========== */
#main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-width: 0;
  overflow: hidden;
}

.tab-panel {
  display: none;
  flex: 1;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.tab-panel.active {
  display: flex;
}

/* ========== CHAT TAB ========== */
#chat-panel {
  flex-direction: column;
}

#chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
  flex-shrink: 0;
}

#chat-header h3 { font-size: 16px; font-weight: 700; }
#chat-header p { font-size: 12px; color: var(--text-muted); }
#chat-agent-icon { font-size: 24px; }

.btn-icon {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
}

.btn-clear {
  margin-left: auto;
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.15s;
}

.btn-clear:hover { opacity: 1; }

/* MESSAGES */
#messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.welcome-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  color: var(--text-muted);
}

.welcome-message h2 {
  font-size: 22px;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.msg {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.6;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.msg.user {
  align-self: flex-end;
  background: var(--accent);
  color: white;
  border-bottom-right-radius: 4px;
}

.msg.assistant {
  align-self: flex-start;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}

.msg.error {
  align-self: center;
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
  font-size: 13px;
}

.typing-indicator {
  display: inline-flex;
  gap: 4px;
  padding: 12px 16px;
  background: var(--bg-tertiary);
  border-radius: 12px;
  align-self: flex-start;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: bounce 1.4s infinite;
}

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

@keyframes bounce {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* INPUT */
#input-area {
  display: flex;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
  flex-shrink: 0;
}

#message-input {
  flex: 1;
  padding: 12px 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  resize: none;
  outline: none;
  max-height: 120px;
  transition: border-color 0.2s;
}

#message-input:focus { border-color: var(--accent); }
#message-input:disabled { opacity: 0.5; }

#send-btn {
  padding: 12px 18px;
  background: var(--accent-gradient);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 18px;
  cursor: pointer;
  transition: opacity 0.2s;
  flex-shrink: 0;
}

#send-btn:hover { opacity: 0.9; }
#send-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* ========== IDEAS BOARD TAB ========== */
#ideas-panel {
  overflow: hidden;
}

.ideas-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.ideas-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-shrink: 0;
  padding: 16px 20px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}

.ideas-toolbar h2 {
  font-size: 20px;
  font-weight: 700;
}

.btn-add-idea {
  padding: 8px 16px;
  background: var(--accent-gradient);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn-add-idea:hover { opacity: 0.9; }

/* Kanban board */
.kanban-board {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 16px;
  min-height: 300px;
}

.kanban-lane {
  min-width: 260px;
  max-width: 300px;
  flex-shrink: 0;
  background: var(--bg-secondary);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
}

.lane-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.lane-header h3 {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.lane-count {
  background: var(--bg-tertiary);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
}

.lane-cards {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Status lane colors */
.kanban-lane[data-status="NEW"] .lane-header { border-left: 3px solid var(--text-muted); }
.kanban-lane[data-status="VALIDATED"] .lane-header { border-left: 3px solid var(--accent); }
.kanban-lane[data-status="BUILD"] .lane-header { border-left: 3px solid var(--warning); }
.kanban-lane[data-status="LIVE"] .lane-header { border-left: 3px solid var(--success); }
.kanban-lane[data-status="PARK"] .lane-header { border-left: 3px solid #8b5cf6; }
.kanban-lane[data-status="KILL"] .lane-header { border-left: 3px solid var(--danger); }

/* Idea card in kanban */
.idea-card {
  background: var(--bg-tertiary);
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid transparent;
}

.idea-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.idea-card-name {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}

.idea-card-oneliner {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.idea-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.idea-mais-score {
  font-size: 18px;
  font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.idea-approvals {
  display: flex;
  gap: 4px;
}

.approval-chip {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  border: 1px solid var(--border);
}

.approval-chip.approved {
  background: rgba(34, 197, 94, 0.2);
  border-color: var(--success);
  color: var(--success);
}

.approval-chip.rejected {
  background: rgba(239, 68, 68, 0.2);
  border-color: var(--danger);
  color: var(--danger);
}

.approval-chip.pending {
  background: var(--bg-secondary);
  color: var(--text-muted);
}

.idea-card-actions {
  margin-top: 8px;
}

.btn-start-pipeline {
  width: 100%;
  padding: 6px 12px;
  background: var(--accent-gradient);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn-start-pipeline:hover { opacity: 0.85; }

/* Idea detail modal */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 200;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  background: var(--bg-secondary);
  border-radius: 16px;
  max-width: 700px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-secondary);
  z-index: 1;
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

.modal-close:hover { color: var(--text-primary); }

.modal-body {
  padding: 24px;
}

.modal-section {
  margin-bottom: 20px;
}

.modal-section h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.modal-field {
  margin-bottom: 12px;
}

.modal-field label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.modal-field input,
.modal-field textarea,
.modal-field select {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.modal-field input:focus,
.modal-field textarea:focus,
.modal-field select:focus {
  border-color: var(--accent);
}

.modal-field textarea {
  resize: vertical;
  min-height: 60px;
}

.modal-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.mais-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.mais-item {
  text-align: center;
}

.mais-item label {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 4px;
  text-transform: uppercase;
}

.mais-item input {
  width: 100%;
  padding: 8px 4px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  outline: none;
}

.mais-item input:focus { border-color: var(--accent); }

.mais-total {
  text-align: center;
  font-size: 28px;
  font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-top: 8px;
}

.approval-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.approval-item {
  text-align: center;
  padding: 10px;
  background: var(--bg-tertiary);
  border-radius: 8px;
}

.approval-item label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.approval-item select {
  width: 100%;
  padding: 6px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  bottom: 0;
  background: var(--bg-secondary);
}

.btn-save {
  padding: 10px 24px;
  background: var(--accent-gradient);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.btn-save:hover { opacity: 0.9; }

.btn-delete {
  padding: 10px 20px;
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-delete:hover { background: rgba(239, 68, 68, 0.1); }

.gm-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  border: none;
  color: var(--text-secondary);
  transition: all 0.15s;
}

.gm-toggle:hover { background: var(--bg-primary); }
.gm-toggle.visible { color: var(--success); }

/* ========== PIPELINE TAB ========== */
.pipeline-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

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

.pipeline-toolbar h2 {
  font-size: 20px;
  font-weight: 700;
}

/* Start form */
.start-form {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}

.start-form h3 { margin-bottom: 12px; font-size: 15px; }

.form-row {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}

.form-row input {
  flex: 1;
  padding: 10px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
}

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

.form-row textarea {
  flex: 2;
  padding: 10px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  resize: none;
  font-family: inherit;
}

.btn-start {
  padding: 10px 20px;
  background: var(--accent-gradient);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.btn-start:hover { opacity: 0.9; }
.btn-start:disabled { opacity: 0.4; cursor: not-allowed; }

/* Pipeline card */
.pipeline-card {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 14px;
  border-left: 4px solid var(--accent);
}

.pipeline-card.completed { border-left-color: var(--success); }
.pipeline-card.killed { border-left-color: var(--danger); }
.pipeline-card.blocked { border-left-color: var(--warning); }
.pipeline-card.running { border-left-color: var(--accent); animation: pulse-border 2s infinite; }

@keyframes pulse-border {
  0%, 100% { border-left-color: var(--accent); }
  50% { border-left-color: #764ba2; }
}

.pipeline-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.pipeline-card-header h3 { font-size: 16px; }

.status-badge {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.status-badge.running { background: rgba(102, 126, 234, 0.2); color: #667eea; }
.status-badge.completed { background: rgba(34, 197, 94, 0.2); color: #22c55e; }
.status-badge.killed { background: rgba(239, 68, 68, 0.2); color: #ef4444; }
.status-badge.blocked { background: rgba(245, 158, 11, 0.2); color: #f59e0b; }
.status-badge.awaiting_human { background: rgba(139, 92, 246, 0.2); color: #8b5cf6; }

/* Phase progress */
.phase-bar { display: flex; gap: 4px; margin-bottom: 8px; }

.phase-dot { flex: 1; height: 6px; border-radius: 3px; background: var(--bg-tertiary); }
.phase-dot.done { background: var(--success); }
.phase-dot.active { background: var(--accent); animation: pulse-bg 1.5s infinite; }
.phase-dot.blocked { background: var(--warning); }

@keyframes pulse-bg {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

.phase-labels { display: flex; gap: 4px; margin-bottom: 12px; }
.phase-label { flex: 1; font-size: 9px; color: var(--text-muted); text-align: center; }

/* Pipeline log */
.log-entry-detail { border-top: 1px solid var(--border); }
.log-entry-detail:first-child { border-top: none; }

.log-entry {
  display: flex;
  gap: 12px;
  padding: 8px 0;
  font-size: 13px;
  cursor: pointer;
  list-style: none;
}

.log-entry::-webkit-details-marker { display: none; }
.log-entry:hover { background: rgba(102, 126, 234, 0.05); }

.log-phase { color: var(--accent); font-weight: 600; min-width: 20px; }
.log-agent { color: var(--text-secondary); min-width: 80px; }
.log-action { color: var(--text-primary); min-width: 120px; font-weight: 500; }
.log-summary { color: var(--text-muted); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-time { color: var(--text-muted); font-size: 11px; }

/* Approval box */
.approval-box {
  margin-top: 14px;
  padding: 16px;
  background: rgba(102, 126, 234, 0.1);
  border: 1px solid rgba(102, 126, 234, 0.3);
  border-radius: var(--radius);
}

.approval-box h4 { color: var(--accent); margin-bottom: 8px; font-size: 14px; }
.approval-box p { color: var(--text-secondary); font-size: 13px; margin-bottom: 12px; white-space: pre-wrap; }

.approval-box textarea {
  width: 100%;
  padding: 8px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  resize: none;
  margin-bottom: 12px;
  outline: none;
}

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

.btn-approve {
  padding: 8px 20px;
  background: var(--success);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.btn-reject {
  padding: 8px 20px;
  background: var(--danger);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.btn-approve:hover, .btn-reject:hover { opacity: 0.9; }

/* Review items */
.review-items { margin-bottom: 16px; }

.review-item {
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.review-item summary {
  padding: 10px 14px;
  background: var(--bg-tertiary);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  user-select: none;
}

.review-item summary:hover { background: var(--bg-primary); }
.review-agent { color: var(--accent); margin-right: 8px; }

.review-content {
  padding: 14px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-secondary);
  max-height: 400px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* Deep Research */
.dr-section {
  margin-bottom: 16px;
  padding: 14px;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius);
}

.dr-section h5 { color: var(--warning); margin-bottom: 8px; }
.dr-instructions { font-size: 13px; color: var(--text-secondary); margin-bottom: 12px; }
.dr-prompt { margin-bottom: 10px; }
.dr-prompt label { font-size: 12px; color: var(--text-muted); display: block; margin-bottom: 4px; }

.dr-prompt-text {
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  font-size: 12px;
  color: var(--text-primary);
  user-select: all;
  cursor: text;
}

.dr-section textarea {
  width: 100%;
  padding: 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  outline: none;
  margin-top: 8px;
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 0;
  font-size: 14px;
}

/* ========== SETTINGS TAB ========== */
.settings-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.settings-toolbar {
  flex-shrink: 0;
  padding: 16px 20px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}

.settings-toolbar h2 {
  font-size: 20px;
  font-weight: 700;
}

.settings-section {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}

.settings-section h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.user-table {
  width: 100%;
  border-collapse: collapse;
}

.user-table th {
  text-align: left;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}

.user-table td {
  padding: 10px 12px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}

.user-table tr:last-child td { border-bottom: none; }

.role-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}

.role-tag.owner { background: rgba(102, 126, 234, 0.2); color: var(--accent); }
.role-tag.partner { background: rgba(139, 92, 246, 0.2); color: #8b5cf6; }
.role-tag.gm { background: rgba(34, 197, 94, 0.2); color: var(--success); }

.add-user-form {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.add-user-form input {
  flex: 1;
  padding: 10px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
}

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

.add-user-form button {
  padding: 10px 20px;
  background: var(--accent-gradient);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.add-user-form button:hover { opacity: 0.9; }

/* ========== MOBILE ========== */
@media (max-width: 768px) {
  #sidebar {
    position: fixed;
    left: -100%;
    top: 0;
    z-index: 100;
    width: 280px;
    transition: left 0.3s;
    box-shadow: 4px 0 20px rgba(0,0,0,0.5);
  }

  #sidebar.open { left: 0; }
  .btn-icon { display: block; }

  .msg { max-width: 95%; }
  .login-box { margin: 20px; padding: 32px 24px; }

  .kanban-board { flex-direction: column; }
  .kanban-lane { min-width: 100%; max-width: 100%; }

  .form-row { flex-direction: column; }
  .add-user-form { flex-direction: column; }

  .modal { max-height: 95vh; margin: 10px; }
  .modal-row { grid-template-columns: 1fr; }
  .mais-grid { grid-template-columns: repeat(3, 1fr); }
  .approval-grid { grid-template-columns: 1fr; }
}
