/* ========================================
   COCINAS ALBUFERA CRM — Styles
   ======================================== */

:root {
  --primary: #1a1f36;
  --primary-light: #252b48;
  --accent: #c9a84c;
  --accent-light: #dfc06e;
  --accent-dark: #a88a35;
  --bg: #f4f5f7;
  --bg-card: #ffffff;
  --text: #1a1f36;
  --text-secondary: #6b7280;
  --text-light: #9ca3af;
  --border: #e5e7eb;
  --border-light: #f3f4f6;
  --success: #10b981;
  --success-bg: #ecfdf5;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --info: #3b82f6;
  --info-bg: #eff6ff;
  --wa-green: #25D366;
  --wa-light: #dcf8c6;
  --wa-dark: #075e54;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
  --shadow-xl: 0 20px 25px rgba(0,0,0,0.1), 0 10px 10px rgba(0,0,0,0.04);
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --transition: 0.2s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 14px; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  overflow: hidden;
  height: 100vh;
}

#app { height: 100vh; }

/* ========================================
   ANIMATIONS
   ======================================== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slideIn {
  from { opacity: 0; transform: translateX(-12px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.fade-in { animation: fadeIn 0.35s ease; }

/* ========================================
   LOGIN
   ======================================== */
.login-wrapper {
  display: flex;
  height: 100vh;
  overflow: hidden;
}
.login-left {
  flex: 1;
  background: linear-gradient(135deg, var(--primary) 0%, #0f1225 60%, #0a0d1a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.login-left::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(ellipse at 30% 50%, rgba(201,168,76,0.08) 0%, transparent 60%);
}
.login-left::after {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23c9a84c' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.login-brand-overlay {
  text-align: center;
  z-index: 1;
  animation: fadeIn 0.8s ease;
}
.login-logo {
  width: 250px;
  height: auto;
  margin-bottom: 2rem;
  filter: drop-shadow(0 4px 20px rgba(201,168,76,0.3));
}
.login-brand-title {
  font-family: 'Playfair Display', serif;
  color: #fff;
  font-size: 2.8rem;
  font-weight: 600;
  letter-spacing: -0.5px;
  margin-bottom: 0.5rem;
}
.login-brand-subtitle {
  color: var(--accent);
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: 2px;
  text-transform: uppercase;
}
.login-right {
  flex: 0 0 520px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  padding: 3rem;
}
.login-form-container {
  width: 100%;
  max-width: 380px;
  animation: fadeIn 0.6s ease 0.2s both;
}
.login-title {
  font-family: 'Playfair Display', serif;
  font-size: 2rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}
.login-desc {
  color: var(--text-secondary);
  margin-bottom: 2rem;
}
.login-form { display: flex; flex-direction: column; gap: 1.25rem; }
.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.form-group label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
}
.input-icon-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}
.input-icon-wrapper > i:first-child {
  position: absolute;
  left: 14px;
  color: var(--text-light);
  font-size: 1.1rem;
  z-index: 1;
  pointer-events: none;
}
.input-icon-wrapper input {
  width: 100%;
  padding: 0.75rem 2.5rem 0.75rem 3rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: inherit;
  transition: var(--transition);
  background: #fff;
}
.input-icon-wrapper input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(201,168,76,0.12);
}
.toggle-pw {
  position: absolute;
  right: 12px;
  cursor: pointer;
  color: var(--text-light);
  transition: var(--transition);
}
.toggle-pw:hover { color: var(--text); }

.form-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
  cursor: pointer;
}
.checkbox-label input[type="checkbox"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
}
.forgot-link {
  font-size: 0.85rem;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}
.forgot-link:hover { color: var(--accent-dark); }

.btn-login {
  width: 100%;
  padding: 0.85rem;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
}
.btn-login:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.btn-login:disabled { opacity: 0.7; cursor: not-allowed; transform: none; }

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.login-error {
  color: var(--danger);
  text-align: center;
  font-size: 0.9rem;
  background: var(--danger-bg);
  padding: 0.5rem;
  border-radius: var(--radius);
}
.login-footer {
  text-align: center;
  margin-top: 1.5rem;
  color: var(--text-light);
  font-size: 0.8rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-light);
}

