/* ============================================
   CRM Frontend - Lightweight CSS Structure
   ============================================ */

/* Base Styles */
* {
  box-sizing: border-box;
}

body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 20px;
  background-color: #f5f5f5;
  color: #333;
}

/* ============================================
   Login Page Styles
   ============================================ */

.login-container {
  max-width: 420px;
  margin: 80px auto;
  padding: 40px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

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

.product-name {
  font-size: 42px;
  font-weight: 700;
  margin: 0 0 8px 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -1px;
}

.product-tagline {
  font-size: 14px;
  color: #666;
  margin: 0 0 24px 0;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.login-container h2 {
  margin: 0 0 32px 0;
  font-size: 24px;
  font-weight: 600;
  color: #1a1a1a;
}

.form-group {
  margin-bottom: 20px;
}

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

.form-group input {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
}

.form-group input:focus {
  outline: none;
  border-color: #4a90e2;
}

.btn {
  width: 100%;
  padding: 12px;
  background-color: #4a90e2;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 16px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn:hover {
  background-color: #357abd;
}

.btn:active {
  background-color: #2a5f8f;
}

.error-message {
  color: #d32f2f;
  margin-top: 10px;
  padding: 10px;
  background-color: #ffebee;
  border-radius: 4px;
  font-size: 14px;
}

/* Staff List Dropdown Styles */
.staff-list-hint {
  font-size: 11px;
  font-weight: normal;
  color: #666;
  margin-left: 8px;
}

.staff-list-container {
  position: relative;
  margin-top: 8px;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: white;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  max-height: 300px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.staff-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background-color: #f8f9fa;
  border-bottom: 1px solid #ddd;
  font-weight: 600;
  font-size: 13px;
  color: #333;
}

.close-btn {
  background: none;
  border: none;
  font-size: 24px;
  line-height: 1;
  color: #666;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.close-btn:hover {
  background-color: #e0e0e0;
}

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

.staff-list-loading {
  padding: 20px;
  text-align: center;
  color: #666;
  font-size: 14px;
}

.staff-list-item {
  padding: 10px 12px;
  cursor: pointer;
  transition: background-color 0.15s;
  border-bottom: 1px solid #f0f0f0;
  font-size: 14px;
}

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

.staff-list-item:hover {
  background-color: #e8f4f8;
}

.staff-list-item.selected {
  background-color: #4a90e2;
  color: white;
}

.staff-list-empty {
  padding: 20px;
  text-align: center;
  color: #999;
  font-size: 14px;
}

/* ============================================
   Dashboard Styles
   ============================================ */

.dashboard-container {
  max-width: 1200px;
  margin: 0 auto;
  background: white;
  padding: 32px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Typography Scale */
.dashboard-container h2 {
  font-size: 28px;
  font-weight: 600;
  color: #1a1a1a;
  margin: 0;
  letter-spacing: -0.5px;
}

.dashboard-container h3 {
  font-size: 18px;
  font-weight: 600;
  color: #1a1a1a;
  margin: 0 0 16px 0;
  letter-spacing: -0.2px;
}

/* Top Bar */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 2px solid #f0f0f0;
}

.top-bar-left {
  flex: 1;
}

.dashboard-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 8px;
}

.product-name-small {
  font-size: 28px;
  font-weight: 700;
  margin: 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

.product-tagline-small {
  font-size: 12px;
  color: #999;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.user-info {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.user-greeting {
  color: #666;
  font-weight: 400;
}

.user-name {
  color: #2196f3;
  font-weight: 600;
  font-size: 15px;
}

.top-bar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* Unified Action Button Styles */
.btn-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  white-space: nowrap;
  line-height: 1.4;
}

.btn-action:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.2);
}

