:root {
  --bg-main: #0b0f19;
  --bg-card: #111827;
  --bg-card-hover: #1f2937;
  --bg-sidebar: #070a12;
  --border-color: #1f2937;
  --border-light: #374151;
  --text-main: #f9fafb;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;
  --accent-green: #10b981;
  --accent-green-bg: rgba(16, 185, 129, 0.1);
  --accent-blue: #3b82f6;
  --accent-blue-bg: rgba(59, 130, 246, 0.1);
  --accent-red: #ef4444;
  --accent-red-bg: rgba(239, 68, 68, 0.1);
  --accent-purple: #8b5cf6;
  --accent-purple-bg: rgba(139, 92, 246, 0.1);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  display: flex;
  height: 100vh;
  overflow: hidden;
}

#app { display: flex; width: 100vw; height: 100vh; }

/* SIDEBAR */
.sidebar {
  width: 280px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  flex-shrink: 0;
}
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; padding: 0 8px; }
.brand-logo { font-size: 28px; line-height: 1; }
.brand-info h1 { font-size: 18px; font-weight: 700; color: #fff; letter-spacing: -0.5px; }
.badge-plan { font-size: 10px; font-weight: 700; color: var(--accent-green); background: var(--accent-green-bg); padding: 2px 6px; border-radius: 4px; text-transform: uppercase; }

.tenant-selector {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 10px 12px;
  border-radius: var(--radius-md);
  margin-bottom: 24px;
}
.tenant-icon { font-size: 20px; }
.tenant-meta { display: flex; flex-direction: column; overflow: hidden; }
.tenant-meta strong { font-size: 13px; font-weight: 600; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.tenant-meta small { font-size: 11px; color: var(--text-muted); }

.nav-menu { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
  width: 100%;
}
.nav-item .icon { font-size: 16px; }
.nav-item:hover { background: var(--bg-card); color: var(--text-main); }
.nav-item.active { background: var(--accent-blue-bg); color: #60a5fa; font-weight: 600; }

.sidebar-footer { padding: 12px 8px 0; border-top: 1px solid var(--border-color); }
.status-indicator { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-green); box-shadow: 0 0 8px var(--accent-green); }
.version-label { font-size: 10px; color: var(--text-dim); display: block; }

/* MAIN CONTENT */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-main);
}
.topbar {
  height: 72px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  flex-shrink: 0;
  background: rgba(11, 15, 25, 0.8);
  backdrop-filter: blur(12px);
}
.topbar-title h2 { font-size: 20px; font-weight: 700; letter-spacing: -0.5px; }
.topbar-title p { font-size: 12px; color: var(--text-muted); }
.topbar-actions { display: flex; align-items: center; gap: 16px; }

.user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 6px 14px 6px 8px;
  border-radius: 30px;
}
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-blue);
  color: #fff;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}
.user-details strong { font-size: 12px; display: block; }
.user-details small { font-size: 10px; color: var(--text-muted); display: block; }

.content-body {
  flex: 1;
  overflow-y: auto;
  padding: 32px;
}