/* ========================================
   APP LAYOUT
   ======================================== */
.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* SIDEBAR */
.sidebar {
  width: 260px;
  background: var(--primary);
  display: flex;
  flex-direction: column;
  transition: width 0.3s ease;
  flex-shrink: 0;
  z-index: 20;
}
.sidebar.collapsed { width: 72px; }

.sidebar-header {
  display: flex;
  align-items: center;
  padding: 1.25rem;
  gap: 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-logo {
  width: 70%;
  height: 36px;
  flex-shrink: 0;
  object-fit: contain;
}
.sidebar-brand {
  color: #fff;
  font-family: 'Playfair Display', serif;
  font-size: 1.05rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
}
.sidebar-toggle {
  margin-left: auto;
  background: none;
  border: none;
  color: rgba(255,255,255,0.5);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0.3rem;
  border-radius: 6px;
  transition: var(--transition);
  flex-shrink: 0;
}
.sidebar-toggle:hover { color: #fff; background: rgba(255,255,255,0.1); }

.sidebar-nav {
  flex: 1;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.85rem;
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.92rem;
  font-weight: 400;
  white-space: nowrap;
  position: relative;
}
.nav-item i { font-size: 1.2rem; flex-shrink: 0; }
.nav-item:hover { background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.9); }
.nav-item.active {
  background: rgba(201,168,76,0.15);
  color: var(--accent);
  font-weight: 500;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}
.nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: var(--primary);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.1rem 0.5rem;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 1rem 0.75rem;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex: 1;
  cursor: pointer;
  padding: 0.4rem;
  border-radius: var(--radius);
  transition: var(--transition);
}
.sidebar-user:hover { background: rgba(255,255,255,0.08); }
.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}
.user-info { display: flex; flex-direction: column; overflow: hidden; }
.user-name { color: #fff; font-size: 0.85rem; font-weight: 500; white-space: nowrap; }
.user-role { color: rgba(255,255,255,0.4); font-size: 0.75rem; white-space: nowrap; }
.btn-logout {
  background: none;
  border: none;
  color: rgba(255,255,255,0.4);
  cursor: pointer;
  font-size: 1.15rem;
  padding: 0.4rem;
  border-radius: 6px;
  transition: var(--transition);
}
.btn-logout:hover { color: var(--danger); background: rgba(239,68,68,0.1); }

/* MAIN CONTENT */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* TOP HEADER */
.top-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.75rem;
  background: #fff;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.header-left { display: flex; flex-direction: column; }
.page-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.3px;
}
.page-breadcrumb { color: var(--text-light); font-size: 0.85rem; }
.header-right { display: flex; align-items: center; gap: 0.75rem; }
.search-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 1rem;
  transition: var(--transition);
  width: 500px;
}
.search-bar:focus-within { border-color: var(--accent); background: #fff; }
.search-bar i { color: var(--text-light); }
.search-bar input {
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  width: 200px;
}
.header-icon-btn {
  position: relative;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem;
  cursor: pointer;
  font-size: 1.2rem;
  color: var(--text-secondary);
  transition: var(--transition);
}
.header-icon-btn:hover { background: var(--bg); color: var(--text); }
.notif-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid #fff;
}
.notifications-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  width: 340px;
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border);
  z-index: 100;
  animation: scaleIn 0.2s ease;
  margin-top: 0.5rem;
  overflow: hidden;
}
.notifications-dropdown h4 {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.95rem;
}
.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 1.25rem;
  cursor: pointer;
  transition: var(--transition);
}
.notif-item:hover { background: var(--bg); }
.notif-item i { font-size: 1.3rem; margin-top: 2px; }
.notif-item p { font-size: 0.88rem; line-height: 1.4; }
.notif-item small { color: var(--text-light); font-size: 0.78rem; }
.notif-empty { padding: 2rem; text-align: center; color: var(--text-light); }

.view-content {
  flex: 1;
  overflow-y: auto;
  padding: 1.75rem;
}

