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

:root {
  --bg: #f8f9fa;
  --sidebar-bg: #1a1d23;
  --sidebar-text: #9ca3af;
  --sidebar-active: #ffffff;
  --sidebar-hover: #374151;
  --card-bg: #ffffff;
  --border: #e5e7eb;
  --text: #111827;
  --text-muted: #6b7280;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --danger: #ef4444;
  --warning: #f59e0b;
  --success: #10b981;
  --purple: #8b5cf6;
  --radius: 8px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

/* Login page */
.login-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; background: var(--sidebar-bg);
}
.login-card {
  background: var(--card-bg); padding: 2.5rem; border-radius: var(--radius);
  width: 100%; max-width: 400px; box-shadow: 0 4px 24px rgba(0,0,0,0.3);
}
.login-card h1 { text-align: center; margin-bottom: 1.5rem; font-size: 1.5rem; }

/* App layout */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px; background: var(--sidebar-bg); color: var(--sidebar-text);
  display: flex; flex-direction: column; position: fixed; height: 100vh;
  overflow-y: auto;
}
.sidebar-header { padding: 1.5rem; border-bottom: 1px solid #374151; }
.sidebar-header h2 { color: #fff; font-size: 1.25rem; margin: 0; }
.sidebar-header .subtitle { font-size: 0.8rem; color: var(--sidebar-text); }

.sidebar nav { flex: 1; padding: 0.5rem 0; }
.nav-item {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.65rem 1.5rem; color: var(--sidebar-text);
  text-decoration: none; font-size: 0.9rem; transition: all 0.15s;
}
.nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item.active { color: #fff; background: var(--primary); }
.nav-icon { font-size: 0.5rem; }

.sidebar-footer {
  padding: 1rem 1.5rem; border-top: 1px solid #374151;
  display: flex; justify-content: space-between; align-items: center; font-size: 0.85rem;
}
.sidebar-footer a { color: var(--sidebar-text); text-decoration: none; }
.sidebar-footer a:hover { color: #fff; }

.content { margin-left: 240px; flex: 1; padding: 2rem; }

/* Page header */
.page-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1.5rem;
}
.page-header h1 { font-size: 1.5rem; font-weight: 600; }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.card {
  background: var(--card-bg); border-radius: var(--radius); padding: 1.25rem;
  border: 1px solid var(--border); box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.card-value { font-size: 2rem; font-weight: 700; }
.card-label { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.25rem; }
.card.danger .card-value { color: var(--danger); }
.card.warning .card-value { color: var(--warning); }
.card.success .card-value { color: var(--success); }
.card.info .card-value { color: var(--primary); }

/* Tables */
.table-wrap { background: var(--card-bg); border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
thead { background: #f9fafb; }
th { text-align: left; padding: 0.75rem 1rem; font-size: 0.8rem; font-weight: 600; text-transform: uppercase; color: var(--text-muted); border-bottom: 1px solid var(--border); }
td { padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
tr:last-child td { border-bottom: none; }
tr:hover { background: #f9fafb; }
tr.row-done { opacity: 0.45; background: #f0fdf4; }
tr.row-done td:first-child { border-left: 3px solid var(--success); }
tr.row-done .task-title { color: var(--text-muted); }
.status-icon { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; font-size: 0.65rem; margin-right: 0.5rem; vertical-align: middle; flex-shrink: 0; }
.status-icon-new { background: #dbeafe; color: #1d4ed8; }
.status-icon-in_progress { background: #fef3c7; color: #92400e; }
.status-icon-done { background: #d1fae5; color: #065f46; }
.status-icon-suspended { background: #e5e7eb; color: #374151; }
.status-icon-cancelled { background: #fee2e2; color: #991b1b; }
tr.row-clickable { cursor: pointer; }

/* Badges */
.badge {
  display: inline-block; padding: 0.15rem 0.6rem; border-radius: 99px;
  font-size: 0.75rem; font-weight: 600; text-transform: uppercase;
}
.badge-new { background: #dbeafe; color: #1d4ed8; }
.badge-in_progress { background: #fef3c7; color: #92400e; }
.badge-done { background: #d1fae5; color: #065f46; }
.badge-suspended { background: #e5e7eb; color: #374151; }
.badge-cancelled { background: #fee2e2; color: #991b1b; }
.badge-urgent { background: #fee2e2; color: #991b1b; }
.badge-normal { background: #dbeafe; color: #1d4ed8; }
.badge-low { background: #e5e7eb; color: #374151; }
.badge-overdue { background: #fee2e2; color: #991b1b; }
.badge-today { background: #fef3c7; color: #92400e; }
.badge-upcoming { background: #dbeafe; color: #1d4ed8; }

/* Type badge (dynamic color via inline style) */
.badge-type { color: #fff; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.5rem 1rem; border: none; border-radius: var(--radius);
  font-size: 0.875rem; font-weight: 500; cursor: pointer; transition: all 0.15s;
  text-decoration: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-secondary:hover { background: #d1d5db; }
.btn-sm { padding: 0.3rem 0.65rem; font-size: 0.8rem; }
.btn-full { width: 100%; justify-content: center; }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 500; margin-bottom: 0.35rem; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 0.5rem 0.75rem; border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 0.9rem; font-family: inherit;
}
.form-group textarea { resize: vertical; min-height: 80px; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* Alert */
.alert { padding: 0.75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: 0.9rem; }
.alert-error { background: #fee2e2; color: #991b1b; }
.alert-success { background: #d1fae5; color: #065f46; }

/* Modal */
.modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 100; align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--card-bg); border-radius: var(--radius); padding: 1.5rem;
  width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.modal-header h2 { font-size: 1.15rem; }
.modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--text-muted); }
.modal-actions { display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 1.5rem; }

/* Filters bar */
.filters { display: flex; gap: 0.75rem; margin-bottom: 1rem; flex-wrap: wrap; align-items: center; }
.filters select, .filters input {
  padding: 0.4rem 0.65rem; border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 0.85rem; font-family: inherit;
}

/* Status select inline */
.status-select {
  padding: 0.2rem 0.4rem; border: 1px solid var(--border); border-radius: 4px;
  font-size: 0.8rem; cursor: pointer; background: transparent;
}

/* Activity list */
.activity-list { list-style: none; }
.activity-item { padding: 0.6rem 0; border-bottom: 1px solid var(--border); font-size: 0.85rem; }
.activity-item:last-child { border-bottom: none; }
.activity-time { color: var(--text-muted); font-size: 0.8rem; }

/* Comments */
.comment { padding: 0.75rem; background: #f9fafb; border-radius: var(--radius); margin-bottom: 0.5rem; }
.comment-meta { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.25rem; }

/* Dashboard table fixed columns */
.dashboard-table { table-layout: fixed; }
.dashboard-table .col-task { width: 35%; }
.dashboard-table .col-client { width: 15%; }
.dashboard-table .col-tip { width: 12%; }
.dashboard-table .col-priority { width: 12%; }
.dashboard-table .col-deadline { width: 13%; }
.dashboard-table .col-assigned { width: 13%; }

/* Pagination */
.pagination { display: flex; align-items: center; justify-content: center; gap: 0.75rem; padding: 0.75rem 1rem; border-top: 1px solid var(--border); }
.pagination-info { font-size: 0.85rem; color: var(--text-muted); }

/* Utility */
.text-muted { color: var(--text-muted); }
.mt-1 { margin-top: 1rem; }
.mb-1 { margin-bottom: 1rem; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
