/* Admin System - Ápicelab - Black & White Theme */

/* Agenda Filter Styles */
.agenda-filter-wrapper {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) var(--space-sm);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.agenda-filter-wrapper:hover {
  border-color: var(--border-hover);
  background: var(--bg-hover);
}

.agenda-filter-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  margin: 0;
}

.agenda-filter-select {
  padding: var(--space-xs) var(--space-md) var(--space-xs) var(--space-sm);
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23212529' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-sm) center;
  background-size: 12px;
  padding-right: calc(var(--space-md) + 12px + var(--space-sm));
  min-width: 140px;
  transition: var(--transition);
}

.agenda-filter-select:hover {
  color: var(--accent);
}

.agenda-filter-select:focus {
  color: var(--accent);
}

.agenda-filter-select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236c757d' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
}

.agenda-filter-select option {
  padding: var(--space-sm);
  background: var(--bg-primary);
  color: var(--text-primary);
}

/* Financeiro Styles */
.financeiro-filter-wrapper {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.financeiro-filter-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  margin: 0;
}

.financeiro-filter-date {
  padding: var(--space-xs) var(--space-sm);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
}

.financeiro-tabs {
  display: flex;
  gap: var(--space-sm);
  border-bottom: 2px solid var(--border-color);
  margin-bottom: var(--space-lg);
}

.financeiro-tab {
  padding: var(--space-sm) var(--space-lg);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: -2px;
}

.financeiro-tab:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.financeiro-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

.financeiro-tab-content {
  display: none;
}

.financeiro-tab-content.active {
  display: block;
}

.metric-card {
  background: var(--bg-card);
  padding: var(--space-lg);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  transition: var(--transition);
}

.metric-card:hover {
  box-shadow: 0 2px 8px var(--shadow);
  transform: translateY(-2px);
}

.metric-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
}

.metric-value {
  font-size: 24px;
  font-weight: 700;
}

.btn-icon-small {
  padding: var(--space-xs) var(--space-sm);
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  transition: var(--transition);
  margin-right: var(--space-xs);
}

.btn-icon-small:hover {
  background: var(--bg-hover);
  border-color: var(--border-hover);
}

:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-tertiary: #e9ecef;
  --bg-card: #ffffff;
  --bg-hover: #f1f3f5;
  --bg-active: #e9ecef;
  --text-primary: #212529;
  --text-secondary: #6c757d;
  --text-muted: #adb5bd;
  --border-color: #dee2e6;
  --border-hover: #ced4da;
  --accent: #000000;
  --accent-dark: #212529;
  --success: #28a745;
  --warning: #ffc107;
  --error: #dc3545;
  --shadow: rgba(0, 0, 0, 0.1);
  --shadow-lg: rgba(0, 0, 0, 0.15);
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --transition: all 0.2s ease;
  
  /* Sidebar específico - preto */
  --sidebar-bg: #000000;
  --sidebar-text: #ffffff;
  --sidebar-hover: #1a1a1a;
  --sidebar-active: #2a2a2a;
  --sidebar-border: #333333;
}

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

html, body {
  height: 100%;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background: var(--bg-secondary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
}

/* Quando estiver no dashboard, body não deve rolar */
body:has(.dashboard-wrapper) {
  overflow: hidden;
  height: 100vh;
}

/* Login Page */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg-secondary);
  padding: var(--space-md);
}

.login-container {
  width: 100%;
  max-width: 420px;
}

.login-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-2xl);
  box-shadow: 0 4px 20px var(--shadow);
}

.login-header {
  text-align: center;
  margin-bottom: var(--space-2xl);
}

.login-logo {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  margin-bottom: var(--space-sm);
}

.login-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 400;
}

.login-form {
  margin-bottom: var(--space-lg);
}

.form-group {
  margin-bottom: var(--space-lg);
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}

.form-group input {
  width: 100%;
  padding: 12px var(--space-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 15px;
  font-family: inherit;
  transition: var(--transition);
}

.form-group input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}

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

.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px var(--space-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 15px;
  font-family: inherit;
  transition: var(--transition);
}

.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
}

.form-group select {
  cursor: pointer;
}

.form-group select[multiple] {
  min-height: 100px;
  padding: var(--space-sm);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.form-group select[multiple] option {
  padding: var(--space-sm);
  margin: var(--space-xs) 0;
  border-radius: var(--radius-sm);
}

.form-group select[multiple] option:checked {
  background: var(--accent);
  color: var(--bg-primary);
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
}

.password-input-wrapper {
  position: relative;
}

.toggle-password {
  position: absolute;
  right: var(--space-md);
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: var(--space-xs);
  font-size: 18px;
  transition: var(--transition);
}

.toggle-password:hover {
  color: var(--text-primary);
}

.form-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-lg);
  font-size: 14px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--text-secondary);
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--accent);
}

.forgot-password {
  color: var(--text-secondary);
  text-decoration: none;
  transition: var(--transition);
}

.forgot-password:hover {
  color: var(--text-primary);
}

.btn-login {
  width: 100%;
  padding: 14px;
  background: var(--text-primary);
  color: var(--bg-primary);
  border: none;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.btn-login:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.2);
}

.btn-login:active {
  transform: translateY(0);
}