/* ========================================
   STATS & CARDS
   ======================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  transition: var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.stat-info { display: flex; flex-direction: column; flex: 1; }
.stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1.2; }
.stat-label { font-size: 0.82rem; color: var(--text-secondary); }
.stat-trend {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 0.15rem;
}
.stat-trend.up { background: var(--success-bg); color: var(--success); }
.stat-trend.down { background: var(--danger-bg); color: var(--danger); }

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.card {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  overflow: hidden;
}
.card-lg { grid-column: span 1; }
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-light);
}
.card-header h3 {
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Appointments */
.appointments-list { padding: 0.5rem 0; }
.appointment-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  transition: var(--transition);
}
.appointment-row:hover { background: var(--bg); }
.apt-date-badge {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid var(--border);
}
.apt-day { font-size: 1.15rem; font-weight: 700; line-height: 1.1; }
.apt-month { font-size: 0.7rem; color: var(--text-secondary); text-transform: uppercase; font-weight: 600; }
.apt-info { flex: 1; }
.apt-info strong { display: block; font-size: 0.92rem; }
.apt-info span { font-size: 0.82rem; color: var(--text-secondary); }
.apt-status {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
  white-space: nowrap;
}
.status-confirmed { background: var(--success-bg); color: var(--success); }
.status-pending { background: var(--warning-bg); color: var(--warning); }
.status-completed { background: var(--info-bg); color: var(--info); }
.status-cancelled { background: var(--danger-bg); color: var(--danger); }
.status-postponed { background: var(--warning-bg); color: var(--warning); }
.status-no_show { background: var(--danger-bg); color: var(--danger); }

/* Operations */
.operations-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.ops-card {
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  border-left: 3px solid var(--success);
}
.ops-card.warning { border-left-color: var(--warning); background: #fffaf0; }
.ops-label {
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.ops-card strong { font-size: 1.35rem; }
.ops-card small { color: var(--text-secondary); line-height: 1.35; }
.calendar-rules-grid,
.analytics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}
.compact-list { padding: 0.35rem 0; }
.compact-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border-light);
}
.compact-row:last-child { border-bottom: none; }
.compact-row strong { display: block; font-size: 0.9rem; }
.compact-row span { display: block; color: var(--text-secondary); font-size: 0.78rem; }
.mini-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--info-bg);
  color: var(--info);
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}
.mini-badge.warning { background: var(--warning-bg); color: var(--warning); }
.mini-badge.danger { background: var(--danger-bg); color: var(--danger); }
.mini-badge.ai { background: rgba(201,168,76,0.15); color: var(--accent-dark); }

/* Messages */
.recent-messages { padding: 0.25rem 0; }
.msg-preview {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  cursor: pointer;
  transition: var(--transition);
}
.msg-preview:hover { background: var(--bg); }
.msg-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  flex-shrink: 0;
}
.msg-info { flex: 1; min-width: 0; }
.msg-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.2rem; }
.msg-top strong { font-size: 0.9rem; }
.msg-top small { color: var(--text-light); font-size: 0.78rem; }
.msg-info p { font-size: 0.82rem; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.unread-badge {
  background: var(--wa-green);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Agents Quick */
.agents-quick { padding: 0.5rem 0; }
.agent-quick-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1.25rem;
}
.agent-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 600;
  font-size: 0.85rem;
  flex-shrink: 0;
}
.agent-qinfo { flex: 1; }
.agent-qinfo strong { display: block; font-size: 0.88rem; }
.agent-qinfo span { font-size: 0.78rem; color: var(--text-secondary); }
.agent-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.agent-status-dot.online { background: var(--success); }
.agent-status-dot.offline { background: var(--text-light); }

/* ========================================
   CALENDAR
   ======================================== */
.calendar-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}
.cal-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.cal-nav h3 {
  font-family: 'Playfair Display', serif;
  font-size: 1.25rem;
  min-width: 180px;
  text-align: center;
}
.cal-actions { display: flex; align-items: center; gap: 0.75rem; }
.cal-view-toggle {
  display: flex;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.cal-view-toggle button {
  padding: 0.5rem 1rem;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-secondary);
  font-weight: 500;
}
.cal-view-toggle button.active {
  background: var(--primary);
  color: #fff;
}
.cal-view-toggle button:hover:not(.active) {
  background: var(--bg);
}

