/* Dashboard & Admin Login Styling */
.auth-wrapper {
  min-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 2.25rem;
  box-shadow: var(--shadow-md);
}

.auth-header {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.auth-header p {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  margin-bottom: 0.375rem;
  color: var(--text-primary);
}

.form-input {
  width: 100%;
  padding: 0.625rem 0.875rem;
  background-color: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  color: var(--text-primary);
  transition: border-color 0.15s;
}

.form-input:focus {
  outline: none;
  border-color: var(--text-primary);
}

/* Interactive CAPTCHA Box */
.captcha-container {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.captcha-challenge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.captcha-display {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  padding: 0.5rem 0.875rem;
  background: #ffffff;
  border: 1px dashed var(--border-medium);
  border-radius: var(--radius-sm);
  user-select: none;
}

.captcha-refresh {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.captcha-refresh:hover {
  color: var(--text-primary);
}

/* Control Panel Layout */
.dashboard-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
  background-color: var(--bg-secondary);
}

.sidebar {
  background-color: var(--bg-card);
  border-right: 1px solid var(--border-light);
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 2rem;
  padding: 0 0.5rem;
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  flex-grow: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 500;
  transition: all 0.15s;
  cursor: pointer;
}

.nav-item:hover, .nav-item.active {
  background-color: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  font-weight: 600;
}

.main-content {
  padding: 2rem;
  overflow-y: auto;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.75rem;
}

.panel-title h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.panel-title p {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* Live Agent Chat Canvas */
.chat-canvas {
  background-color: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  height: calc(100vh - 180px);
  box-shadow: var(--shadow-sm);
}

.chat-messages {
  flex-grow: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.message {
  display: flex;
  gap: 1rem;
  max-width: 85%;
}

.message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.75rem;
  flex-shrink: 0;
}

.avatar.ai {
  background-color: var(--text-primary);
  color: var(--text-inverse);
}

.avatar.user {
  background-color: var(--accent-primary);
  color: var(--text-inverse);
}

.message-content {
  background-color: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 0.875rem 1.125rem;
  font-size: 0.875rem;
  line-height: 1.5;
}

.message.user .message-content {
  background-color: var(--text-primary);
  color: var(--text-inverse);
}

.thought-box {
  background: #f1f5f9;
  border-left: 3px solid var(--accent-primary);
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-family: var(--font-mono);
}

.chat-input-bar {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-light);
  display: flex;
  gap: 0.75rem;
}

.chat-input {
  flex-grow: 1;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  outline: none;
}

.chat-input:focus {
  border-color: var(--text-primary);
}

/* Diff Viewer Box */
.diff-viewer {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  background: #0f172a;
  color: #f8fafc;
  border-radius: var(--radius-md);
  padding: 1rem;
  margin: 1rem 0;
  overflow-x: auto;
}

.diff-line.add { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.diff-line.del { background: rgba(239, 68, 68, 0.2); color: #f87171; }

/* ================================================================
   NexGo Mission Control — dashboard redesign (appended 2026-08-29)
   Ops-grid layout: status strip + 3-panel (conversations | chat | rail)
   Original auth/chat/modal styles above are intentionally untouched.
   ================================================================ */

/* ---- app shell ---- */
.mc-layout {
  display: flex;
  min-height: 100vh;
  background-color: var(--bg-secondary);
}

.sidebar {
  width: 280px;
  flex-shrink: 0;
}

.sidebar-widget {
  margin-top: auto;
  padding: 1rem 0.5rem 0;
  border-top: 1px solid var(--border-light);
}

.widget-label {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}

.widget-btn {
  width: 100%;
}

.nav-pill {
  margin-left: auto;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: #dcfce7;
  color: #16a34a;
  white-space: nowrap;
}

.mc-logo {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: var(--text-primary);
  color: var(--text-inverse);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 0.03em;
  flex-shrink: 0;
}

/* ---- live status strip ---- */
.status-strip {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.625rem 1rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.status-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.status-spacer {
  flex: 1;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #cbd5e1;
  display: inline-block;
  flex-shrink: 0;
}

.status-dot.on   { background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,0.18); }
.status-dot.off  { background: #ef4444; box-shadow: 0 0 0 3px rgba(239,68,68,0.15); }
.status-dot.warn { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245,158,11,0.15); }

.status-text {
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

/* ---- ops grid ---- */
.ops-grid {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 320px;
  gap: 1.25rem;
  align-items: stretch;
  height: calc(100vh - 210px);
  min-height: 480px;
}

.panel-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.col-header h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.btn-sm {
  padding: 0.3rem 0.65rem;
  font-size: 0.78rem;
}

/* ---- conversations column ---- */
.search-input {
  margin-bottom: 0.75rem;
}

.convo-list {
  flex: 1;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.375rem;
  min-height: 0;
}

.convo-empty {
  color: var(--text-secondary);
  font-size: 0.8125rem;
  text-align: center;
  padding: 1.5rem 0.5rem;
}

.convo-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.65rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-primary);
}

.convo-item:hover {
  background: var(--bg-hover);
}

.convo-item.active {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  font-weight: 600;
}

.convo-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.convo-meta {
  font-size: 0.7rem;
  color: var(--text-secondary);
  flex-shrink: 0;
}

/* ---- chat column ---- */
.col-chat .chat-canvas {
  height: auto;
  flex: 1;
  min-height: 0;
}

.col-chat .chat-messages {
  flex: 1;
  min-height: 0;
}

/* ---- rail column ---- */
.rail-status {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
}

#rail-command-slot {
  margin-bottom: 0.25rem;
}

.task-quick {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.task-quick .chat-input {
  flex: 1;
}

.task-list {
  flex: 1;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.375rem;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.task-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  font-size: 0.8rem;
  color: var(--text-primary);
}

.task-item .task-state {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.task-state.todo     { background: #cbd5e1; }
.task-state.doing    { background: #f59e0b; }
.task-state.done     { background: #22c55e; }

.task-item .task-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- role badge on panel header ---- */
.role-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: #eef2ff;
  color: #4f46e5;
  vertical-align: middle;
  margin-left: 0.35rem;
}

/* ---- responsive ---- */
@media (max-width: 1150px) {
  .ops-grid {
    grid-template-columns: 1fr;
    height: auto;
  }
  .convo-list, .task-list {
    max-height: 260px;
  }
  .col-chat .chat-canvas {
    height: 520px;
  }
}