.btn-loader {
  display: none;
  position: absolute;
  width: 20px;
  height: 20px;
  border: 2px solid var(--bg-primary);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.login-error {
  margin-top: var(--space-md);
  padding: var(--space-md);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--error);
  font-size: 14px;
  display: none;
}

.login-error.show {
  display: block;
}

.login-footer {
  text-align: center;
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border-color);
}

.login-footer p {
  font-size: 12px;
  color: var(--text-muted);
}

/* Dashboard Layout */
.dashboard-wrapper {
  display: flex;
  height: 100vh;
  background: var(--bg-secondary);
  position: relative;
  overflow: hidden;
}

/* Sidebar - Preto */
.sidebar {
  width: 280px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  max-height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 1000;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
}

/* Garantir que o sidebar tenha fundo preto mesmo ao rolar */
.sidebar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--sidebar-bg);
  z-index: -1;
  pointer-events: none;
}

.sidebar-header {
  padding: 0 var(--space-xl);
  min-height: 72px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--sidebar-border);
  background: var(--sidebar-bg);
  flex-shrink: 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 26px;
  font-weight: 700;
  color: var(--sidebar-text);
  letter-spacing: -0.5px;
  margin: 0;
  line-height: 1.2;
}

.sidebar-logo img {
  height: 40px;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
}

.sidebar-nav {
  flex: 1;
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  background: var(--sidebar-bg);
  min-height: 0;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: var(--transition);
  font-size: 15px;
  font-weight: 500;
  border-left: 3px solid transparent;
  min-height: 44px;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text);
  border-left-color: rgba(255, 255, 255, 0.3);
}

.nav-item.active {
  background: var(--sidebar-active);
  color: var(--sidebar-text);
  border-left-color: var(--sidebar-text);
  font-weight: 600;
}

.nav-item-icon {
  font-size: 20px;
  width: 24px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: var(--space-lg);
  border-top: 1px solid var(--sidebar-border);
  background: var(--sidebar-bg);
  flex-shrink: 0;
  margin-top: auto;
}

.user-info {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
}

.user-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--sidebar-active);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--sidebar-text);
  border: 2px solid var(--sidebar-border);
  flex-shrink: 0;
}

.user-details {
  flex: 1;
  min-width: 0;
}

.user-details h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--sidebar-text);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-details p {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-logout {
  width: 100%;
  padding: var(--space-md);
  background: var(--sidebar-active);
  border: 1px solid var(--sidebar-border);
  border-radius: var(--radius-md);
  color: var(--sidebar-text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.btn-logout:hover {
  background: var(--sidebar-hover);
  border-color: rgba(255, 255, 255, 0.2);
}

/* Main Content */
.main-content {
  flex: 1;
  margin-left: 280px;
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  height: 100vh;
  width: calc(100% - 280px);
  position: fixed;
  top: 0;
  right: 0;
  overflow: hidden;
}

.topbar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 0 var(--space-xl);
  min-height: 72px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  z-index: 100;
  box-shadow: 0 2px 4px var(--shadow);
  width: 100%;
  min-width: 0;
  flex-wrap: wrap;
  gap: var(--space-md);
  flex-shrink: 0;
}

.topbar-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
}

.topbar-actions {
  display: flex;
  gap: var(--space-md);
  align-items: center;
  flex-wrap: nowrap;
  flex-shrink: 0;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  width: 300px;
}

.search-box input {
  padding: 10px 12px 10px 40px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px;
  width: 100%;
  box-sizing: border-box;
  transition: var(--transition);
}

.search-box input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  width: 18px;
  height: 18px;
}

.btn-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition);
  font-size: 18px;
}

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

.content-area {
  flex: 1;
  padding: var(--space-lg) var(--space-xl) var(--space-xl);
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg-secondary);
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition: var(--transition);
  box-shadow: 0 2px 4px var(--shadow);
}

.stat-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--shadow);
}

.stat-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-md);
}

.stat-title {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
}

.stat-change {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Section */
.section {
  margin-bottom: var(--space-2xl);
}

.section-inner {
  margin-bottom: var(--space-2xl);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-lg);
}

.section-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.btn-primary {
  padding: 12px var(--space-lg);
  background: var(--accent);
  color: var(--bg-primary);
  border: none;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  box-shadow: 0 2px 4px var(--shadow);
}

.btn-primary:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px var(--shadow);
}

.btn-secondary {
  padding: 10px var(--space-lg);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

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

/* Kanban Board */
#section-crm {
  display: flex;
  flex-direction: column;
  width: 100%;
}

#section-crm .section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
  flex-wrap: nowrap;
  width: 100%;
  min-width: 0;
}

#section-crm .section-header > div:first-child {
  flex: 1;
  min-width: 200px;
  overflow: hidden;
}

#section-crm .section-header h2 {
  margin: 0;
  margin-bottom: 4px;
  font-size: 18px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#section-crm .section-header p {
  margin: 0;
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#section-crm .section-header .btn-primary {
  white-space: nowrap;
  flex-shrink: 0;
  padding: 10px var(--space-lg);
  font-size: 14px;
  min-width: fit-content;
}

.crm-actions {
  display: flex;
  align-items: flex-end;
  gap: var(--space-sm);
  flex-shrink: 0;
}

