/* ============================================================
   JraSimples — Estilos customizados sobre Bootstrap 5
   ============================================================ */

:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --sidebar-bg: #0f172a;
  --sidebar-text: #94a3b8;
  --sidebar-active: #e2e8f0;
  --card-bg: #ffffff;
  --body-bg: #f1f5f9;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --danger: #ef4444;
  --warning: #f59e0b;
  --success: #10b981;
  --info: #06b6d4;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  background: var(--body-bg);
  color: var(--text);
  font-size: 14px;
}

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

/* ── SIDEBAR ── */
.sidebar {
  width: 240px;
  min-width: 240px;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  padding: 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: width .22s ease;
  overflow: hidden;
}

.sidebar-logo {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
}

.sidebar-logo .brand {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-logo .brand span {
  color: var(--primary);
}

.sidebar nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}

.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 13.5px;
  transition: all .15s;
  border-radius: 0;
}

.sidebar nav a:hover,
.sidebar nav a.active {
  color: var(--sidebar-active);
  background: rgba(255,255,255,.06);
}

.sidebar nav a.active {
  border-left: 3px solid var(--primary);
  padding-left: 17px;
}

.sidebar nav a i { width: 18px; text-align: center; }

.sidebar-section {
  padding: 8px 20px 4px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: rgba(148,163,184,.5);
  margin-top: 8px;
}

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

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--sidebar-text);
}

.sidebar-user .avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 12px; font-weight: 600;
  flex-shrink: 0;
}

.sidebar-user .user-info { overflow: hidden; }
.sidebar-user .user-name { font-size: 13px; color: #e2e8f0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .user-role { font-size: 11px; color: var(--sidebar-text); }

/* ── SIDEBAR TOGGLE ── */
.sidebar-toggle {
  background: none;
  border: none;
  color: rgba(148,163,184,.6);
  cursor: pointer;
  padding: 5px 7px;
  border-radius: 6px;
  font-size: 15px;
  line-height: 1;
  transition: color .15s, background .15s;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}
.sidebar-toggle:hover { color: #fff; background: rgba(255,255,255,.1); }

/* ── SIDEBAR COLLAPSED ── */
.sidebar.collapsed { width: 60px; min-width: 60px; }
.sidebar.collapsed .sidebar-logo { justify-content: center; padding: 16px 0; }
.sidebar.collapsed .sidebar-logo .brand { display: none; }
.sidebar.collapsed .sidebar-section { display: none; }
.sidebar.collapsed nav a { padding: 10px; justify-content: center; }
.sidebar.collapsed nav a.active { border-left: 3px solid var(--primary); padding-left: 7px; }
.sidebar.collapsed nav a span { display: none; }
.sidebar.collapsed .sidebar-user .user-info { display: none; }
.sidebar.collapsed .sidebar-user { justify-content: center; }
.sidebar.collapsed .sidebar-footer { padding: 12px 8px; flex-direction: column; align-items: center; gap: 8px; }
.sidebar.collapsed .sidebar-footer .w-100 { width: auto !important; }
.sidebar.collapsed .sidebar-footer .btn span { display: none; }
.sidebar.collapsed .sidebar-footer .btn { padding: 6px 8px; }

/* ── MAIN CONTENT ── */
.main-content {
  margin-left: 240px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left .22s ease;
}

.topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky; top: 0;
  z-index: 50;
}

.topbar .page-title { font-size: 16px; font-weight: 600; color: var(--text); }

.page-body {
  padding: 24px;
  flex: 1;
}

/* ── CARDS ── */
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
}

.stat-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  padding: 20px;
}

.stat-card .stat-value {
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  margin: 8px 0 4px;
}

.stat-card .stat-label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}

.stat-card .stat-icon {
  width: 40px; height: 40px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}

/* ── KANBAN ── */
.kanban-wrapper {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 16px;
  align-items: flex-start;
  min-height: calc(100vh - 130px);
}

.kanban-col {
  min-width: 280px;
  max-width: 280px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
}

.kanban-col-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.kanban-col-title {
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.col-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.kanban-cards {
  padding: 10px;
  flex: 1;
  min-height: 60px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.task-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
  transition: box-shadow .15s, transform .1s;
  user-select: none;
}

.task-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,.1);
  transform: translateY(-1px);
}

.task-card.dragging {
  opacity: .5;
  box-shadow: 0 8px 24px rgba(0,0,0,.15);
}

.kanban-cards.drag-over {
  background: rgba(99,102,241,.05);
  border: 2px dashed var(--primary);
  border-radius: 8px;
}

