:root {
  --sidebar-w: 240px;
  --blue:    #3b82f6;
  --green:   #10b981;
  --amber:   #f59e0b;
  --red:     #ef4444;
  --purple:  #8b5cf6;
  --slate:   #0f172a;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f1f5f9;
  color: #1e293b;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  position: fixed;
  top: 0; left: 0;
  background: #0f172a;
  display: flex;
  flex-direction: column;
  z-index: 100;
  box-shadow: 4px 0 24px rgba(0,0,0,.2);
}

#main-content {
  margin-left: var(--sidebar-w);
  width: calc(100% - var(--sidebar-w));
  min-height: 100vh;
  padding: 28px;
  box-sizing: border-box;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: #94a3b8;
  border-radius: 8px;
  margin: 2px 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background .15s, color .15s;
}
.nav-link:hover  { background: #1e293b; color: #e2e8f0; }
.nav-link.active { background: var(--blue); color: #fff; }

/* ── Auth ────────────────────────────────────────────────────────────────── */
#auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0f172a 100%);
}

.auth-card {
  background: #fff;
  border-radius: 20px;
  padding: 40px 36px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 30px 90px rgba(0,0,0,.4);
  animation: slideUp .3s ease;
}

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: #fff;
  border-radius: 14px;
  padding: 22px;
  box-shadow: 0 1px 4px rgba(0,0,0,.07);
}

/* ── Stat Cards ──────────────────────────────────────────────────────────── */
.stat-card {
  background: #fff;
  border-radius: 14px;
  padding: 20px 22px;
  box-shadow: 0 1px 4px rgba(0,0,0,.07);
  position: relative;
  overflow: hidden;
  transition: transform .2s, box-shadow .2s;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,.12); }
.stat-card .accent-bar {
  position: absolute;
  top: 0; left: 0;
  width: 4px; height: 100%;
  border-radius: 14px 0 0 14px;
}
.stat-card .stat-value {
  font-size: 32px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1;
  margin: 8px 0 4px;
}
.stat-card .stat-label {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* ── Progress Ring ───────────────────────────────────────────────────────── */
.progress-ring-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}
.progress-ring circle { transition: stroke-dasharray 1.2s cubic-bezier(.4,0,.2,1); }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity .15s, transform .1s, box-shadow .15s;
  white-space: nowrap;
  font-family: inherit;
}
.btn:hover   { opacity: .88; }
.btn:active  { transform: scale(.97); }
.btn-primary { background: var(--blue); color: #fff; box-shadow: 0 2px 8px rgba(59,130,246,.35); }
.btn-danger  { background: var(--red);  color: #fff; }
.btn-ghost   { background: transparent; color: #64748b; border: 1.5px solid #e2e8f0; }
.btn-success { background: var(--green); color: #fff; }
.btn-sm { padding: 6px 14px; font-size: 13px; }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: #374151; margin-bottom: 5px; }

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid #e2e8f0;
  border-radius: 9px;
  font-size: 14px;
  color: #1e293b;
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
  font-family: inherit;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}
.form-textarea { resize: vertical; min-height: 80px; }

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  animation: fadeIn .15s ease;
  backdrop-filter: blur(2px);
}
.modal-box {
  background: #fff;
  border-radius: 18px;
  padding: 28px;
  width: 100%; max-width: 500px;
  box-shadow: 0 24px 72px rgba(0,0,0,.25);
  animation: slideUp .2s ease;
}

/* ── Table ───────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left; padding: 10px 14px;
  font-size: 11px; font-weight: 700; color: #94a3b8;
  text-transform: uppercase; letter-spacing: .06em;
  border-bottom: 1px solid #f1f5f9; background: #fafafa;
}
td { padding: 12px 14px; border-bottom: 1px solid #f8fafc; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafafe; }

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px; font-weight: 700;
  white-space: nowrap; letter-spacing: .03em;
}
.badge-todo     { background: #f1f5f9; color: #64748b; }
.badge-progress { background: #dbeafe; color: #1d4ed8; }
.badge-done     { background: #dcfce7; color: #15803d; }
.badge-low      { background: #f0fdf4; color: #16a34a; }
.badge-medium   { background: #fef9c3; color: #a16207; }
.badge-high     { background: #fee2e2; color: #dc2626; }
.badge-admin    { background: #f3e8ff; color: #7c3aed; }
.badge-member   { background: #e0f2fe; color: #0369a1; }
.badge-overdue  { background: #fee2e2; color: #dc2626; }

/* ── Project Cards Grid ──────────────────────────────────────────────────── */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 18px;
}

.project-card {
  background: #fff;
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,.07);
  cursor: pointer;
  transition: transform .2s, box-shadow .2s, border-color .2s;
  border: 2px solid transparent;
  position: relative;
}
.project-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 28px rgba(0,0,0,.13);
  border-color: var(--blue);
}