#crmUserFilterWrap {
  display: none;
  min-width: 240px;
}

.dashboard-user-filter-wrap {
  display: none;
  min-width: 260px;
  max-width: 320px;
  margin-bottom: var(--space-md);
}

.crm-filter-label {
  display: block;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-secondary);
}

.crm-filter-select {
  width: 100%;
  min-height: 40px;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  outline: none;
  transition: var(--transition);
}

.crm-filter-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  gap: 10px;
}

.crm-filter-btn #crmUserFilterText {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crm-filter-caret {
  font-size: 10px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.crm-filter-select:hover {
  border-color: var(--border-hover);
  background: var(--bg-tertiary);
}

.crm-filter-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.08);
}

.crm-user-option {
  width: 100%;
  text-align: left;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  padding: 10px 12px;
  cursor: pointer;
  transition: var(--transition);
}

.crm-user-option:hover {
  border-color: var(--border-hover);
  background: var(--bg-tertiary);
}

.crm-user-option.active {
  border-color: var(--accent);
  background: rgba(0, 0, 0, 0.04);
}

.kanban-container {
  width: 100%;
  overflow-x: hidden;
  overflow-y: visible;
  padding: var(--space-sm) 0;
  position: relative;
}

.kanban-board-wrapper {
  width: 100%;
  overflow-x: hidden;
  overflow-y: visible;
  padding-bottom: var(--space-sm);
  position: relative;
}

.kanban-board {
  display: flex;
  gap: var(--space-sm);
  padding: 0;
  width: 100%;
  align-items: flex-start;
  flex-wrap: nowrap;
}

.kanban-column {
  flex: 1;
  min-width: 0;
  width: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  box-shadow: 0 2px 4px var(--shadow);
  transition: var(--transition);
  height: fit-content;
  max-height: 75vh;
}

.kanban-column:hover {
  box-shadow: 0 4px 8px var(--shadow);
}

.kanban-column-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-sm);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.column-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.column-badge {
  background: var(--accent);
  color: var(--bg-primary);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  min-width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.kanban-items {
  flex: 1;
  min-height: 150px;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  padding-top: var(--space-sm);
  overflow-y: auto;
  overflow-x: hidden;
  max-height: 65vh;
}

.kanban-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: var(--space-sm);
  cursor: grab;
  transition: var(--transition);
  position: relative;
  box-shadow: 0 1px 2px var(--shadow);
  font-size: 13px;
}

.kanban-item:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px var(--shadow);
}

.kanban-item.dragging {
  opacity: 0.6;
  cursor: grabbing;
  transform: rotate(2deg);
}

.item-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.item-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.btn-icon-small {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
}

.btn-icon-small:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-sm);
  gap: var(--space-sm);
}

.item-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  line-height: 1.3;
  word-wrap: break-word;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}

.item-status {
  font-size: 10px;
  padding: 4px 8px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  color: var(--text-secondary);
  text-transform: uppercase;
  font-weight: 600;
  flex-shrink: 0;
  white-space: nowrap;
}

.item-meta {
  font-size: 11px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--text-secondary);
  margin-top: var(--space-sm);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--border-color);
}

.item-meta span {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

/* Tables */
.table-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table thead {
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
}

.table th {
  padding: var(--space-md);
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.table td {
  padding: var(--space-md);
  border-bottom: 1px solid var(--border-color);
  font-size: 14px;
  color: var(--text-primary);
}

.table tbody tr {
  transition: var(--transition);
}

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

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

/* Badges */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-success {
  background: rgba(40, 167, 69, 0.1);
  color: var(--success);
}

.badge-warning {
  background: rgba(255, 193, 7, 0.1);
  color: #856404;
}

.badge-error {
  background: rgba(220, 53, 69, 0.1);
  color: var(--error);
}

.badge-danger {
  background: rgba(220, 53, 69, 0.1);
  color: #dc3545;
}

.badge-secondary {
  background: rgba(108, 117, 125, 0.1);
  color: #6c757d;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: var(--space-lg);
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
  backdrop-filter: blur(4px);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 900px;
  max-height: 95vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px var(--shadow-lg);
  transform: scale(0.95);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
}

.modal.modal-large {
  max-width: 1200px;
}

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

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

.modal-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.btn-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: var(--transition);
  font-size: 20px;
}

.btn-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.modal-body {
  padding: var(--space-xl);
  flex: 1;
  overflow-y: auto;
}

.modal-form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-lg);
}

.modal-form-grid .form-group.full-width {
  grid-column: 1 / -1;
}

@media (max-width: 768px) {
  .modal-form-grid {
    grid-template-columns: 1fr;
  }
  
  .modal {
    max-width: 95vw;
    max-height: 90vh;
  }
  
  .modal-large {
    max-width: 95vw;
  }
  
  .stats-grid[style*="grid-template-columns: repeat(2, 1fr)"] {
    grid-template-columns: 1fr !important;
  }
  
  .section > div[style*="grid-template-columns: repeat(2, 1fr)"] {
    grid-template-columns: 1fr !important;
  }
}

.modal-footer {
  padding: var(--space-xl);
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-md);
}

/* Calendar */
.calendar {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
}

.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-lg);
}

.calendar-nav {
  display: flex;
  gap: var(--space-md);
  align-items: center;
}

