/* =============================================
   Dashboard Layout
   ============================================= */
.app-shell {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

/* Sidebar */
.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--bg-surface);
  border-right: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  padding: 24px 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px 28px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.brand-icon {
  width: 34px; height: 34px;
  background: var(--accent-dim);
  border: 1px solid rgba(0,212,170,0.3);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--accent);
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  color: var(--fg);
}

.sidebar-nav {
  padding: 20px 12px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--fg-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
}

.nav-item:hover, .nav-item.active {
  background: var(--accent-dim);
  color: var(--accent);
}

.sidebar-footer {
  padding: 16px 20px 0;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.ai-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--fg-muted);
}

.ai-dot {
  width: 8px; height: 8px;
  background: var(--accent);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

/* Main Area */
.main {
  flex: 1;
  padding: 36px 40px;
  overflow-y: auto;
}

/* Header */
.dash-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
}

.dash-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  color: var(--fg);
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.dash-sub {
  font-size: 13px;
  color: var(--fg-muted);
}

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

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  font-family: var(--font-body);
}

.btn-primary {
  background: var(--accent);
  color: #0a0a0f;
}
.btn-primary:hover { background: #00bfa0; transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-ghost {
  background: var(--bg-card);
  color: var(--fg-muted);
  border: 1px solid rgba(255,255,255,0.08);
}
.btn-ghost:hover { color: var(--fg); border-color: rgba(255,255,255,0.15); }

/* Stats Bar */
.stats-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 28px;
}

.stat-pill {
  background: var(--bg-surface);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 110px;
}

.stat-num {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  color: var(--fg);
  line-height: 1;
}

.stat-label {
  font-size: 12px;
  color: var(--fg-muted);
}

/* Task List */
.task-list-container {
  background: var(--bg-surface);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 16px;
  overflow: hidden;
}

.task-list-header {
  display: grid;
  grid-template-columns: 36px 1fr 90px 120px 110px 110px 48px;
  padding: 12px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-muted);
}

.task-list {
  min-height: 120px;
}

/* Task Row */
.task-row {
  display: grid;
  grid-template-columns: 36px 1fr 90px 120px 110px 110px 48px;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  align-items: center;
  transition: background 0.1s;
}

.task-row:last-child { border-bottom: none; }
.task-row:hover { background: rgba(255,255,255,0.02); }
.task-row.done { opacity: 0.45; }

.col-rank {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: var(--fg-muted);
}

.task-main { overflow: hidden; }

.task-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.task-row.done .task-title { text-decoration: line-through; color: var(--fg-muted); }

.task-meta {
  font-size: 11px;
  color: var(--fg-muted);
}

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

/* AI Score */
.score-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.score-bar-wrap {
  flex: 1;
  max-width: 50px;
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  overflow: hidden;
}

.score-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.4s ease;
}

.score-num {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  min-width: 26px;
  text-align: right;
}

/* Score color bands */
.score-critical .score-num  { color: var(--danger); }
.score-critical .score-bar-fill { background: var(--danger); }
.score-high .score-num      { color: var(--warning); }
.score-high .score-bar-fill { background: var(--warning); }
.score-medium .score-num    { color: var(--accent); }
.score-medium .score-bar-fill { background: var(--accent); }
.score-low .score-num       { color: var(--fg-muted); }
.score-low .score-bar-fill  { background: var(--fg-muted); }

/* Deadline */
.deadline-cell { font-size: 13px; }
.deadline-overdue { color: var(--danger); font-weight: 600; }
.deadline-soon    { color: var(--warning); font-weight: 600; }
.deadline-normal  { color: var(--fg-muted); }
.deadline-none    { color: rgba(255,255,255,0.2); }

/* Team badge */
.team-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(255,255,255,0.06);
  color: var(--fg-muted);
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Status select */
.status-select {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  color: var(--fg-muted);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 8px;
  cursor: pointer;
  font-family: var(--font-body);
  width: 100px;
}
.status-select:focus { outline: 1px solid var(--accent); }
.status-select.todo        { color: var(--fg-muted); }
.status-select.in_progress { color: var(--warning); border-color: rgba(255,217,61,0.3); }
.status-select.done        { color: var(--success); border-color: rgba(107,203,119,0.3); }

/* Delete button */
.btn-delete {
  background: none;
  border: none;
  color: rgba(255,255,255,0.2);
  cursor: pointer;
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.1s;
}
.btn-delete:hover { color: var(--danger); background: rgba(255,107,107,0.1); }

/* Reasoning tooltip */
.task-reasoning {
  font-size: 11px;
  color: var(--accent);
  margin-top: 3px;
  font-style: italic;
  opacity: 0.8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 400px;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--fg-muted);
}
.empty-icon { margin-bottom: 14px; opacity: 0.3; }
.empty-state p { font-size: 14px; }

/* Toast */
.toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: var(--bg-card);
  border: 1px solid rgba(0,212,170,0.3);
  color: var(--fg);
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.2s;
  pointer-events: none;
  z-index: 9999;
  max-width: 320px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { border-color: rgba(255,107,107,0.4); }

/* Spinner inside button */
.spin {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid rgba(10,10,15,0.3);
  border-top-color: #0a0a0f;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

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

.modal {
  background: var(--bg-surface);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px;
  width: 100%;
  max-width: 520px;
  padding: 28px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.modal-header h2 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--fg);
}

.modal-close {
  background: none; border: none;
  color: var(--fg-muted); font-size: 18px;
  cursor: pointer; width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: rgba(255,255,255,0.06); color: var(--fg); }

.form-row { margin-bottom: 16px; }
.form-row label { display: block; font-size: 12px; font-weight: 600; color: var(--fg-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.05em; }
.required { color: var(--accent); }

.form-row input,
.form-row textarea,
.form-row select {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 14px;
  padding: 10px 14px;
  outline: none;
  transition: border-color 0.15s;
}
.form-row input:focus,
.form-row textarea:focus { border-color: var(--accent); }

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.slider-row {
  display: flex; align-items: center; gap: 12px;
}
.slider-row input[type=range] {
  flex: 1; padding: 0;
  accent-color: var(--accent);
  cursor: pointer;
}
.slider-val {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
  min-width: 16px;
  text-align: center;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

/* Responsive */
@media (max-width: 900px) {
  .sidebar { display: none; }
  .main { padding: 24px 20px; }
  .task-list-header,
  .task-row {
    grid-template-columns: 28px 1fr 70px 0 0 90px 40px;
  }
  .col-deadline, .col-team,
  .deadline-cell, .team-badge { display: none; }
  .dash-header { flex-direction: column; gap: 16px; }
  .stats-bar { flex-wrap: wrap; }
  .form-grid-2 { grid-template-columns: 1fr; }
}