.calendar-grid {
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.cal-weekday {
  padding: 0.75rem;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--bg);
  border-bottom: 1px solid var(--border-light);
}
.cal-day {
  min-height: 100px;
  padding: 0.5rem;
  border-right: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: var(--transition);
}
.cal-day:nth-child(7n) { border-right: none; }
.cal-day:hover { background: rgba(201,168,76,0.04); }
.cal-day.today { background: rgba(201,168,76,0.06); }
.cal-day.today .cal-day-num {
  background: var(--accent);
  color: #fff;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.cal-day.other-month { opacity: 0.35; }
.cal-day-num { font-size: 0.85rem; font-weight: 500; margin-bottom: 0.3rem; display: inline-block; }
.cal-events { display: flex; flex-direction: column; gap: 2px; }
.cal-event {
  font-size: 0.72rem;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  font-weight: 500;
}
.event-confirmed { background: var(--success-bg); color: var(--success); }
.event-pending { background: var(--warning-bg); color: var(--warning); }
.event-completed { background: var(--info-bg); color: var(--info); }
.event-cancelled { background: var(--danger-bg); color: var(--danger); }
.cal-more { font-size: 0.7rem; color: var(--text-light); padding: 0.1rem 0.4rem; }

/* Week View */
.week-view {
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  overflow-y: auto;
  max-height: calc(100vh - 260px);
  box-shadow: var(--shadow-sm);
}
.week-timeline { min-width: 100%; }
.week-hour-row { display: flex; border-bottom: 1px solid var(--border-light); min-height: 60px; }
.week-hour-label {
  width: 64px;
  padding: 0.5rem;
  font-size: 0.78rem;
  color: var(--text-light);
  text-align: right;
  flex-shrink: 0;
  border-right: 1px solid var(--border-light);
}
.week-hour-cells { display: grid; grid-template-columns: repeat(7, 1fr); flex: 1; }
.week-hour-cell {
  border-right: 1px solid var(--border-light);
  padding: 0.25rem;
  min-height: 60px;
}
.week-hour-cell:last-child { border-right: none; }
.week-event {
  font-size: 0.72rem;
  padding: 0.25rem 0.4rem;
  border-radius: 4px;
  margin-bottom: 2px;
  font-weight: 500;
}

/* List View */
.list-view .card { overflow-x: auto; }

/* ========================================
   TABLES
   ======================================== */
.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th {
  text-align: left;
  padding: 0.85rem 1.25rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 0.85rem 1.25rem;
  font-size: 0.88rem;
  border-bottom: 1px solid var(--border-light);
}
.data-table tr:hover td { background: rgba(201,168,76,0.02); }
.data-table tr:last-child td { border-bottom: none; }

.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-light);
  gap: 1rem;
}
.table-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 1rem;
  flex: 1;
  max-width: 400px;
}
.table-search i { color: var(--text-light); }
.table-search input { border: none; background: transparent; font-family: inherit; font-size: 0.9rem; outline: none; width: 100%; }
.table-filters select {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.88rem;
  background: #fff;
  cursor: pointer;
}

.client-cell { display: flex; align-items: center; gap: 0.65rem; }
.client-cell-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 600;
  font-size: 0.8rem;
  flex-shrink: 0;
}
.client-status {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
}
.cs-active { background: var(--success-bg); color: var(--success); }
.cs-prospect { background: var(--info-bg); color: var(--info); }
.cs-inactive { background: var(--border-light); color: var(--text-light); }

/* ========================================
   CHAT / CONVERSATIONS
   ======================================== */
