/* =============================================
   CENTRAL DE ATIVOS CONTROL — Premium CSS
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap');

:root {
  /* Paleta principal */
  --bg-base:        #0a0b0f;
  --bg-surface:     #111318;
  --bg-elevated:    #181b22;
  --bg-hover:       #1e222c;
  --bg-card:        #13161e;

  /* Borders */
  --border:         #1f2430;
  --border-light:   #252b38;
  --border-focus:   #3b82f6;

  /* Accent */
  --accent:         #3b82f6;
  --accent-hover:   #2563eb;
  --accent-glow:    rgba(59,130,246,0.15);
  --accent-subtle:  rgba(59,130,246,0.08);

  /* Status */
  --green:          #10b981;
  --green-bg:       rgba(16,185,129,0.1);
  --red:            #ef4444;
  --red-bg:         rgba(239,68,68,0.1);
  --yellow:         #f59e0b;
  --yellow-bg:      rgba(245,158,11,0.1);
  --purple:         #8b5cf6;
  --purple-bg:      rgba(139,92,246,0.1);
  --cyan:           #06b6d4;
  --cyan-bg:        rgba(6,182,212,0.1);

  /* Text */
  --text-primary:   #e8eaf0;
  --text-secondary: #8b93a7;
  --text-muted:     #4a5268;
  --text-accent:    #3b82f6;

  /* Sidebar */
  --sidebar-width:  260px;

  /* Fonts */
  --font-display:   'Poppins', sans-serif;
  --font-body:      'Poppins', sans-serif;

  /* Shadows */
  --shadow-sm:      0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:      0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg:      0 8px 32px rgba(0,0,0,0.6);
  --shadow-card:    0 2px 12px rgba(0,0,0,0.4), 0 0 0 1px var(--border);

  /* Radius */
  --radius-sm:      6px;
  --radius-md:      10px;
  --radius-lg:      14px;
  --radius-xl:      20px;
}

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

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Layout principal do app (sidebar + main) */
body.app-layout {
  display: flex;
}

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo .logo-mark {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 36px; height: 36px;
  background: var(--accent);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  box-shadow: 0 0 20px var(--accent-glow);
}

.logo-text {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.logo-text span {
  display: block;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

.nav-section {
  margin-bottom: 24px;
}

.nav-section-label {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0 8px;
  margin-bottom: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.15s ease;
  margin-bottom: 2px;
  position: relative;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-subtle);
  color: var(--accent);
  border: 1px solid rgba(59,130,246,0.2);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 60%;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

.nav-icon {
  width: 18px; height: 18px;
  opacity: 0.8;
  flex-shrink: 0;
}

.nav-badge {
  margin-left: auto;
  background: var(--accent-subtle);
  color: var(--accent);
  border: 1px solid rgba(59,130,246,0.25);
  font-size: 0.65rem;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 20px;
}

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--border);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}

.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.75rem;
  color: white;
  flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }
.user-name  { font-size: 0.8rem; font-weight: 600; truncate: ellipsis; white-space: nowrap; overflow: hidden; }
.user-role  { font-size: 0.68rem; color: var(--text-muted); }

.btn-logout {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  margin-top: 8px;
  width: 100%;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  justify-content: center;
}

.btn-logout:hover {
  border-color: var(--red);
  color: var(--red);
  background: var(--red-bg);
}

/* ── MAIN CONTENT ── */
.main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

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

.page-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.page-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 1px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.main-content {
  flex: 1;
  padding: 28px;
}