.project-progress-bar {
  width: 100%; height: 6px;
  background: #f1f5f9;
  border-radius: 10px;
  overflow: hidden;
  margin-top: 12px;
}
.project-progress-fill {
  height: 100%;
  border-radius: 10px;
  transition: width 1s cubic-bezier(.4,0,.2,1);
}

/* ── Kanban Board ────────────────────────────────────────────────────────── */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  align-items: start;
}

.kanban-col {
  background: #f8fafc;
  border-radius: 14px;
  padding: 14px;
  min-height: 200px;
  transition: background .15s;
}
.kanban-col.drag-over { background: #eff6ff; outline: 2px dashed var(--blue); }

.kanban-col-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
  padding: 0 4px;
}
.kanban-col-title {
  font-size: 13px; font-weight: 700;
  color: #374151;
  display: flex; align-items: center; gap: 8px;
}
.kanban-col-dot {
  width: 10px; height: 10px; border-radius: 50%;
}
.kanban-count {
  font-size: 12px; font-weight: 700;
  background: #e2e8f0; color: #64748b;
  padding: 2px 8px; border-radius: 20px;
}

.kanban-card {
  background: #fff;
  border-radius: 10px;
  margin-bottom: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
  cursor: grab;
  transition: transform .15s, box-shadow .15s, opacity .15s;
  border-left: 4px solid #e2e8f0;
  position: relative;
  overflow: hidden;
}
.kanban-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0,0,0,.13);
}
.kanban-card.dragging { opacity: .45; transform: rotate(2deg); cursor: grabbing; }
.kanban-card.priority-high   { border-left-color: var(--red); }
.kanban-card.priority-medium { border-left-color: var(--amber); }
.kanban-card.priority-low    { border-left-color: var(--green); }