.calendar-month {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: var(--space-xs);
}

.calendar-day-header {
  text-align: center;
  padding: var(--space-md);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.calendar-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  font-size: 14px;
  color: var(--text-primary);
  position: relative;
}

.calendar-day:hover {
  background: var(--bg-hover);
  border-color: var(--border-hover);
}

.calendar-day.other-month {
  color: var(--text-muted);
}

.calendar-day.today {
  background: var(--bg-tertiary);
  border-color: var(--accent);
  font-weight: 600;
}

.calendar-day.has-event {
  position: relative;
  background: var(--bg-tertiary);
  border-color: var(--accent);
  cursor: pointer;
}

.calendar-day.has-event::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
}

.calendar-day.has-event:hover {
  background: var(--accent);
  color: var(--bg-primary);
  z-index: 10;
}

.calendar-day.has-event:hover::after {
  background: var(--bg-primary);
}

/* Tooltip customizado para calendário */
.calendar-day[data-tooltip] {
  position: relative;
}

/* Tooltip aparece no hover usando ::before */
.calendar-day[data-tooltip]:hover::before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 12px;
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 12px var(--shadow);
  white-space: pre-line;
  font-size: 12px;
  line-height: 1.5;
  z-index: 1000;
  min-width: 200px;
  max-width: 300px;
  pointer-events: none;
  text-align: left;
  word-wrap: break-word;
}

/* Seta do tooltip - usar um elemento separado */
.calendar-day[data-tooltip]:hover {
  position: relative;
}

.calendar-day[data-tooltip]:hover::after {
  /* Quando em hover, o ::after vira a seta do tooltip */
  content: '';
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid var(--border-color);
  z-index: 1001;
  pointer-events: none;
  /* Remover o ponto indicador quando mostrar tooltip */
  background: transparent;
  border-radius: 0;
}

/* Manter o ponto indicador quando não está em hover */
.calendar-day.has-event:not(:hover)::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
  z-index: 1;
}

/* Autocomplete */
.autocomplete-wrapper {
  position: relative;
  width: 100%;
}

.autocomplete-input {
  width: 100%;
  padding: 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px;
  transition: var(--transition);
}

.autocomplete-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}

.autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 12px var(--shadow);
  max-height: 300px;
  overflow-y: auto;
  z-index: 1000;
  margin-top: 4px;
}

.autocomplete-item {
  padding: 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-color);
  transition: var(--transition);
}

.autocomplete-item:last-child {
  border-bottom: none;
}

.autocomplete-item:hover {
  background: var(--bg-hover);
}

.autocomplete-item[data-id] {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Responsive */
@media (max-width: 1400px) {
  .kanban-board {
    grid-template-columns: repeat(3, minmax(280px, 1fr));
  }
}

@media (max-width: 1024px) {
  .kanban-board {
    grid-template-columns: repeat(2, minmax(280px, 1fr));
  }
  
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  #section-crm .section-header {
    gap: var(--space-md);
  }
  
  #section-crm .section-header h2 {
    font-size: 16px;
  }
  
  #section-crm .section-header p {
    font-size: 12px;
  }
  
  .kanban-column {
    min-width: 280px;
    width: 280px;
    max-height: 550px;
  }
  
  .kanban-items {
    max-height: 450px;
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: var(--transition);
    width: 280px;
  }
  
  .sidebar.active {
    transform: translateX(0);
  }
  
  .main-content {
    margin-left: 0;
    width: 100%;
  }
  
  .topbar {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .topbar-actions {
    min-width: fit-content;
  }
  
  .topbar {
    padding: var(--space-md) var(--space-lg);
    flex-wrap: wrap;
    gap: var(--space-md);
  }
  
  .topbar-title {
    font-size: 20px;
  }
  
  .topbar-actions {
    flex-wrap: wrap;
    gap: var(--space-sm);
  }
  
  .search-box {
    order: 2;
    width: 100%;
  }
  
  .search-box input {
    width: 100%;
  }
  
  .content-area {
    padding: var(--space-lg);
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }
  
  .kanban-board {
    display: flex;
    flex-direction: column;
    width: 100%;
  }
  
  .kanban-column {
    min-width: 100%;
    width: 100%;
    max-width: 100%;
  }
  
  .kanban-container {
    overflow-x: visible;
  }
  
  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-md);
  }
  
  .section-header .btn-primary {
    width: 100%;
    justify-content: center;
  }
  
  #section-crm .section-header {
    flex-wrap: wrap;
    gap: var(--space-sm);
  }
  
  #section-crm .section-header > div:first-child {
    min-width: 0;
    flex: 1 1 100%;
  }
  
  #section-crm .section-header .btn-primary {
    flex: 1 1 auto;
    min-width: 150px;
    justify-content: center;
  }

  .crm-actions {
    width: 100%;
    flex-wrap: wrap;
    align-items: stretch;
  }

  #crmUserFilterWrap {
    flex: 1 1 100%;
    min-width: 0;
  }

  .dashboard-user-filter-wrap {
    min-width: 0;
    max-width: 100%;
  }
  
  .kanban-board {
    flex-wrap: wrap;
    gap: var(--space-xs);
  }
  
  .kanban-column {
    flex: 1 1 calc(50% - 8px);
    min-width: 0;
    max-height: 60vh;
  }
  
  .kanban-items {
    max-height: 50vh;
  }
  
  .section-title {
    font-size: 18px;
  }
}