.chat-layout {
  display: flex;
  height: calc(100vh - 140px);
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.chat-sidebar {
  width: 340px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.chat-sidebar-header {
  padding: 1rem;
  border-bottom: 1px solid var(--border-light);
}
.chat-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 1rem;
  margin-bottom: 0.75rem;
}
.chat-search i { color: var(--text-light); }
.chat-search input { border: none; background: transparent; font-family: inherit; font-size: 0.9rem; outline: none; width: 100%; }
.chat-filters {
  display: flex;
  gap: 0.5rem;
}
.chat-filters button {
  flex: 1;
  padding: 0.4rem;
  border: 1px solid var(--border);
  background: transparent;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-secondary);
}
.chat-filters button.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.chat-filters button:hover:not(.active) { background: var(--bg); }

.chat-list {
  flex: 1;
  overflow-y: auto;
}
.chat-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  cursor: pointer;
  transition: var(--transition);
  border-left: 3px solid transparent;
}
.chat-item:hover { background: var(--bg); }
.chat-item.active {
  background: rgba(201,168,76,0.06);
  border-left-color: var(--accent);
}
.chat-item-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
  flex-shrink: 0;
  position: relative;
}
.chat-item-avatar.sm { width: 36px; height: 36px; font-size: 0.85rem; }
.wa-badge {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 18px;
  height: 18px;
  background: var(--wa-green);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
}
.wa-badge i { font-size: 0.6rem; color: #fff; }

.chat-item-info { flex: 1; min-width: 0; }
.chat-item-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.15rem; }
.chat-item-top strong { font-size: 0.9rem; }
.chat-item-top small { color: var(--text-light); font-size: 0.75rem; }
.chat-item-bottom { display: flex; align-items: center; gap: 0.5rem; }
.chat-item-bottom p { flex: 1; font-size: 0.82rem; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.unread-badge-sm {
  background: var(--wa-green);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chat-window {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #f0ebe3;
  min-width: 0;
}
.chat-window-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.25rem;
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.chat-contact { display: flex; align-items: center; gap: 0.75rem; }
.chat-contact strong { font-size: 0.95rem; display: block; }
.chat-phone { font-size: 0.78rem; color: var(--text-secondary); }
.chat-window-actions { display: flex; gap: 0.25rem; }
.ai-insight-panel {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  background: #fffbeb;
  border-bottom: 1px solid rgba(201,168,76,0.25);
}
.ai-insight-panel strong {
  margin-left: 0.45rem;
  color: var(--primary);
}
.ai-insight-panel p {
  margin-top: 0.25rem;
  color: var(--text-secondary);
  font-size: 0.84rem;
}
.ai-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: flex-end;
}
.ai-tags span {
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: #fff;
  border: 1px solid rgba(201,168,76,0.35);
  color: var(--accent-dark);
  font-size: 0.72rem;
  font-weight: 600;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: url("data:image/svg+xml,%3Csvg width='200' height='200' viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23c9a84c' fill-opacity='0.02'%3E%3Cpath d='M20 20h10v10H20zM60 60h10v10H60zM100 20h10v10h-10zM140 60h10v10h-10zM20 100h10v10H20zM60 140h10v10H60zM100 100h10v10h-10zM140 140h10v10h-10zM180 20h10v10h-10zM180 100h10v10h-10zM20 180h10v10H20zM100 180h10v10h-10zM180 180h10v10h-10z'/%3E%3C/g%3E%3C/svg%3E");
}
.chat-msg { display: flex; max-width: 70%; }
.chat-msg.incoming { align-self: flex-start; }
.chat-msg.outgoing { align-self: flex-end; }
.chat-bubble {
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  line-height: 1.45;
  position: relative;
}
.incoming .chat-bubble {
  background: #fff;
  border-top-left-radius: 3px;
  box-shadow: var(--shadow-sm);
}
.outgoing .chat-bubble {
  background: var(--wa-light);
  border-top-right-radius: 3px;
}
.chat-time {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.68rem;
  color: var(--text-light);
  margin-top: 0.25rem;
  justify-content: flex-end;
}
.chat-time .read { color: #53bdeb; }

.chat-input-area {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: #fff;
  border-top: 1px solid var(--border);
}
.chat-input-area input {
  flex: 1;
  border: none;
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  padding: 0.5rem;
}
.btn-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--wa-green);
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.btn-send:hover { background: var(--wa-dark); }
.btn-send:disabled { opacity: 0.5; cursor: not-allowed; }

.chat-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #f0ebe3;
}
.empty-chat-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(37,211,102,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}
.empty-chat-icon i { font-size: 2.5rem; color: var(--wa-green); }
.chat-empty-state h3 { font-size: 1.15rem; margin-bottom: 0.25rem; }
.chat-empty-state p { color: var(--text-secondary); }