.btn-action:active {
  transform: translateY(1px);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Primary Action Buttons (Log Activity, Sales Pipeline, Email Settings) */
.btn-action-primary {
  background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-action-primary:hover {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
  transform: translateY(-2px);
}

.btn-action-primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(14, 165, 233, 0.2);
}

/* Logout Button */
.btn-action-logout {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-action-logout:hover {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
  transform: translateY(-2px);
}

.btn-action-logout:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(239, 68, 68, 0.2);
}

/* Button Icon */
.btn-icon {
  font-size: 16px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Legacy btn-logout class for backward compatibility */
.btn-logout {
  padding: 10px 20px;
  background-color: #d32f2f;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(211, 47, 47, 0.2);
}

.btn-logout:hover {
  background-color: #b71c1c;
  box-shadow: 0 2px 6px rgba(211, 47, 47, 0.3);
  transform: translateY(-1px);
}

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

/* Period Selector */
.period-selector {
  margin-bottom: 24px;
  padding: 20px 24px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.period-selector-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.period-selector label {
  font-weight: 600;
  color: white;
  font-size: 14px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.period-selector input[type="month"] {
  padding: 10px 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.95);
  color: #333;
  transition: all 0.2s;
  cursor: pointer;
}

.period-selector input[type="month"]:focus {
  outline: none;
  border-color: white;
  background: white;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.period-display {
  display: flex;
  align-items: center;
  gap: 8px;
  color: white;
  font-size: 15px;
  font-weight: 500;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  backdrop-filter: blur(10px);
}

.period-label {
  opacity: 0.9;
  font-weight: 500;
}

.period-range {
  font-weight: 600;
}

.period-range strong {
  font-size: 16px;
  margin-right: 8px;
}

.period-dates {
  font-size: 13px;
  opacity: 0.85;
  font-weight: 400;
}

/* Section Separators */
.section-separator {
  height: 1px;
  background: linear-gradient(to right, transparent, #e0e0e0, transparent);
  margin: 40px 0;
  border: none;
}

/* KPI Cards - Enhanced Visual Hierarchy */
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin: 32px 0;
}

.kpi {
  border: 1px solid #e8e8e8;
  padding: 28px 24px;
  border-radius: 12px;
  text-align: center;
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.kpi::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.kpi::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(102, 126, 234, 0.1) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.kpi:hover {
  box-shadow: 0 8px 24px rgba(102, 126, 234, 0.15);
  transform: translateY(-4px);
  border-color: #667eea;
}

.kpi:hover::before {
  opacity: 1;
}

.kpi:hover::after {
  opacity: 1;
}

.kpi h3 {
  margin: 0 0 16px 0;
  font-size: 13px;
  color: #666;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.kpi-value {
  font-size: 42px;
  font-weight: 700;
  color: #1a1a1a;
  margin-top: 8px;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -1px;
}

/* Variance-specific color coding */
#kpi-variance.kpi-value.positive {
  color: #2e7d32;
}

#kpi-variance.kpi-value.negative {
  color: #d32f2f;
}

/* Other KPIs - neutral colors */
.kpi-value:not(#kpi-variance) {
  color: #1a1a1a;
}

/* Charts Section */
.charts-section {
  margin: 48px 0;
  padding: 32px;
  background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
  border-radius: 12px;
  border: 1px solid #e8e8e8;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.charts-section h3 {
  margin-bottom: 24px;
  font-size: 20px;
  color: #1a1a1a;
}

.chart-container {
  margin: 32px 0;
  padding: 24px;
  background: white;
  border-radius: 12px;
  border: 1px solid #e8e8e8;
  height: 450px;
  position: relative;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  transition: box-shadow 0.3s ease;
}

.chart-container:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.chart-container canvas {
  max-height: 100%;
}

/* Staff List Section */
.staff-section {
  margin: 48px 0;
  padding: 32px;
  background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
  border-radius: 12px;
  border: 1px solid #e8e8e8;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.staff-section h3 {
  margin-bottom: 20px;
  color: #1a1a1a;
  font-size: 20px;
}

.staff-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.staff-list li {
  padding: 18px 24px;
  margin-bottom: 12px;
  background: white;
  border-left: 4px solid #667eea;
  border-radius: 10px;
  border: 1px solid #e8e8e8;
  font-size: 14px;
  line-height: 1.6;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  gap: 12px;
}

.staff-list li:hover {
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
  transform: translateX(4px);
  border-left-width: 5px;
  border-left-color: #764ba2;
}

.staff-list li:last-child {
  margin-bottom: 0;
}

/* Clients Section */
.clients-section {
  margin: 48px 0;
  padding: 32px;
  background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
  border-radius: 12px;
  border: 1px solid #e8e8e8;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.clients-section h3 {
  margin-bottom: 15px;
  color: #1a1a1a;
  font-size: 18px;
}

.clients-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.clients-list li {
  padding: 12px 16px;
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.client-name {
  font-weight: 500;
  color: #1a1a1a;
}

.lifecycle-badge {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 6px;
  border: 1px solid #ccc;
  border-radius: 3px;
  background: #f9f9f9;
}

/* Client Filters */
.client-filters {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
  padding: 16px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  flex-wrap: wrap;
  align-items: flex-end;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 180px;
}

.filter-group label {
  font-size: 13px;
  font-weight: 600;
  color: #495057;
  margin: 0;
}

.filter-select {
  padding: 10px 14px;
  border: 2px solid #e2e8f0;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  background-color: #fff;
  color: #1a1a1a;
  cursor: pointer;
  transition: all 0.2s ease;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%20viewBox%3D%220%200%20292.4%20292.4%22%3E%3Cpath%20fill%3D%22%23667eea%22%20d%3D%22M287%2C114.7L159.7%2C242c-3.2%2C3.2-8.3%2C3.2-11.5%2C0L5.4%2C114.7c-3.2-3.2-3.2-8.3%2C0-11.5l11.5-11.5c3.2-3.2%2C8.3-3.2%2C11.5%2C0l120.7%2C120.7l120.7-120.7c3.2-3.2%2C8.3-3.2%2C11.5%2C0l11.5%2C11.5C290.2%2C106.4%2C290.2%2C111.5%2C287%2C114.7z%22%2F%3E%3C%2Fsvg%3E');
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 10px;
}

.filter-select:hover {
  border-color: #cbd5e1;
  background-color: #fafafa;
}

.filter-select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
  background-color: #fff;
}

/* Clients Admin Page */
.clients-admin-section {
  margin-top: 30px;
}

.clients-admin-section h3 {
  margin-bottom: 20px;
  color: #1a1a1a;
  font-size: 20px;
}

.clients-table {
  background: white;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

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

.admin-table thead {
  background: #f5f5f5;
}

.admin-table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: #1a1a1a;
  border-bottom: 2px solid #e0e0e0;
}

.admin-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #f0f0f0;
}

.admin-table tbody tr:hover {
  background: #fafafa;
}

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

.lifecycle-select {
  padding: 6px 10px;
  border: 1px solid #d0d0d0;
  border-radius: 4px;
  font-size: 14px;
  background: white;
  cursor: pointer;
  min-width: 120px;
}

.lifecycle-select:not(.disabled):hover {
  border-color: #4a90e2;
}

.lifecycle-select:not(.disabled):focus {
  outline: none;
  border-color: #4a90e2;
  box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.1);
}

.lifecycle-select.disabled,
.lifecycle-select:disabled {
  background: #f5f5f5;
  color: #999;
  cursor: not-allowed;
  border-color: #e0e0e0;
}

.error-message {
  padding: 20px;
  background: #fee;
  border: 1px solid #fcc;
  border-radius: 4px;
  color: #c33;
  text-align: center;
}

/* Loading State */
.loading {
  text-align: center;
  padding: 20px;
  color: #666;
}

/* ============================================
   Activity Form Styles
   ============================================ */

.form-container {
  max-width: 700px;
  margin: 40px auto;
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  padding: 40px;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  border: 1px solid #e8e8e8;
}

.form-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 40px;
  padding-bottom: 24px;
  border-bottom: 2px solid #e8e8e8;
}