@media (max-width: 480px) {
  .kanban-column {
    padding: var(--space-md);
  }
  
  .topbar-title {
    font-size: 18px;
  }
  
  .btn-primary, .btn-secondary {
    padding: 10px var(--space-md);
    font-size: 13px;
  }
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--bg-hover);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-hover);
}

/* Utilities */
.hidden {
  display: none !important;
}

.text-center {
  text-align: center;
}

.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }

/* Modal Tabs */
.modal-tabs {
  display: flex;
  gap: var(--space-sm);
  border-bottom: 2px solid var(--border-color);
  margin-bottom: var(--space-lg);
  padding-bottom: 0;
}

.modal-tab {
  background: transparent;
  border: none;
  padding: var(--space-md) var(--space-lg);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: var(--transition);
  position: relative;
}

.modal-tab:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.modal-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.modal-tab-content {
  display: none;
}

.modal-tab-content.active {
  display: block;
}

/* Timeline */
.timeline-container {
  max-height: 600px;
  overflow-y: auto;
  padding-right: var(--space-sm);
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-lg);
}

.timeline-header h4 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.btn-sm {
  padding: var(--space-sm) var(--space-md);
  font-size: 13px;
  height: auto;
}

.timeline-list {
  position: relative;
  padding-left: var(--space-xl);
}

.timeline-list::before {
  content: '';
  position: absolute;
  left: 10px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border-color);
}

.timeline-empty {
  text-align: center;
  padding: var(--space-2xl);
  color: var(--text-secondary);
}

.timeline-item {
  position: relative;
  margin-bottom: var(--space-lg);
  padding-left: var(--space-lg);
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -5px;
  top: 6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bg-primary);
  border: 2px solid var(--accent);
  z-index: 1;
}

.timeline-item-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  transition: var(--transition);
}

.timeline-item-content:hover {
  border-color: var(--border-hover);
  box-shadow: 0 2px 8px var(--shadow);
}

.timeline-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-sm);
  gap: var(--space-md);
}

.timeline-item-type {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.timeline-item-type svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.timeline-item-date {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.timeline-item-subject {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
}

.timeline-item-description {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.timeline-item-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--space-sm);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--border-color);
  font-size: 12px;
  color: var(--text-muted);
}

.timeline-item-direction {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
}

.timeline-item-direction.entrada {
  background: #e7f3ff;
  color: #0056b3;
}

.timeline-item-direction.saida {
  background: #f0f9f4;
  color: #155724;
}

.timeline-item-actions {
  display: flex;
  gap: var(--space-xs);
}

.timeline-item-action {
  background: transparent;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: var(--transition);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
}

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

.timeline-item-action svg {
  width: 14px;
  height: 14px;
}

/* Permission Tabs */
.permission-tab-content {
  display: none !important;
}

.permission-tab-content.active {
  display: block !important;
}

/* Roles Grid */
.roles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-lg);
}

.role-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  transition: var(--transition);
}

.role-card:hover {
  border-color: var(--border-hover);
  box-shadow: 0 2px 8px var(--shadow);
}

.role-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-md);
}

.role-card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.role-card-desc {
  font-size: 13px;
  color: var(--text-secondary);
}

.role-card-actions {
  display: flex;
  gap: var(--space-xs);
}

.role-permissions-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-top: var(--space-md);
}

.role-permission-badge {
  padding: 4px 8px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  font-size: 11px;
  color: var(--text-secondary);
}

/* Permissões Container */
.permissoes-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.permissao-categoria {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--space-md);
}

.permissao-categoria-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 2px solid var(--border-color);
}

.permissao-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-sm);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-xs);
}

.permissao-item:hover {
  background: var(--bg-hover);
}

.permissao-item-info {
  flex: 1;
}

.permissao-item-codigo {
  font-size: 12px;
  font-family: 'Courier New', monospace;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Audit Timeline */
.audit-timeline-container {
  max-height: 600px;
  overflow-y: auto;
  padding-right: var(--space-sm);
}

.audit-item {
  position: relative;
  margin-bottom: var(--space-lg);
  padding-left: var(--space-xl);
}

.audit-item::before {
  content: '';
  position: absolute;
  left: 10px;
  top: 6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--bg-primary);
  border: 2px solid var(--accent);
  z-index: 1;
}

.audit-item-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  transition: var(--transition);
}

.audit-item-content:hover {
  border-color: var(--border-hover);
  box-shadow: 0 2px 8px var(--shadow);
}

.audit-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-sm);
  gap: var(--space-md);
}

.audit-item-user {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
}

.audit-item-date {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.audit-item-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: var(--space-xs);
}

.audit-item-action.create {
  background: #e7f5e9;
  color: #2e7d32;
}

.audit-item-action.update {
  background: #e3f2fd;
  color: #1565c0;
}

.audit-item-action.delete {
  background: #ffebee;
  color: #c62828;
}

.audit-item-action.view {
  background: #f3e5f5;
  color: #6a1b9a;
}

.audit-item-modulo {
  display: inline-block;
  padding: 2px 8px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-left: var(--space-sm);
}