/* ── CARDS ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: border-color 0.2s;
}

.card:hover { border-color: var(--border-light); }

.card-header {
  padding: 18px 22px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
}

.card-body { padding: 20px 22px; }

/* ── STAT CARDS ── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--stat-color, var(--accent));
  opacity: 0.7;
}

.stat-card:hover {
  border-color: var(--border-light);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.stat-icon {
  width: 38px; height: 38px;
  border-radius: var(--radius-md);
  background: var(--stat-bg, var(--accent-subtle));
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.stat-change {
  font-size: 0.72rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 3px;
}

.stat-change.up   { color: var(--green); }
.stat-change.down { color: var(--red); }

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 0 20px var(--accent-glow);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border-color: var(--border);
}
.btn-secondary:hover {
  border-color: var(--border-light);
  color: var(--text-primary);
  background: var(--bg-hover);
}

.btn-danger {
  background: var(--red-bg);
  color: var(--red);
  border-color: rgba(239,68,68,0.25);
}
.btn-danger:hover {
  background: rgba(239,68,68,0.2);
}

.btn-success {
  background: var(--green-bg);
  color: var(--green);
  border-color: rgba(16,185,129,0.25);
}
.btn-success:hover {
  background: rgba(16,185,129,0.2);
}

.btn-warning {
  background: var(--yellow-bg);
  color: var(--yellow);
  border-color: rgba(245,158,11,0.25);
}

.btn-sm { padding: 5px 11px; font-size: 0.78rem; }
.btn-lg { padding: 11px 22px; font-size: 0.95rem; }

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── BADGES ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.badge-green  { background: var(--green-bg);  color: var(--green);  border: 1px solid rgba(16,185,129,0.2); }
.badge-red    { background: var(--red-bg);    color: var(--red);    border: 1px solid rgba(239,68,68,0.2); }
.badge-yellow { background: var(--yellow-bg); color: var(--yellow); border: 1px solid rgba(245,158,11,0.2); }
.badge-blue   { background: var(--accent-subtle); color: var(--accent); border: 1px solid rgba(59,130,246,0.2); }
.badge-purple { background: var(--purple-bg); color: var(--purple); border: 1px solid rgba(139,92,246,0.2); }
.badge-cyan   { background: var(--cyan-bg);   color: var(--cyan);   border: 1px solid rgba(6,182,212,0.2); }

/* ── TABLE ── */
.table-wrap { overflow-x: auto; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.855rem;
}

.table th {
  padding: 10px 16px;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
  white-space: nowrap;
}

.table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}

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

.table tbody tr:hover td {
  background: var(--bg-hover);
}

.table-actions { display: flex; gap: 6px; align-items: center; }

/* ── FORMS ── */
.form-group { margin-bottom: 18px; }

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}

.form-label .required { color: var(--red); margin-left: 3px; }

.form-control {
  width: 100%;
  padding: 9px 13px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.875rem;
  transition: all 0.15s;
  outline: none;
}

.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.form-control::placeholder { color: var(--text-muted); }

select.form-control option { background: var(--bg-elevated); }

textarea.form-control { resize: vertical; min-height: 90px; }

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

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

/* ── MODAL ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 560px;
  box-shadow: var(--shadow-lg);
  transform: translateY(10px) scale(0.98);
  transition: transform 0.2s;
}

.modal-overlay.active .modal { transform: translateY(0) scale(1); }

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

.modal-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
}

.modal-close {
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  transition: all 0.15s;
}

.modal-close:hover { color: var(--text-primary); border-color: var(--border-light); }

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

/* ── TOAST ── */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  font-size: 0.85rem;
  min-width: 280px;
  max-width: 380px;
  animation: toastIn 0.3s ease;
}

.toast.success { border-left: 3px solid var(--green); }
.toast.error   { border-left: 3px solid var(--red); }
.toast.warning { border-left: 3px solid var(--yellow); }
.toast.info    { border-left: 3px solid var(--accent); }