.form-header-content {
  flex: 1;
}

.form-header h2 {
  margin: 0 0 8px 0;
  font-size: 28px;
  font-weight: 700;
  color: #1a1a1a;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.form-subtitle {
  margin: 0;
  font-size: 14px;
  color: #64748b;
  font-weight: 400;
}

.form-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* Legacy btn-link class - kept for backward compatibility */
.btn-link {
  padding: 10px 18px;
  background-color: #f8f9fa;
  color: #495057;
  text-decoration: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s ease;
  border: 2px solid #e2e8f0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-link:hover {
  background-color: #e9ecef;
  border-color: #cbd5e1;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn-icon {
  font-size: 16px;
}

.form-group {
  margin-bottom: 28px;
  position: relative;
}

.form-group label {
  display: block;
  margin-bottom: 10px;
  font-weight: 600;
  color: #1a1a1a;
  font-size: 14px;
  letter-spacing: 0.3px;
}

.required {
  color: #d32f2f;
  margin-left: 2px;
}

.optional {
  color: #666;
  font-weight: normal;
  font-size: 12px;
  margin-left: 4px;
}

.form-group input[type="text"],
.form-group input[type="date"],
.form-group input[type="number"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  transition: all 0.2s ease;
  background-color: #fff;
  color: #1a1a1a;
}

.form-group input:hover,
.form-group select:hover,
.form-group textarea:hover {
  border-color: #cbd5e1;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
  box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.form-group input:invalid:not(:placeholder-shown),
.form-group select:invalid:not(:placeholder-shown) {
  border-color: #d32f2f;
}

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

.field-hint {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: #666;
}

/* Client Search Styles */
.client-search-wrapper {
  position: relative;
}

.client-search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #d0d0d0;
  border-top: none;
  border-radius: 0 0 6px 6px;
  max-height: 300px;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  margin-top: -1px;
}