.kanban-card-body { padding: 12px 14px; }
.kanban-card-title { font-size: 13px; font-weight: 600; color: #0f172a; margin-bottom: 4px; line-height: 1.4; }
.kanban-card-desc  { font-size: 12px; color: #94a3b8; margin-bottom: 10px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.kanban-card-footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px; }

.kanban-card-actions {
  position: absolute; top: 8px; right: 8px;
  display: none; gap: 4px;
}
.kanban-card:hover .kanban-card-actions { display: flex; }
.kanban-card-actions button {
  padding: 3px 7px; font-size: 10px;
  border: none; border-radius: 5px; cursor: pointer;
  background: #f1f5f9; color: #64748b;
  transition: background .1s;
}
.kanban-card-actions button:hover { background: #e2e8f0; }

/* ── Tabs ────────────────────────────────────────────────────────────────── */
.tab-bar { display: flex; gap: 4px; border-bottom: 2px solid #e2e8f0; margin-bottom: 20px; }
.tab-btn {
  padding: 10px 20px; font-size: 14px; font-weight: 600;
  color: #64748b; cursor: pointer; border: none; background: none;
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: color .15s, border-color .15s; font-family: inherit;
}
.tab-btn.active { color: var(--blue); border-color: var(--blue); }
.tab-btn:hover:not(.active) { color: #1e293b; }

/* ── View Toggle ─────────────────────────────────────────────────────────── */
.view-toggle {
  display: flex;
  background: #f1f5f9;
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}
.view-toggle-btn {
  padding: 6px 12px; border: none; border-radius: 6px;
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: all .15s; color: #64748b; background: none;
  display: flex; align-items: center; gap: 5px; font-family: inherit;
}
.view-toggle-btn.active { background: #fff; color: #0f172a; box-shadow: 0 1px 4px rgba(0,0,0,.1); }

/* ── Toast ───────────────────────────────────────────────────────────────── */
#toast { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast-msg {
  padding: 12px 20px; border-radius: 10px;
  font-size: 14px; font-weight: 600; color: #fff;
  box-shadow: 0 4px 16px rgba(0,0,0,.18);
  animation: slideUp .2s ease, fadeOut .3s ease 2.7s forwards;
  max-width: 340px; display: flex; align-items: center; gap: 8px;
}
.toast-success { background: #10b981; }
.toast-error   { background: #ef4444; }
.toast-info    { background: #3b82f6; }

/* ── Empty State ─────────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 48px 20px; color: #94a3b8; }
.empty-state i { font-size: 44px; margin-bottom: 14px; display: block; }
.empty-state h3 { font-size: 16px; font-weight: 700; color: #64748b; margin-bottom: 6px; }
.empty-state p { font-size: 13px; }

/* ── Due date chips ──────────────────────────────────────────────────────── */
.due-chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600; padding: 2px 8px;
  border-radius: 20px; white-space: nowrap;
}
.due-ok      { background: #f0fdf4; color: #16a34a; }
.due-soon    { background: #fef9c3; color: #a16207; }
.due-today   { background: #fff7ed; color: #c2410c; }
.due-overdue { background: #fee2e2; color: #dc2626; }
.due-none    { background: #f1f5f9; color: #94a3b8; }

/* ── Avatar ──────────────────────────────────────────────────────────────── */
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--blue); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; flex-shrink: 0;
}
.avatar-sm { width: 24px; height: 24px; font-size: 10px; }

/* ── Misc Layout ─────────────────────────────────────────────────────────── */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 22px; flex-wrap: wrap; gap: 12px;
}
.page-title { font-size: 22px; font-weight: 800; color: #0f172a; }
.text-muted { color: #94a3b8; font-size: 13px; }

.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; }
.filter-bar select, .filter-bar input {
  padding: 7px 12px;
  border: 1.5px solid #e2e8f0; border-radius: 9px;
  font-size: 13px; color: #374151; background: #fff; outline: none; font-family: inherit;
}
.filter-bar select:focus, .filter-bar input:focus { border-color: var(--blue); }

/* ── Animations ──────────────────────────────────────────────────────────── */
@keyframes fadeIn  { from { opacity: 0 } to { opacity: 1 } }
@keyframes slideUp { from { transform: translateY(18px); opacity: 0 } to { transform: translateY(0); opacity: 1 } }
@keyframes fadeOut { to { opacity: 0; transform: translateX(10px) } }
@keyframes countUp { from { opacity: 0; transform: translateY(10px) } to { opacity: 1; transform: translateY(0) } }

.animate-in { animation: slideUp .25s ease both; }

/* ── Dashboard grid ──────────────────────────────────────────────────────── */
.dash-stats-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
  margin-bottom: 26px;
}

@media (max-width: 1100px) {
  .dash-stats-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 700px) {
  .dash-stats-grid { grid-template-columns: repeat(2, 1fr); }
}

.dash-bottom-grid {
  display: grid;
  grid-template-columns: minmax(300px, 360px) 1fr;
  gap: 20px;
}

@media (max-width: 900px) {
  .dash-bottom-grid { grid-template-columns: 1fr; }
  .kanban-board { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  #sidebar { transform: translateX(-100%); }
  #main-content { margin-left: 0; }
}