@keyframes toastIn {
  from { transform: translateX(20px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ── FILTERS BAR ── */
.filters-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.filter-select {
  padding: 7px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.84rem;
  cursor: pointer;
  outline: none;
  transition: all 0.15s;
}
.filter-select:focus { border-color: var(--border-focus); }

.search-input {
  padding: 7px 13px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.84rem;
  outline: none;
  transition: all 0.15s;
  min-width: 220px;
}
.search-input:focus { border-color: var(--border-focus); }
.search-input::placeholder { color: var(--text-muted); }

/* ── EMPTY STATE ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  color: var(--text-muted);
  gap: 12px;
}
.empty-state-icon { font-size: 3rem; opacity: 0.4; }
.empty-state h3 { font-family: var(--font-display); font-size: 1rem; color: var(--text-secondary); }
.empty-state p  { font-size: 0.84rem; }

/* ── PAGE HEADER ── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}

.page-header-left h1 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
}

.page-header-left p {
  font-size: 0.84rem;
  color: var(--text-muted);
  margin-top: 3px;
}

/* ── LOADING ── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

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

/* ── RESPONSIVE ── */
.mobile-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 6px;
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open { transform: translateX(0); }
  .main-wrapper { margin-left: 0; }
  .mobile-toggle { display: flex; }
  .main-content { padding: 16px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .page-header { flex-direction: column; }
}

/* ── CHART CONTAINER ── */
.chart-container {
  position: relative;
  height: 260px;
  width: 100%;
}

/* ── KANBAN (produção) ── */
.kanban-board {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.kanban-col {
  min-width: 220px;
  flex: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

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

.kanban-col-title {
  font-size: 0.8rem;
  font-weight: 700;
  font-family: var(--font-display);
}

.kanban-col-count {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 1px 8px;
  color: var(--text-secondary);
}

.kanban-cards {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 120px;
}

.kanban-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  font-size: 0.82rem;
  transition: all 0.15s;
  cursor: default;
}

.kanban-card:hover {
  border-color: var(--border-light);
  box-shadow: var(--shadow-sm);
}

.kanban-card-name {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.kanban-card-meta {
  color: var(--text-muted);
  font-size: 0.75rem;
  display: flex;
  gap: 8px;
}

/* ── LOGIN PAGE ── */
.login-page {
  min-height: 100vh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  position: relative;
  overflow: hidden;
  padding: 20px;
}

.login-page::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(59,130,246,0.06) 0%, transparent 70%);
  top: -200px; right: -200px;
  pointer-events: none;
}

.login-page::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(139,92,246,0.04) 0%, transparent 70%);
  bottom: -100px; left: -100px;
  pointer-events: none;
}

.login-box {
  width: 100%;
  max-width: 440px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 44px 40px;
  box-shadow: var(--shadow-lg), 0 0 80px rgba(59,130,246,0.06);
  position: relative;
  z-index: 1;
  margin: auto;
}

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

.login-logo .icon {
  width: 52px; height: 52px;
  background: var(--accent);
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  margin: 0 auto 14px;
  box-shadow: 0 0 30px rgba(59,130,246,0.3);
}

.login-logo h1 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 800;
}

.login-logo p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.alert-error {
  background: var(--red-bg);
  border: 1px solid rgba(239,68,68,0.2);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: var(--red);
  font-size: 0.84rem;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Utilitários */
.text-right    { text-align: right; }
.text-center   { text-align: center; }
.text-muted    { color: var(--text-muted); }
.text-green    { color: var(--green); }
.text-red      { color: var(--red); }
.text-yellow   { color: var(--yellow); }
.text-accent   { color: var(--accent); }
.fw-600        { font-weight: 600; }
.fw-700        { font-weight: 700; }
.d-flex        { display: flex; }
.align-center  { align-items: center; }
.gap-2         { gap: 8px; }
.gap-3         { gap: 12px; }
.mt-1          { margin-top: 4px; }
.mt-2          { margin-top: 8px; }
.mt-3          { margin-top: 12px; }
.mb-3          { margin-bottom: 12px; }
.mb-4          { margin-bottom: 16px; }
.font-mono     { font-family: 'Courier New', monospace; font-size: 0.85em; }
.truncate      { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-100         { width: 100%; }