.client-result-item {
  padding: 12px 16px;
  cursor: pointer;
  transition: background-color 0.15s;
  border-bottom: 1px solid #f0f0f0;
}

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

.client-result-item:hover,
.client-result-item.highlighted {
  background-color: #f5f5f5;
}

.client-result-name {
  font-size: 14px;
  font-weight: 600;
  color: #1a1a1a;
  display: block;
  margin-bottom: 4px;
}

.client-result-meta {
  font-size: 12px;
  color: #666;
}

.search-no-results,
.search-error {
  padding: 16px;
  text-align: center;
  color: #666;
  font-size: 14px;
}

.search-error {
  color: #d32f2f;
}

.search-add-new {
  cursor: pointer;
  padding: 0.75rem;
  margin-top: 0.5rem;
  border-top: 1px solid #e0e0e0;
  background-color: #e0f2fe;
  border-radius: 4px;
  transition: background-color 0.2s;
  text-align: center;
}

.search-add-new:hover {
  background-color: #bae6fd;
}

.search-add-new strong {
  color: #0284c7;
  font-size: 0.95rem;
}

.selected-client {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background-color: #e8f5e9;
  border: 1px solid #4caf50;
  border-radius: 6px;
  margin-top: 8px;
}

.selected-client-name {
  font-size: 14px;
  font-weight: 500;
  color: #2e7d32;
  flex: 1;
}

.btn-clear-selection {
  background: none;
  border: none;
  font-size: 24px;
  color: #666;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s;
  line-height: 1;
}

.btn-clear-selection:hover {
  background-color: rgba(0, 0, 0, 0.1);
  color: #333;
}

.client-search-wrapper input:focus + input + .client-search-dropdown {
  border-color: #4a90e2;
}

.char-counter {
  margin-top: 6px;
  text-align: right;
  font-size: 12px;
  color: #666;
}

.char-counter.warning {
  color: #d32f2f;
}

.char-counter.warning span {
  font-weight: 600;
}

.form-actions-bottom {
  display: flex;
  gap: 16px;
  margin-top: 40px;
  padding-top: 32px;
  border-top: 2px solid #e8e8e8;
}

.btn-primary {
  flex: 1;
  padding: 14px 28px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
  letter-spacing: 0.3px;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  padding: 14px 28px;
  background-color: #f8f9fa;
  color: #495057;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: 0.3px;
}

.btn-secondary:hover {
  background-color: #e9ecef;
  border-color: #cbd5e1;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.message {
  margin-top: 24px;
  padding: 16px 20px;
  border-radius: 6px;
  font-size: 14px;
  line-height: 1.5;
}

.message-success {
  background-color: #e8f5e9;
  border: 1px solid #4caf50;
  color: #2e7d32;
}

.message-error {
  background-color: #ffebee;
  border: 1px solid #ef5350;
  color: #c62828;
}

.message strong {
  display: block;
  margin-bottom: 4px;
}

/* Toast Message */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  padding: 20px 24px;
  min-width: 300px;
  max-width: 400px;
  z-index: 10000;
  animation: slideIn 0.3s ease-out;
}

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

.toast-success {
  border-left: 4px solid #4caf50;
}

.toast-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toast-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.btn-toast {
  padding: 6px 12px;
  background-color: #4a90e2;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.2s;
}

.btn-toast:hover {
  background-color: #357abd;
}

/* Responsive */
@media (max-width: 768px) {
  .kpis {
    grid-template-columns: 1fr;
  }
  
  .top-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .top-bar-actions {
    width: 100%;
    flex-wrap: wrap;
    gap: 8px;
  }

  .btn-action {
    flex: 1 1 auto;
    min-width: 140px;
    justify-content: center;
    padding: 10px 16px;
    font-size: 13px;
  }

  .btn-action-logout {
    flex: 1 1 100%;
    width: 100%;
  }

  .form-container {
    margin: 20px;
    padding: 24px;
  }

  .form-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .form-actions {
    width: 100%;
    justify-content: space-between;
  }

  .form-actions-bottom {
    flex-direction: column;
  }

  .btn-primary,
  .btn-secondary {
    width: 100%;
  }

  .toast {
    top: 10px;
    right: 10px;
    left: 10px;
    min-width: auto;
    max-width: none;
  }

  .toast-actions {
    flex-direction: column;
  }

  .btn-toast {
    width: 100%;
  }
}

/* Contact Selection Styles */
.contact-selection-wrapper {
  position: relative;
}