.audit-item-description {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: var(--space-sm);
}

.audit-item-details {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: var(--space-sm);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--border-color);
}

.audit-item-details-toggle {
  cursor: pointer;
  color: var(--accent);
  text-decoration: underline;
  font-size: 12px;
}

.audit-item-details-content {
  margin-top: var(--space-sm);
  padding: var(--space-sm);
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  font-family: 'Courier New', monospace;
  font-size: 11px;
  max-height: 200px;
  overflow-y: auto;
  display: none;
}

.audit-item-details-content.show {
  display: block;
}

/* Checkbox Grid for Permissions */
.permission-checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: var(--space-sm);
  padding: var(--space-sm);
}

.permission-checkbox-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.permission-checkbox-item:hover {
  background: var(--bg-hover);
}

.permission-checkbox-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.permission-checkbox-item label {
  flex: 1;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}

.permission-checkbox-item .permission-code {
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'Courier New', monospace;
}

/* ============================================
   NOTIFICAÇÕES
   ============================================ */
.notifications-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.notification-toast {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  min-width: 300px;
  max-width: 400px;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOutRight {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

/* ============================================
   TAREFAS
   ============================================ */
.tarefas-container {
  padding: var(--space-lg);
}

.filtros-tarefas {
  display: flex;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
  align-items: center;
}

.tarefas-lista {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.tarefa-card {
  padding: var(--space-lg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  transition: var(--transition);
}

.tarefa-card:hover {
  box-shadow: 0 2px 8px var(--shadow);
  border-color: var(--border-hover);
}

.tarefa-card h4 {
  margin: 0 0 var(--space-xs) 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.btn-sm {
  padding: var(--space-xs) var(--space-sm);
  font-size: 13px;
  border-radius: var(--radius-sm);
}

.btn-danger {
  background: var(--error);
  color: white;
  border: none;
}

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

/* ============================================
   PRELOADER - Entrada simples (Elite)
   ============================================ */

.preloader {
  position: fixed;
  inset: 0;
  background: #0a0a0a;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.preloader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.preloader-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  text-align: center;
}

.preloader-logo-wrapper {
  margin-bottom: 0.25rem;
}

.preloader-logo {
  height: 48px;
  width: auto;
  object-fit: contain;
  opacity: 0.95;
}

.preloader-brand {
  font-size: 1.25rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.02em;
  margin: 0;
}

.preloader-welcome {
  font-size: 0.9375rem;
  color: rgba(255, 255, 255, 0.7);
  margin: 0;
  font-weight: 400;
}

.preloader-welcome-text {
  font-weight: 500;
}

.preloader-spinner {
  position: relative;
  width: 24px;
  height: 24px;
  margin: 0.5rem 0 0;
}

.preloader-spinner .spinner-ring {
  position: absolute;
  width: 24px;
  height: 24px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-top-color: #fff;
  border-radius: 50%;
  animation: preloaderSpin 0.8s linear infinite;
}

.preloader-progress {
  width: 160px;
  height: 2px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 1px;
  overflow: hidden;
  margin-top: 1.25rem;
}

.preloader-progress .progress-bar {
  height: 100%;
  background: #fff;
  border-radius: 1px;
  width: 0%;
  animation: progressLoad 2.5s ease-out forwards;
}

@keyframes preloaderSpin {
  to { transform: rotate(360deg); }
}

/* Animações */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

@keyframes logoPulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

@keyframes logoFloat {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@keyframes progressLoad {
  0% {
    width: 0%;
  }
  40% {
    width: 50%;
  }
  80% {
    width: 85%;
  }
  100% {
    width: 100%;
  }
}

@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

@keyframes rotate {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@keyframes nameGlow {
  0%, 100% {
    text-shadow: 0 2px 20px rgba(255, 255, 255, 0.3), 0 0 30px rgba(255, 255, 255, 0.2);
  }
  50% {
    text-shadow: 0 2px 30px rgba(255, 255, 255, 0.5), 0 0 50px rgba(255, 255, 255, 0.4);
  }
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

/* Animação de entrada do dashboard */
.dashboard-wrapper {
  transition: opacity 1.2s cubic-bezier(0.4, 0, 0.2, 1), transform 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.dashboard-wrapper.loaded {
  opacity: 1 !important;
  transform: translateY(0);
}

.dashboard-wrapper:not(.loaded) {
  transform: translateY(20px);
}

/* ============================================
   Bylola - Assistente IA (página inteira como CRM, Agenda, etc.)
   ============================================ */

/* Quando Bylola está ativa: ocupa o lado direito inteiro, sem bordas nem caixa */
.content-area.bylola-full {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 0;
}
.content-area.bylola-full #section-bylola {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
}

#section-bylola {
  padding: 0;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
}

/* Preload: ocupa toda a página à direita do menu (logo + Bem-vindo à Bylola) até carregar */
.bylola-preload-full {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-2xl);
  background: var(--bg-secondary);
  perspective: 800px;
}
.bylola-preload-full .bylola-preload-logo {
  width: 160px;
  height: auto;
  object-fit: contain;
  animation: bylolaLogoEntrada 1.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes bylolaLogoEntrada {
  0% {
    opacity: 0;
    transform: scale(0.35) translateZ(-120px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateZ(0);
  }
}

.bylola-page {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: 0 2px 8px var(--shadow);
}

/* Abas Chat | CRM WhatsApp */
.bylola-tabs {
  display: flex;
  gap: 0;
  padding: 0 var(--space-md);
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
  flex-shrink: 0;
}

.bylola-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 20px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.bylola-tab:hover {
  color: var(--text-primary);
  background: rgba(0, 0, 0, 0.03);
}

.bylola-tab.active {
  color: var(--text-primary);
  font-weight: 600;
  border-bottom-color: var(--accent);
}

.bylola-tab svg {
  flex-shrink: 0;
  opacity: 0.85;
}

/* Views: Chat vs WhatsApp */
.bylola-view {
  display: none;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  flex-direction: row;
}

.bylola-view.active {
  display: flex;
}

.bylola-view-chat {
  flex-direction: row;
}

/* CRM WhatsApp - layout */
.bylola-view-whatsapp {
  background: var(--bg-secondary);
}

.bylola-wpp-sidebar {
  width: 300px;
  min-width: 300px;
  background: var(--bg-card);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.bylola-wpp-config {
  padding: var(--space-md);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.bylola-wpp-config-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin: 0 0 12px 0;
}

.bylola-wpp-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin: 0 0 4px 0;
}

.bylola-wpp-input,
.bylola-wpp-textarea {
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  box-sizing: border-box;
}

.bylola-wpp-input:focus,
.bylola-wpp-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.06);
}

.bylola-wpp-textarea {
  min-height: 80px;
  resize: vertical;
}

.bylola-wpp-btn-save {
  width: 100%;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s ease;
}

.bylola-wpp-btn-save:hover {
  background: var(--accent-dark);
}

.bylola-wpp-btn-save:active {
  transform: scale(0.98);
}

.bylola-wpp-btn-qr {
  width: 100%;
  padding: 10px 16px;
  margin-top: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  background: transparent;
  border: 1px solid var(--accent);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.bylola-wpp-btn-qr:hover {
  background: var(--accent);
  color: #fff;
}

.bylola-wpp-qr-wrap {
  margin-top: 12px;
  text-align: center;
  padding: 12px;
  background: var(--bg-secondary);
  border-radius: 10px;
}

.bylola-wpp-qr-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0 0 8px 0;
}

.bylola-wpp-qr-img {
  max-width: 220px;
  height: auto;
  display: block;
  margin: 0 auto;
}

.bylola-wpp-conversations-wrap {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding-top: 12px;
}

.bylola-wpp-conv-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin: 0 0 8px 0;
  padding: 0 12px;
}

.bylola-wpp-conversations {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bylola-wpp-conv-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 10px;
  border-radius: 10px;
  cursor: pointer;
  color: var(--text-primary);
  font-size: 13px;
  text-align: left;
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  transition: background 0.2s ease, border-color 0.2s ease;
  box-sizing: border-box;
}

.bylola-wpp-conv-item:hover {
  background: var(--bg-hover);
  border-color: var(--border-hover);
}

.bylola-wpp-conv-item.active {
  background: var(--bg-active);
  border-color: var(--accent);
  font-weight: 500;
  box-shadow: 0 0 0 1px var(--accent);
}

.bylola-wpp-conv-item-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 14px;
}

.bylola-wpp-conv-item-body {
  flex: 1;
  min-width: 0;
}

.bylola-wpp-conv-item-name {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bylola-wpp-conv-item-preview {
  font-size: 12px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 2px;
}

.bylola-wpp-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--bg-card);
}

.bylola-wpp-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--text-muted);
  font-size: 14px;
  padding: var(--space-2xl);
}

.bylola-wpp-empty svg {
  opacity: 0.4;
}

.bylola-wpp-empty p {
  margin: 0;
  text-align: center;
  max-width: 280px;
}

.bylola-wpp-thread {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.bylola-wpp-thread-header {
  padding: 14px var(--space-xl);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.bylola-wpp-thread-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.bylola-wpp-thread-phone {
  font-size: 12px;
  color: var(--text-secondary);
}

.bylola-wpp-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bylola-wpp-msg {
  display: flex;
  gap: 10px;
  max-width: 75%;
  align-self: flex-start;
}

.bylola-wpp-msg.outgoing {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.bylola-wpp-msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.bylola-wpp-msg.outgoing .bylola-wpp-msg-avatar {
  background: var(--accent);
  color: #fff;
}

.bylola-wpp-msg-content {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.45;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.bylola-wpp-msg.outgoing .bylola-wpp-msg-content {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.bylola-wpp-msg-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

@media (max-width: 768px) {
  .bylola-view-whatsapp { flex-direction: column; }
  .bylola-wpp-sidebar { width: 100%; min-width: 0; max-height: 50vh; }
}

.content-area.bylola-full .bylola-page {
  border-radius: 0;
  border: none;
  box-shadow: none;
}

.bylola-sidebar {
  width: 260px;
  min-width: 260px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.bylola-sidebar-header {
  padding: 14px var(--space-md);
  border-bottom: 1px solid var(--border-color);
  min-height: 72px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.bylola-btn-new {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.bylola-btn-new:hover {
  background: var(--bg-hover);
  border-color: var(--border-hover);
}

.bylola-conversations-wrap {
  flex: 1;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-top: 20px;
}

.bylola-conversations-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin: 0 0 8px 0;
  padding: 0 10px;
  flex-shrink: 0;
}

.bylola-conversations {
  flex: 1;
  min-height: 0;
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bylola-conv-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px;
  border-radius: 10px;
  cursor: pointer;
  color: var(--text-primary);
  font-size: 13px;
  transition: var(--transition);
  text-align: left;
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  box-sizing: border-box;
  flex-shrink: 0;
}

.bylola-conv-item:hover {
  background: var(--bg-hover);
  border-color: var(--border-hover);
}

.bylola-conv-item.active {
  background: var(--bg-active);
  border-color: var(--accent);
  font-weight: 600;
  box-shadow: 0 0 0 1px var(--accent);
}

.bylola-conv-item .bylola-conv-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}
.bylola-conv-item.active .bylola-conv-icon {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.bylola-conv-item span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bylola-conv-item .bylola-conv-delete {
  flex-shrink: 0;
  opacity: 0.5;
  width: 24px;
  height: 24px;
  min-width: 24px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
  transition: var(--transition);
}
.bylola-conv-item .bylola-conv-delete:hover { opacity: 1; color: var(--error); background: rgba(0,0,0,0.06); }

.bylola-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.bylola-header {
  padding: 14px var(--space-xl);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
  min-height: 72px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.bylola-title { font-size: 18px; font-weight: 700; margin: 0; color: var(--text-primary); }
.bylola-subtitle { font-size: 12px; color: var(--text-secondary); margin: 2px 0 0 0; }

.bylola-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: var(--space-xl);
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.bylola-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-2xl) var(--space-xl);
  min-height: 100%;
  box-sizing: border-box;
}

.bylola-welcome-prompt {
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin: 0 0 var(--space-xl) 0;
}

.bylola-welcome-input-modal {
  position: relative;
  width: 100%;
  max-width: 560px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 28px;
  padding: 18px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

.bylola-welcome-input-modal .bylola-welcome-input-row {
  display: flex;
  align-items: flex-end;
  gap: 14px;
}
.bylola-welcome-input {
  flex: 1;
  min-height: 46px;
  max-height: 140px;
  padding: 12px 4px 8px 4px;
  border: none;
  background: transparent;
  font-size: 15px;
  line-height: 1.45;
  font-family: inherit;
  color: var(--text-primary);
  resize: none;
}
.bylola-welcome-input::placeholder { color: var(--text-muted); }
.bylola-welcome-input:focus { outline: none; }

.bylola-welcome-send {
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}
.bylola-welcome-send:hover { background: var(--accent-dark); transform: scale(1.05); }

.bylola-welcome-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding-top: 2px;
}
.bylola-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}
.bylola-chip:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-hover);
}
.bylola-chip svg { flex-shrink: 0; opacity: 0.85; }
.bylola-chip-right { margin-left: auto; }

.bylola-context-info { margin-top: var(--space-lg); }

/* Nova conversa: esconde o input de baixo; após primeira mensagem mostra */
.bylola-main.bylola-new-conversation .bylola-input-wrap { display: none !important; }

.bylola-msg {
  display: flex;
  gap: var(--space-md);
  max-width: 85%;
  align-self: flex-start;
}

.bylola-msg.assistant { align-self: flex-start; }
.bylola-msg.user { align-self: flex-end; flex-direction: row-reverse; }

.bylola-msg-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.bylola-msg.user .bylola-msg-avatar { background: var(--accent); color: #fff; }

.bylola-msg-content {
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-lg);
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.bylola-msg.user .bylola-msg-content {
  background: var(--accent);
  color: #fff;
}

.bylola-msg.assistant .bylola-msg-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.bylola-msg-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.bylola-typing {
  padding: var(--space-md) var(--space-xl);
  display: flex;
  gap: 4px;
  align-items: center;
  flex-shrink: 0;
}

.bylola-typing span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: bylolaTyping 1.4s ease-in-out infinite both;
}

.bylola-typing span:nth-child(1) { animation-delay: 0s; }
.bylola-typing span:nth-child(2) { animation-delay: 0.2s; }
.bylola-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bylolaTyping {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
  40% { transform: scale(1); opacity: 1; }
}

.bylola-input-wrap {
  padding: var(--space-lg) var(--space-xl);
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: var(--space-md);
  align-items: flex-end;
  background: var(--bg-card);
  flex-shrink: 0;
}

.bylola-input {
  flex: 1;
  min-height: 44px;
  max-height: 160px;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  font-size: 14px;
  font-family: inherit;
  resize: none;
  background: var(--bg-primary);
  color: var(--text-primary);
  transition: var(--transition);
}

.bylola-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(0,0,0,0.1);
}

.bylola-send {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius-md);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}

.bylola-send:hover:not(:disabled) {
  background: var(--accent-dark);
  transform: scale(1.05);
}

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

@media (max-width: 768px) {
  .bylola-page { flex-direction: column; }
  .bylola-sidebar { width: 100%; min-width: 0; max-height: 160px; flex-shrink: 0; }
  .bylola-conversations-wrap { min-height: 0; }
  .bylola-conversations { flex: 1; min-height: 0; overflow-y: auto; }
}
