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

:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface2: #334155;
  --surface3: #475569;
  --border: rgba(255,255,255,0.08);
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --danger: #ef4444;
  --warning: #f59e0b;
  --success: #10b981;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

.hidden { display: none !important; }

/* ─── Auth Screen ──────────────────────────────────────────────────────────── */
.auth-overlay {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
  padding: 20px;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow);
}

.auth-logo {
  text-align: center;
  margin-bottom: 32px;
}

.logo-icon { font-size: 48px; display: block; margin-bottom: 8px; }
.auth-logo h1 { font-size: 28px; font-weight: 700; color: var(--text); }
.auth-logo p { color: var(--text-muted); margin-top: 4px; font-size: 14px; }

.auth-tabs {
  display: flex;
  background: var(--surface2);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 28px;
  gap: 4px;
}

.auth-tab {
  flex: 1;
  padding: 10px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
}

.auth-tab.active {
  background: var(--primary);
  color: white;
}

/* ─── Forms ────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; color: var(--text-muted); margin-bottom: 6px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="date"], textarea, select {
  width: 100%;
  padding: 10px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}

textarea { resize: vertical; }
select option { background: var(--surface2); }

.form-hint { display: block; font-size: 11px; color: var(--text-muted); margin-top: 4px; }

.deadline-field input[type="date"] {
  border-color: rgba(99,102,241,0.4);
  background: rgba(99,102,241,0.05);
}

.deadline-field label {
  color: var(--text) !important;
  font-weight: 600 !important;
}
.form-error { color: var(--danger); font-size: 13px; margin-bottom: 12px; min-height: 18px; }

.color-picker {
  display: flex;
  align-items: center;
  gap: 10px;
}

.color-picker input[type="color"] {
  width: 44px;
  height: 44px;
  padding: 2px;
  border-radius: 8px;
  cursor: pointer;
  flex-shrink: 0;
}

.color-picker span { font-size: 13px; color: var(--text-muted); }

/* ─── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-full { width: 100%; justify-content: center; }
.btn-sm { padding: 7px 14px; font-size: 13px; }

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); }

.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--surface3); }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; }

.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #059669; }

.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface2); color: var(--text); }

/* ─── Header ────────────────────────────────────────────────────────────────── */
.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-left .logo-icon { font-size: 24px; }
.logo-text { font-size: 18px; font-weight: 700; }

.header-center { display: flex; gap: 4px; }

.view-btn {
  padding: 6px 16px;
  border: 1px solid transparent;
  border-radius: 20px;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.view-btn.active {
  background: var(--surface2);
  border-color: var(--border);
  color: var(--text);
}

.view-btn:hover:not(.active) { color: var(--text); }

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 12px 4px 6px;
}

#user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

#user-name-header { font-size: 13px; font-weight: 500; }

/* ─── Board ─────────────────────────────────────────────────────────────────── */
.board-container {
  padding: 24px;
  max-width: 1400px;
  margin: 0 auto;
}

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

.board-header h2 { font-size: 20px; font-weight: 600; }

.columns {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  align-items: start;
}

.column {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 200px;
}

.column-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  font-weight: 600;
}

.column-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-todo { background: var(--text-muted); }
.dot-progress { background: var(--primary); }
.dot-done { background: var(--success); }

.column-count {
  margin-left: auto;
  background: var(--surface2);
  color: var(--text-muted);
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 600;
}

.cards-list {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 60px;
}

.cards-list.drag-over { background: rgba(99,102,241,0.05); border-radius: 8px; }

/* ─── Task Card ─────────────────────────────────────────────────────────────── */
.task-card {
  background: var(--surface2);
  border-radius: var(--radius-sm);
  padding: 14px;
  cursor: grab;
  transition: transform 0.15s, box-shadow 0.15s;
  position: relative;
  overflow: hidden;
  border: 1px solid transparent;
}

.task-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--card-color, var(--primary));
  border-radius: 4px 0 0 4px;
}

.task-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.task-card:active { cursor: grabbing; }
.task-card.dragging { opacity: 0.5; transform: rotate(2deg); }

/* Urgência: cor de fundo muda conforme prazo */
.task-card.urgent-critical {
  background: rgba(239,68,68,0.15);
  border-color: rgba(239,68,68,0.3);
  animation: pulse-red 2s infinite;
}

.task-card.urgent-high {
  background: rgba(245,158,11,0.12);
  border-color: rgba(245,158,11,0.25);
}

.task-card.urgent-medium {
  background: rgba(234,179,8,0.08);
  border-color: rgba(234,179,8,0.15);
}

@keyframes pulse-red {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.3); }
  50% { box-shadow: 0 0 0 4px rgba(239,68,68,0.1); }
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  flex: 1;
}

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