/* ========================================
   AGENTS
   ======================================== */
.view-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}
.view-subtitle { color: var(--text-secondary); font-size: 0.92rem; }

.agents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}
.agent-card {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  overflow: hidden;
  transition: var(--transition);
  border-top: 3px solid var(--border);
}
.agent-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.agent-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem;
}
.agent-card-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.2rem;
  font-weight: 700;
}
.agent-status-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
}
.agent-status-badge.online { background: var(--success-bg); color: var(--success); }
.agent-status-badge.offline { background: var(--border-light); color: var(--text-light); }

.agent-card-body {
  padding: 0 1.25rem 1.25rem;
}
.agent-card-body h4 { font-size: 1.05rem; margin-bottom: 0.15rem; }
.agent-email { font-size: 0.82rem; color: var(--text-secondary); margin-bottom: 1rem; }
.agent-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}
.agent-stat {
  text-align: center;
  padding: 0.6rem;
  background: var(--bg);
  border-radius: var(--radius);
}
.agent-stat-value { display: block; font-size: 1.15rem; font-weight: 700; }
.agent-stat-label { font-size: 0.7rem; color: var(--text-secondary); }

.agent-wa-config {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 0.85rem;
}
.agent-wa-config h5 {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--wa-dark);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.65rem;
}
.config-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.35rem 0;
  font-size: 0.82rem;
}
.config-item span:first-child { color: var(--text-secondary); }
.api-key { font-family: monospace; font-size: 0.78rem; }

.toggle-switch {
  width: 38px;
  height: 22px;
  background: var(--border);
  border-radius: 11px;
  position: relative;
  cursor: pointer;
  transition: var(--transition);
}
.toggle-switch::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  top: 2px;
  left: 2px;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}
.toggle-switch.on { background: var(--success); }
.toggle-switch.on::after { left: 18px; }

.agent-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--border-light);
}

/* ========================================
   SETTINGS
   ======================================== */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 1.25rem;
}
.settings-section {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* ========================================
   BUTTONS
   ======================================== */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.6rem 1.25rem;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.btn-primary:hover { background: var(--primary-light); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.6rem 1.25rem;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}
.btn-secondary:hover { background: var(--bg); }
.btn-sm {
  padding: 0.35rem 0.85rem;
  font-size: 0.8rem;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.btn-sm.btn-primary { background: var(--primary); color: #fff; border: none; cursor: pointer; font-family: inherit; font-weight: 500; transition: var(--transition); }
.btn-sm.btn-primary:hover { background: var(--primary-light); }
.btn-sm.btn-secondary { background: transparent; color: var(--text); border: 1px solid var(--border); cursor: pointer; font-family: inherit; font-weight: 500; transition: var(--transition); }
.btn-sm.btn-secondary:hover { background: var(--bg); }
.btn-sm.btn-danger-outline { background: transparent; color: var(--danger); border: 1px solid var(--danger); cursor: pointer; font-family: inherit; font-weight: 500; transition: var(--transition); border-radius: 6px; padding: 0.35rem 0.55rem; }
.btn-sm.btn-danger-outline:hover { background: var(--danger-bg); }

.btn-icon {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1.2rem;
  padding: 0.4rem;
  border-radius: 6px;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-icon:hover { background: var(--bg); color: var(--text); }
.btn-icon-sm {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1.05rem;
  padding: 0.3rem;
  border-radius: 4px;
  transition: var(--transition);
}
.btn-icon-sm:hover { background: var(--bg); color: var(--text); }
.btn-icon-sm.danger:hover { background: var(--danger-bg); color: var(--danger); }

/* ========================================
   FORMS & MODALS
   ======================================== */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="url"],
input[type="password"],
input[type="date"],
input[type="time"],
select,
textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.9rem;
  transition: var(--transition);
  background: #fff;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(201,168,76,0.1);
}
textarea { resize: vertical; }
.color-input {
  height: 42px;
  padding: 4px;
  cursor: pointer;
}

.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.3rem;
}
.btn-inline {
  background: none;
  border: none;
  color: var(--accent-dark);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  transition: var(--transition);
}
.btn-inline:hover { background: rgba(201,168,76,0.1); }
.btn-inline i { font-size: 0.9rem; }
.inline-new-client {
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.form-check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
  padding: 0.85rem;
  background: var(--bg);
  border-radius: var(--radius);
}
.inline-alert {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius);
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid rgba(245,158,11,0.2);
  font-size: 0.85rem;
  font-weight: 500;
}
.history-card { margin-top: 1.25rem; }
.timeline { padding: 1rem 1.25rem; }
.timeline-item {
  position: relative;
  padding: 0 0 1rem 1.25rem;
  border-left: 2px solid var(--border);
}
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before {
  content: '';
  position: absolute;
  left: -5px;
  top: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}
