/* Dashboard layout */
:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #232636;
  --border: #2e3147;
  --text: #e8eaf6;
  --text-muted: #7b7f9e;
  --accent: #6366f1;
  --accent-light: #818cf8;
  --warn: #f59e0b;
  --danger: #ef4444;
  --ok: #22c55e;
  --radius: 10px;
  --font: 'Inter', sans-serif;
}

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

.dash-body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  min-height: 100vh;
}

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-logo {
  font-weight: 700;
  font-size: 18px;
  color: var(--accent-light);
  letter-spacing: -0.5px;
}
.topbar-tag {
  color: var(--text-muted);
  font-size: 13px;
  flex: 1;
}

/* Buttons */
.btn {
  padding: 7px 14px;
  border-radius: 7px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: opacity 0.15s;
}
.btn:hover { opacity: 0.85; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-ghost { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }

/* Stats row */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 20px 24px 0;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
}
.stat-card.warn { border-color: rgba(245,158,11,0.4); }
.stat-card.danger { border-color: rgba(239,68,68,0.4); }
.stat-card.ok { border-color: rgba(34,197,94,0.4); }
.stat-num {
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 4px;
}
.stat-card.warn .stat-num { color: var(--warn); }
.stat-card.danger .stat-num { color: var(--danger); }
.stat-card.ok .stat-num { color: var(--ok); }
.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }

/* Main layout */
.dash-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
  padding: 20px 24px;
}

/* Section headers */
.section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.section-title { font-size: 15px; font-weight: 600; flex: 1; }

/* Inline form */
.inline-form {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.inline-form .form-input { flex: 1; min-width: 140px; }
.hidden { display: none !important; }

/* Form inputs */
.form-input {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  padding: 8px 12px;
  outline: none;
  width: 100%;
  transition: border-color 0.15s;
}
.form-input:focus { border-color: var(--accent); }
select.form-input option { background: var(--surface2); }

/* Project cards */
.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 14px;
  overflow: hidden;
}
.project-header {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  cursor: pointer;
  user-select: none;
  gap: 10px;
}
.project-header:hover { background: var(--surface2); }
.project-name { font-weight: 600; flex: 1; }
.project-desc { font-size: 12px; color: var(--text-muted); flex: 2; }
.project-count { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.chevron { color: var(--text-muted); font-size: 11px; transition: transform 0.2s; }
.chevron.open { transform: rotate(90deg); }

/* Task list */
.task-list { border-top: 1px solid var(--border); }
.task-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: rgba(255,255,255,0.02);
}
.task-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  transition: background 0.1s;
}
.task-row:hover { background: var(--surface2); }
.task-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-todo { background: var(--text-muted); }
.status-in_progress { background: var(--accent); }
.status-blocked { background: var(--danger); }
.status-done { background: var(--ok); }
.status-cancelled { background: var(--border); }

.task-title { flex: 1; font-size: 13px; }
.task-title.done-title { text-decoration: line-through; color: var(--text-muted); }
.task-assignee { font-size: 12px; color: var(--text-muted); white-space: nowrap; max-width: 100px; overflow: hidden; text-overflow: ellipsis; }
.task-due { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.task-due.overdue { color: var(--danger); }
.task-stall-badge {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(245,158,11,0.15);
  color: var(--warn);
  white-space: nowrap;
}
.task-block-badge {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(239,68,68,0.15);
  color: var(--danger);
  white-space: nowrap;
}

.task-actions { display: flex; gap: 6px; }
.task-status-select {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  font-size: 12px;
  padding: 3px 6px;
  cursor: pointer;
  font-family: var(--font);
}
.btn-icon {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 13px;
}
.btn-icon:hover { background: var(--surface2); color: var(--text); }

/* Notifications aside */
.dash-aside {
  position: sticky;
  top: 76px;
  height: calc(100vh - 96px);
  overflow-y: auto;
}
.badge {
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 10px;
  min-width: 22px;
  text-align: center;
}
.monitor-status {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 12px;
  background: rgba(99,102,241,0.1);
  border: 1px solid rgba(99,102,241,0.25);
  color: var(--accent-light);
}
.monitor-status.loading { color: var(--text-muted); background: var(--surface2); border-color: var(--border); }
.monitor-status.error { background: rgba(239,68,68,0.1); border-color: rgba(239,68,68,0.25); color: var(--danger); }

.notif-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.notif-card.type-blocked { border-left: 3px solid var(--danger); }
.notif-card.type-stalled { border-left: 3px solid var(--warn); }
.notif-type {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 5px;
}
.notif-card.type-blocked .notif-type { color: var(--danger); }
.notif-card.type-stalled .notif-type { color: var(--warn); }
.notif-message { font-size: 13px; line-height: 1.5; color: var(--text); }
.notif-meta { font-size: 11px; color: var(--text-muted); margin-top: 6px; }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  width: 420px;
  max-width: 95vw;
}
.modal-title { font-size: 16px; font-weight: 600; margin-bottom: 18px; }
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 12px; font-weight: 500; color: var(--text-muted); margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.3px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-actions { display: flex; gap: 8px; margin-top: 20px; }

.muted-text { color: var(--text-muted); font-size: 13px; padding: 12px 0; }

/* Responsive */
@media (max-width: 900px) {
  .dash-layout { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .dash-aside { position: static; height: auto; }
}