.card-priority {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.priority-high { background: rgba(239,68,68,0.2); color: #fca5a5; }
.priority-medium { background: rgba(245,158,11,0.2); color: #fcd34d; }
.priority-low { background: rgba(16,185,129,0.2); color: #6ee7b7; }

.card-description {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card-deadline {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 500;
}

.deadline-icon { font-size: 12px; }

.deadline-ok { color: var(--success); }
.deadline-warn { color: var(--warning); }
.deadline-danger { color: var(--danger); }
.deadline-overdue { color: var(--danger); font-weight: 700; }
.deadline-done { color: var(--text-muted); }

.card-days-bar {
  width: 100%;
  height: 3px;
  background: var(--surface3);
  border-radius: 2px;
  margin: 8px 0;
  overflow: hidden;
}

.card-days-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s;
}

.card-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.card-btn {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: var(--surface3);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: all 0.15s;
}

.card-btn:hover { background: var(--primary); color: white; }
.card-btn.complete-btn:hover { background: var(--success); color: white; }
.card-btn.delete-btn:hover { background: var(--danger); color: white; }

/* Done column cards */
#list-done .task-card { opacity: 0.7; }
#list-done .task-card:hover { opacity: 1; }

/* ─── All Users View ────────────────────────────────────────────────────────── */
.users-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}

.user-column {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.user-column-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}

.user-avatar-sm {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.user-col-name { font-size: 14px; font-weight: 600; }
.user-col-count { margin-left: auto; font-size: 12px; color: var(--text-muted); }

.user-col-tasks { padding: 12px; display: flex; flex-direction: column; gap: 10px; min-height: 60px; }

.empty-state {
  text-align: center;
  padding: 30px 20px;
  color: var(--text-muted);
  font-size: 13px;
}

.empty-state-icon { font-size: 32px; display: block; margin-bottom: 8px; }

/* ─── Modals ────────────────────────────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
}

.modal-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  animation: modal-in 0.2s ease;
}

.modal-wide { max-width: 640px; }
.modal-fullscreen { max-width: 900px; width: 100%; }

@keyframes modal-in {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-header h3 { font-size: 16px; font-weight: 600; }

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--surface2);
  color: var(--text-muted);
  border-radius: 8px;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.modal-close:hover { background: var(--danger); color: white; }

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-shrink: 0;
}

.modal-info {
  font-size: 13px;
  color: var(--text-muted);
  background: var(--surface2);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 18px;
  line-height: 1.6;
}

.report-result {
  margin-top: 16px;
  padding: 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.6;
}

.report-result.success { background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.3); color: #6ee7b7; }
.report-result.error { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); color: #fca5a5; }
.report-result.info { background: rgba(99,102,241,0.1); border: 1px solid rgba(99,102,241,0.3); color: #a5b4fc; }

/* ─── Detail Modal ──────────────────────────────────────────────────────────── */
.detail-header-bar {
  height: 6px;
  border-radius: 3px;
  margin-bottom: 16px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.detail-item label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.detail-item span {
  font-size: 14px;
  font-weight: 500;
}

.detail-desc {
  background: var(--surface2);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 16px;
}

/* ─── Urgency Tag ───────────────────────────────────────────────────────────── */
.urgency-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.urgency-ok { background: rgba(16,185,129,0.15); color: #6ee7b7; }
.urgency-soon { background: rgba(234,179,8,0.15); color: #fde68a; }
.urgency-urgent { background: rgba(245,158,11,0.2); color: #fcd34d; }
.urgency-critical { background: rgba(239,68,68,0.2); color: #fca5a5; }
.urgency-overdue { background: rgba(239,68,68,0.3); color: #fca5a5; font-weight: 800; }
.urgency-done { background: rgba(16,185,129,0.1); color: #6ee7b7; }

/* ─── General Report ────────────────────────────────────────────────────────── */
.gr-loading { text-align: center; padding: 40px; color: var(--text-muted); }

.gr-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.gr-stat {
  background: var(--surface2);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
}

.gr-stat-num { font-size: 28px; font-weight: 700; display: block; }
.gr-stat-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; display: block; }

.gr-user-block { margin-bottom: 28px; }

.gr-user-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--border);
}

.gr-user-name { font-size: 15px; font-weight: 600; flex: 1; }
.gr-user-stats { font-size: 12px; color: var(--text-muted); }

.gr-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.gr-table th {
  background: var(--surface2);
  padding: 8px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.gr-table th:last-child { text-align: center; }

.gr-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.gr-table td:last-child { text-align: center; }

.gr-table tr:last-child td { border-bottom: none; }

.gr-table tr:hover td { background: rgba(255,255,255,0.02); }

.gr-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.gr-status-done     { background: rgba(16,185,129,0.15); color: #6ee7b7; }
.gr-status-progress { background: rgba(99,102,241,0.15); color: #a5b4fc; }
.gr-status-todo     { background: rgba(148,163,184,0.15); color: #94a3b8; }
.gr-status-overdue  { background: rgba(239,68,68,0.2); color: #fca5a5; }
.gr-status-urgent   { background: rgba(245,158,11,0.2); color: #fcd34d; }

.gr-no-tasks { color: var(--text-muted); font-style: italic; padding: 12px; font-size: 13px; }

@media print {
  .modal-overlay, .modal-header button, .modal-footer { display: none !important; }
  .modal-card { box-shadow: none; border: none; max-width: 100%; }
  body { background: white; color: black; }
  .gr-table th { background: #eee; color: #333; }
  .gr-stat { background: #f5f5f5; }
}

/* ─── Scrollbar ─────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ─── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .columns { grid-template-columns: 1fr; }
  .header-center { display: none; }
  .board-container { padding: 16px; }
  .form-row { grid-template-columns: 1fr; }
}
