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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f5f5f5;
  color: #1a1a1a;
  min-height: 100vh;
}

a {
  color: #2563eb;
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

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

.sidebar {
  width: 250px;
  background: #fff;
  border-right: 1px solid #e5e5e5;
  padding: 0;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid #e5e5e5;
}

.sidebar-header h1 {
  font-size: 20px;
  font-weight: 700;
}

.sidebar-header p {
  font-size: 12px;
  color: #666;
  margin-top: 4px;
}

.sidebar nav {
  padding: 12px;
}

.sidebar nav a {
  display: block;
  padding: 8px 12px;
  border-radius: 6px;
  color: #333;
  font-size: 14px;
  margin-bottom: 2px;
}

.sidebar nav a:hover {
  background: #f5f5f5;
  text-decoration: none;
}

.sidebar nav a.active {
  background: #f0f0f0;
  font-weight: 600;
}

.main {
  flex: 1;
  padding: 32px;
  overflow-x: auto;
}

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

.card {
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  padding: 20px;
}

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

.card-title {
  font-size: 18px;
  font-weight: 600;
}

.card-subtitle {
  font-size: 12px;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
}

/* Table */
table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid #e5e5e5;
  font-size: 14px;
}

th {
  font-weight: 600;
  color: #666;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

tr:hover {
  background: #fafafa;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid #e5e5e5;
  background: #fff;
  color: #333;
  cursor: pointer;
  text-decoration: none;
}

.btn:hover {
  background: #f5f5f5;
  text-decoration: none;
}

.btn-primary {
  background: #1a1a1a;
  color: #fff;
  border-color: #1a1a1a;
}

.btn-primary:hover {
  background: #333;
}

.btn-danger {
  color: #dc2626;
  border-color: #fecaca;
  background: #fef2f2;
}

.btn-danger:hover {
  background: #fee2e2;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

.sort-btn.active,
.server-filter.active {
  background: #1a1a1a;
  color: #fff;
  border-color: #1a1a1a;
}

/* Cores de servidores */
.server-color-0 { background: #dbeafe; color: #1e40af; }
.server-color-1 { background: #fce7f3; color: #9d174d; }
.server-color-2 { background: #d1fae5; color: #065f46; }
.server-color-3 { background: #fef3c7; color: #92400e; }
.server-color-4 { background: #ede9fe; color: #5b21b6; }
.server-color-5 { background: #ffe4e6; color: #be123c; }
.server-color-6 { background: #ccfbf1; color: #115e59; }
.server-color-7 { background: #fef9c3; color: #854d0e; }

.actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

/* Forms */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 6px;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  background: #fff;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group .help {
  font-size: 12px;
  color: #666;
  margin-top: 4px;
}

/* Badge */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}

.badge-active {
  background: #dcfce7;
  color: #166534;
}

.badge-inactive {
  background: #f3f4f6;
  color: #6b7280;
}

.badge-full {
  background: #fef2f2;
  color: #dc2626;
}

.badge-warning {
  background: #fefce8;
  color: #ca8a04;
}

/* Progress bar */
.progress-bar {
  width: 100px;
  height: 6px;
  background: #e5e5e5;
  border-radius: 3px;
  overflow: hidden;
  margin-top: 4px;
}

.progress-fill {
  height: 100%;
  border-radius: 3px;
  background: #22c55e;
  transition: width 0.3s;
}

.progress-fill.warning {
  background: #f59e0b;
}

.progress-fill.danger {
  background: #ef4444;
}

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

.page-header h2 {
  font-size: 24px;
  font-weight: 700;
}

/* Code / mono */
code {
  background: #f3f4f6;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
  font-family: "SF Mono", Monaco, monospace;
}

/* Alert */
.alert {
  padding: 10px 16px;
  border-radius: 6px;
  margin-bottom: 16px;
  font-size: 14px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
}

/* Empty state */
.empty {
  text-align: center;
  padding: 40px;
  color: #999;
  font-size: 14px;
}

/* Modal overlay */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 100;
  justify-content: center;
  align-items: center;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: #fff;
  border-radius: 10px;
  padding: 24px;
  width: 480px;
  max-width: 90vw;
  max-height: 80vh;
  overflow-y: auto;
}

.modal h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
}

/* Group picker */
.group-picker-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #e5e5e5;
  margin-bottom: 4px;
}

.group-picker-list {
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  padding: 4px 0;
}

.group-check-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 14px;
}

.group-check-label:hover {
  background: #f5f5f5;
}

.group-check-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Charts */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.chart-box {
  position: relative;
}

.chart-box canvas {
  width: 100% !important;
  height: 200px !important;
}

.chart-label {
  font-size: 12px;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.chart-total {
  font-size: 28px;
  font-weight: 700;
  margin: 4px 0 12px;
}

.chart-period-btns {
  display: flex;
  gap: 4px;
}

.chart-period.active {
  background: #1a1a1a;
  color: #fff;
  border-color: #1a1a1a;
}

@media (max-width: 900px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }
}

/* Campaign full page */
.full-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: #f5f5f5;
}

.full-page .card {
  text-align: center;
  max-width: 400px;
  padding: 40px;
}

.full-page .icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.full-page h2 {
  margin-bottom: 8px;
}

.full-page p {
  color: #666;
}