.timeline-item span { color: var(--text-light); font-size: 0.75rem; }
.timeline-item strong { display: block; font-size: 0.9rem; margin: 0.15rem 0; }
.timeline-item p { color: var(--text-secondary); font-size: 0.84rem; }
.analytics-bars { padding: 1.25rem; display: flex; flex-direction: column; gap: 1rem; }
.bar-row {
  display: grid;
  grid-template-columns: 140px 1fr 48px;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
}
.bar-track {
  height: 8px;
  background: var(--border-light);
  border-radius: 999px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  border-radius: inherit;
}

/* Client Files */
.files-workspace {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 1.25rem;
  align-items: start;
}
.files-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.file-card {
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1rem;
  cursor: pointer;
  transition: var(--transition);
  border-left: 3px solid transparent;
}
.file-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.file-card.active {
  border-left-color: var(--accent);
  box-shadow: var(--shadow-md);
  background: linear-gradient(180deg, #fff, #fffdf7);
}
.file-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}
.file-code {
  color: var(--accent-dark);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}
.file-card h3,
.file-detail-header h2 {
  font-family: 'Playfair Display', serif;
  letter-spacing: -0.2px;
}
.file-card h3 {
  margin-top: 0.15rem;
  font-size: 1.05rem;
}
.file-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}
.file-meta-grid small,
.file-kpi span {
  display: block;
  color: var(--text-light);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.file-meta-grid strong {
  display: block;
  color: var(--text);
  font-size: 0.84rem;
  margin-top: 0.1rem;
}
.file-progress {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-top: 0.9rem;
}
.file-progress-track {
  flex: 1;
  height: 7px;
  border-radius: 999px;
  background: var(--border-light);
  overflow: hidden;
}
.file-progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}
.file-progress span {
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 700;
}
.file-detail {
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem;
}
.file-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-light);
}
.file-detail-header h2 {
  font-size: 1.8rem;
  margin-top: 0.15rem;
}
.file-detail-header p {
  color: var(--text-secondary);
  margin-top: 0.15rem;
}
.file-actions {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.file-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.85rem;
  margin: 1.25rem 0;
}
.file-kpi {
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 0.9rem;
}
.file-kpi strong {
  display: block;
  font-size: 1rem;
  margin-top: 0.25rem;
}
.file-section-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}
.file-summary {
  padding: 1.25rem;
}
.file-summary p {
  color: var(--text-secondary);
  line-height: 1.65;
  margin-bottom: 1rem;
}