.task-card .task-title {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  margin-bottom: 8px;
}

.task-card .task-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
}

.add-task-btn {
  margin: 0 10px 10px;
  border: 1.5px dashed var(--border);
  background: transparent;
  color: var(--muted);
  border-radius: 6px;
  padding: 6px;
  font-size: 12px;
  text-align: center;
  cursor: pointer;
  transition: all .15s;
  width: calc(100% - 20px);
}

.add-task-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(99,102,241,.05);
}

/* ── BADGES / PRIORIDADE ── */
.badge-prioridade {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 20px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.prioridade-baixa   { background: #d1fae5; color: #065f46; }
.prioridade-media   { background: #fef9c3; color: #854d0e; }
.prioridade-alta    { background: #fee2e2; color: #991b1b; }
.prioridade-critica { background: #7f1d1d; color: #fca5a5; }

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

/* ── FORMS ── */
.form-control, .form-select {
  border-color: var(--border);
  border-radius: 7px;
  font-size: 13.5px;
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}

/* ── BOTÕES ── */
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
}
.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

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

.auth-card {
  background: #fff;
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}

.auth-card .brand-logo {
  font-size: 26px;
  font-weight: 800;
  text-align: center;
  margin-bottom: 6px;
}

.auth-card .brand-logo span { color: var(--primary); }

.auth-card .brand-sub {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 28px;
}

/* ── TAREFA DETALHE ── */
.tarefa-header { border-bottom: 1px solid var(--border); padding-bottom: 16px; margin-bottom: 20px; }
.tarefa-titulo { font-size: 20px; font-weight: 700; }
.tarefa-descricao { font-size: 14px; color: var(--muted); white-space: pre-wrap; }

.comment-item {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.comment-item:last-child { border-bottom: none; }
.comment-body { flex: 1; }
.comment-author { font-size: 12px; font-weight: 600; margin-bottom: 3px; }
.comment-text { font-size: 13.5px; }
.comment-time { font-size: 11px; color: var(--muted); }

/* ── UTILS ── */
.text-muted { color: var(--muted) !important; }
.cursor-pointer { cursor: pointer; }
.border-radius { border-radius: var(--radius); }

.tag {
  display: inline-block;
  background: #e0e7ff;
  color: #3730a3;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 500;
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .sidebar { width: 60px; min-width: 60px; }
  .sidebar nav a span, .sidebar-logo .brand span:last-child,
  .sidebar-section, .sidebar-user .user-info { display: none; }
  .main-content { margin-left: 60px; }
  .page-body { padding: 16px; }
}

/* ── ETIQUETAS WIDGET (Jira-style) ─────────────────────────── */
.etiq-widget { position: relative; }

.etiq-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-height: 22px;
  margin-bottom: 4px;
}

.etiq-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  cursor: default;
  line-height: 1.5;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.etiq-chip-rm {
  background: none;
  border: none;
  padding: 0;
  line-height: 1;
  font-size: 14px;
  cursor: pointer;
  opacity: .6;
  color: inherit;
  margin-left: 2px;
  flex-shrink: 0;
}
.etiq-chip-rm:hover { opacity: 1; }

.etiq-add-wrap { position: relative; }

.etiq-add-btn {
  background: none;
  border: 1px dashed #d1d5db;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 11px;
  color: #6b7280;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.etiq-add-btn:hover {
  background: #f3f4f6;
  color: #111827;
  border-color: #9ca3af;
}

.etiq-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 1050;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  width: 260px;
  max-height: 340px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.etiq-search-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-bottom: 1px solid #f3f4f6;
}
.etiq-search-icon { color: #9ca3af; font-size: 13px; }
.etiq-search {
  border: none;
  outline: none;
  flex: 1;
  font-size: 13px;
  background: transparent;
}

.etiq-list {
  overflow-y: auto;
  max-height: 220px;
  padding: 4px 0;
}

.etiq-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: background .1s;
}
.etiq-item:hover { background: #f9fafb; }
.etiq-item.selected { background: #eff6ff; }
.etiq-item.etiq-create { color: #2563eb; font-weight: 500; }

.etiq-chip-sm {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.etiq-footer {
  border-top: 1px solid #f3f4f6;
  padding: 6px 12px;
}
.etiq-hint { font-size: 11px; color: #9ca3af; }

.etiq-empty {
  padding: 12px;
  font-size: 12px;
  color: #9ca3af;
  text-align: center;
}