/* TABS */
.tab-pane { display: none; }
.tab-pane.active { display: block; animation: fadeIn 0.25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s;
}
.btn-primary { background: var(--accent-blue); color: #fff; }
.btn-primary:hover { background: #2563eb; }
.btn-outline { background: transparent; border-color: var(--border-light); color: var(--text-main); }
.btn-outline:hover { background: var(--bg-card-hover); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-block { width: 100%; }

/* CARDS */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 24px;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-header h3 { font-size: 15px; font-weight: 600; }
.card-body { padding: 20px; }
.card-body.p-0 { padding: 0; }

/* METRICS */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}
.metric-card { margin-bottom: 0; padding: 20px; display: flex; flex-direction: column; justify-content: space-between; }
.metric-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; font-size: 13px; font-weight: 600; color: var(--text-muted); }
.pill { font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 12px; text-transform: uppercase; }
.pill-pj { background: var(--accent-purple-bg); color: #a78bfa; }
.pill-pf { background: var(--accent-green-bg); color: #34d399; }
.pill-accent { background: var(--accent-blue-bg); color: #60a5fa; }

.metric-values { display: flex; gap: 20px; margin-bottom: 16px; }
.sub-metric small { display: block; font-size: 11px; color: var(--text-dim); }
.sub-metric strong { font-size: 18px; font-weight: 700; }
.text-green { color: var(--accent-green); }
.text-red { color: var(--accent-red); }

.metric-footer {
  border-top: 1px solid var(--border-color);
  padding-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}
.metric-footer strong { font-size: 16px; color: #fff; }

.productivity-stats { display: flex; justify-content: space-between; text-align: center; margin-top: 10px; }
.stat-item .stat-number { font-size: 26px; font-weight: 800; color: #60a5fa; display: block; line-height: 1.1; }
.stat-item small { font-size: 11px; color: var(--text-muted); }

/* DUAL GRID */
.dual-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 1024px) { .dual-grid { grid-template-columns: 1fr; } }

/* TASK LIST */
.task-list { list-style: none; }
.task-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
}
.task-item:last-child { border-bottom: none; }
.task-left { display: flex; align-items: center; gap: 10px; }
.task-checkbox { cursor: pointer; width: 16px; height: 16px; accent-color: var(--accent-blue); }
.task-meta { font-size: 11px; color: var(--text-dim); }

/* NOTES FEED */
.notes-feed { display: flex; flex-direction: column; gap: 10px; }
.note-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  font-size: 13px;
}
.note-tags { display: flex; gap: 6px; margin-top: 8px; }
.tag-badge { font-size: 10px; background: var(--bg-card-hover); color: var(--text-muted); padding: 2px 6px; border-radius: 4px; }

/* BOLETO CARD */
.boleto-card { border: 1px solid #3b82f644; background: linear-gradient(180deg, #1e293b 0%, #111827 100%); }
.boleto-input-row { display: flex; gap: 12px; }
.input-mono { font-family: 'JetBrains Mono', monospace; font-size: 13px; }
.boleto-result {
  margin-top: 16px;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  padding: 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
}

/* DATA TABLE */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; text-align: left; }
.data-table th { background: rgba(255, 255, 255, 0.02); padding: 12px 16px; color: var(--text-muted); font-weight: 600; border-bottom: 1px solid var(--border-color); }
.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--border-color); }
.data-table tr:hover { background: var(--bg-card-hover); }
.text-right { text-align: right; }
.text-center { text-align: center; }

/* MODULES GRID */
.modules-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; margin-top: 20px; }
.module-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.module-card-top { display: flex; gap: 14px; margin-bottom: 12px; }
.module-emoji { font-size: 28px; line-height: 1; }
.module-info h4 { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.module-info p { font-size: 12px; color: var(--text-muted); }
.module-card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-color);
  padding-top: 12px;
}

/* SWITCH TOGGLE */
.switch { position: relative; display: inline-block; width: 42px; height: 22px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--border-light);
  transition: .3s;
  border-radius: 22px;
}
.slider:before {
  position: absolute; content: ""; height: 16px; width: 16px; left: 3px; bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}
input:checked + .slider { background-color: var(--accent-green); }
input:checked + .slider:before { transform: translateX(20px); }

/* MODALS */
.modal {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.modal.active { display: flex; }
.modal-dialog {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 500px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.5);
  animation: modalScale 0.2s ease;
}
@keyframes modalScale { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-header { padding: 18px 24px; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; }
.modal-header h4 { font-size: 16px; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 20px; color: var(--text-muted); cursor: pointer; }
.modal-body { padding: 24px; }
.modal-footer { padding: 14px 24px; border-top: 1px solid var(--border-color); display: flex; justify-content: flex-end; gap: 12px; }

/* FORMS */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }
.form-group input, .form-group select, .form-group textarea, .search-box input, .boleto-input-row input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  outline: none;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--accent-blue); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.empty-state { padding: 24px; text-align: center; color: var(--text-dim); font-size: 13px; }
.mt-4 { margin-top: 24px; }

/* SUBNAV */
.subnav { display: flex; gap: 8px; margin-bottom: 20px; border-bottom: 1px solid var(--border-color); padding-bottom: 8px; }
.subnav-item {
  background: none; border: none; color: var(--text-muted); font-size: 13px; font-weight: 600;
  padding: 8px 14px; border-radius: var(--radius-sm); cursor: pointer;
}
.subnav-item.active { background: var(--bg-card); color: #fff; }
.subtab-pane { display: none; }
.subtab-pane.active { display: block; }
.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 12px; }
.filters { display: flex; gap: 10px; }
.filters select { background: var(--bg-card); border: 1px solid var(--border-color); color: #fff; padding: 6px 12px; border-radius: var(--radius-sm); font-size: 12px; }
.search-box { display: flex; gap: 6px; max-width: 380px; width: 100%; }