.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-section {
  padding-bottom: 1.25rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-light);
}
.form-section:last-of-type { border-bottom: none; margin-bottom: 0; }
.form-section h4 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--primary);
}
.schedule-inputs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.schedule-inputs input { width: auto; flex: 1; }
.schedule-inputs span { color: var(--text-secondary); font-size: 0.85rem; }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.15s ease;
}
.modal {
  background: #fff;
  border-radius: var(--radius-xl);
  width: 95%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  animation: scaleIn 0.2s ease;
}
.modal-lg { max-width: 640px; }
.modal-xl { max-width: 900px; }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}
.modal-header h3 { font-size: 1.1rem; }
.modal-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-light);
  margin-top: 0.5rem;
}

.empty-state-sm {
  color: var(--text-light);
  font-size: 0.88rem;
  padding: 1.5rem;
  text-align: center;
}

/* ========================================
   FILE MODAL (CRUD STYLE)
   ======================================== */
.file-modal-body {
  max-height: 70vh;
  overflow-y: auto;
}
.file-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 1.25rem;
}
.file-modal-client {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.file-modal-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 600;
  color: #fff;
}
.file-modal-client h2 {
  font-size: 1.35rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}
.file-modal-client p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}
.file-modal-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}
.file-kpi-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.file-kpi-item {
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 0.75rem;
  text-align: center;
}
.file-kpi-item span {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-light);
  margin-bottom: 0.35rem;
}
.file-kpi-item strong {
  font-size: 0.95rem;
  color: var(--text);
}
.file-modal-section {
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
}
.file-modal-section:last-child {
  margin-bottom: 0;
}
.file-modal-section h4 {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--primary);
}
.file-info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}
.file-info-grid > div {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.file-info-grid span {
  font-size: 0.75rem;
  color: var(--text-light);
}
.file-info-grid strong {
  font-size: 0.9rem;
}
.file-summary-text {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 0.75rem;
}
.file-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.file-tag {
  background: rgba(99, 102, 241, 0.1);
  color: var(--primary);
  padding: 0.25rem 0.6rem;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 500;
}
.file-next-action {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.2);
}
.file-next-action h4 {
  color: #10b981;
}
.file-next-action p {
  color: var(--text);
  font-size: 0.9rem;
  margin: 0;
}

/* TABLE ENHANCEMENTS */
.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-light);
  gap: 1rem;
}
.table-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 1rem;
  flex: 1;
  max-width: 350px;
}
.table-search i {
  color: var(--text-light);
}
.table-search input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 0.9rem;
  width: 100%;
}
.table-filters {
  display: flex;
  gap: 0.5rem;
}
.table-filters select {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  font-size: 0.85rem;
  cursor: pointer;
}
.file-code-cell {
  color: var(--primary);
  font-family: monospace;
  font-size: 0.85rem;
}
.btn-icon-sm {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg);
  border-radius: var(--radius);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: var(--transition);
}
.btn-icon-sm:hover {
  background: var(--border-light);
  color: var(--primary);
}
.btn-icon-sm.danger:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

/* RANGE INPUT */
.form-group input[type="range"] {
  width: calc(100% - 50px);
  margin-right: 0.5rem;
}
.range-value {
  font-weight: 600;
  color: var(--primary);
  min-width: 40px;
  display: inline-block;
}

/* ========================================
   SCROLLBAR
   ======================================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.25); }

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .operations-grid { grid-template-columns: repeat(2, 1fr); }
  .calendar-rules-grid,
  .analytics-grid { grid-template-columns: 1fr; }
  .files-workspace { grid-template-columns: 1fr; }
  .file-kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .file-kpi-row { grid-template-columns: repeat(3, 1fr); }
  .file-info-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .login-left { display: none; }
  .login-right { flex: 1; }
  .sidebar { width: 72px; }
  .sidebar .sidebar-brand,
  .sidebar .nav-item span,
  .sidebar .nav-badge,
  .sidebar .user-info,
  .sidebar .btn-logout { display: none; }
  .stats-grid { grid-template-columns: 1fr; }
  .operations-grid { grid-template-columns: 1fr; }
  .form-check-grid,
  .form-row-2 { grid-template-columns: 1fr; }
  .file-section-grid,
  .file-kpi-grid,
  .file-meta-grid { grid-template-columns: 1fr; }
  .file-detail-header { flex-direction: column; }
  .chat-sidebar { width: 280px; }
}