.contact-search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #d0d0d0;
  border-top: none;
  border-radius: 0 0 6px 6px;
  max-height: 300px;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  margin-top: -1px;
}

.selected-contact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background-color: #e3f2fd;
  border: 1px solid #2196f3;
  border-radius: 6px;
  margin-top: 8px;
}

.selected-contact-name {
  font-size: 14px;
  font-weight: 500;
  color: #1565c0;
  flex: 1;
}

.inline-contact-form {
  padding: 20px;
  background-color: #f9f9f9;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  margin-top: 12px;
}

.inline-contact-form h3 {
  margin-top: 0;
  margin-bottom: 16px;
  font-size: 16px;
  color: #333;
}

.inline-contact-error {
  margin-bottom: 16px;
  padding: 12px;
  background-color: #ffebee;
  border: 1px solid #ef5350;
  border-radius: 4px;
  color: #c62828;
  font-size: 14px;
}

.btn-link {
  background: none;
  border: none;
  color: #4a90e2;
  cursor: pointer;
  font-size: 14px;
  padding: 8px 0;
  text-decoration: underline;
  transition: color 0.2s;
}

.btn-link:hover {
  color: #357abd;
}

/* ============================================
   Email Integration Section
   ============================================ */
.email-integration-section {
  margin: 30px 0;
}

.email-integration-card {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.email-integration-description {
  color: #64748b;
  line-height: 1.6;
  margin: 0 0 16px 0;
}

.email-integration-actions {
  text-align: center;
}

/* ============================================
   Calendar Integration Section
   ============================================ */
.calendar-integration-section {
  margin: 30px 0;
}

.calendar-integration-card {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.calendar-integration-description {
  color: #64748b;
  line-height: 1.6;
  margin: 0 0 16px 0;
}

.calendar-integration-actions {
  text-align: center;
}

/* Staff Selector Styles (Hi-Tech) */
.staff-selector-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.staff-selector {
  width: 100%;
  padding: 14px 50px 14px 16px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  transition: all 0.3s ease;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  color: #1a1a1a;
  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='%23667eea' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 12px;
  cursor: pointer;
}

.staff-selector:hover {
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
  background: linear-gradient(135deg, #ffffff 0%, #f1f5f9 100%);
}

.staff-selector:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15), 0 4px 12px rgba(102, 126, 234, 0.1);
  background: #ffffff;
}

.selector-icon {
  position: absolute;
  left: 16px;
  pointer-events: none;
  font-size: 18px;
  opacity: 0.6;
  transition: opacity 0.2s ease;
}

.staff-selector-wrapper:hover .selector-icon {
  opacity: 0.8;
}

.staff-selector-wrapper:focus-within .selector-icon {
  opacity: 1;
  transform: scale(1.1);
}

.role-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(102, 126, 234, 0.2);
}

#staffSelectorGroup .field-hint {
  color: #667eea;
  font-weight: 500;
}

/* Activities Modal Styles */
.activities-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  z-index: 10000;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.activities-modal-content {
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.activities-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 2px solid #e2e8f0;
  background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
}

.activities-modal-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: #1a1a1a;
}

.activities-modal-close {
  background: none;
  border: none;
  font-size: 32px;
  color: #666;
  cursor: pointer;
  padding: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.activities-modal-close:hover {
  background-color: #f0f0f0;
  color: #333;
}

.activities-modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.activities-loading,
.activities-error,
.activities-empty {
  text-align: center;
  padding: 40px 20px;
  color: #666;
  font-size: 16px;
}

.activities-error {
  color: #d32f2f;
}

.activities-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.activities-table thead {
  background: #f8f9fa;
  position: sticky;
  top: 0;
  z-index: 10;
}

.activities-table th {
  padding: 12px;
  text-align: left;
  font-weight: 600;
  color: #1a1a1a;
  border-bottom: 2px solid #e2e8f0;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.activities-table td {
  padding: 12px;
  border-bottom: 1px solid #f0f0f0;
  color: #333;
}

.activities-table tbody tr:hover {
  background-color: #f8f9fa;
}

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

/* Clickable staff item */
.clickable-staff-item {
  transition: all 0.2s ease;
}

.clickable-staff-item:hover {
  background-color: #e8f4f8 !important;
  color: #4a90e2 !important;
}

/* Clickable client item */
.clickable-client-item {
  transition: all 0.2s ease;
}

.clickable-client-item:hover {
  background-color: #e8f4f8 !important;
  border-color: #4a90e2 !important;
}

.clickable-client-item .client-name {
  text-decoration: underline;
  color: #4a90e2;
}