/* ============================================================
   GESTIONAPP v3.0 - Design System
   Colors: Navy #1e3a5f, Accent #2980b9, Success #27ae60
   ============================================================ */

:root {
  --primary: #1e3a5f;
  --primary-dark: #152d4a;
  --primary-light: #2c5282;
  --accent: #2980b9;
  --accent-light: #3498db;
  --success: #27ae60;
  --warning: #f39c12;
  --danger: #e74c3c;
  --info: #2980b9;
  --sidebar-width: 260px;
  --topbar-height: 60px;
  --border-radius: 10px;
  --shadow: 0 2px 15px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
  --transition: all 0.25s ease;
  --bg: #f5f7fb;
  --card-bg: #ffffff;
  --text: #2d3748;
  --text-muted: #718096;
  --border: #e2e8f0;
  --input-bg: #ffffff;
  --sidebar-bg: #1e3a5f;
  --sidebar-text: rgba(255,255,255,0.85);
  --sidebar-active: rgba(255,255,255,0.15);
  --sidebar-hover: rgba(255,255,255,0.08);
}

.dark-mode {
  --bg: #0f1923;
  --card-bg: #1a2635;
  --text: #e2e8f0;
  --text-muted: #a0aec0;
  --border: #2d3748;
  --input-bg: #243447;
  --shadow: 0 2px 15px rgba(0,0,0,0.3);
}

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

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  overflow-x: hidden;
}

body[dir="rtl"] { font-family: 'Cairo', sans-serif; }

/* ============================================================
   AUTH PAGE
============================================================ */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e3a5f 0%, #2980b9 100%);
  padding: 20px;
}
.auth-container { width: 100%; max-width: 420px; }
.auth-logo { text-align: center; color: white; margin-bottom: 32px; }
.auth-logo .logo-icon {
  width: 72px; height: 72px;
  background: rgba(255,255,255,0.2);
  border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; margin: 0 auto 16px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.3);
}
.auth-logo h1 { font-size: 28px; font-weight: 800; letter-spacing: -0.5px; }
.auth-logo p { opacity: 0.8; font-size: 13px; margin-top: 4px; }

.auth-card {
  background: var(--card-bg);
  border-radius: 20px;
  padding: 36px;
  box-shadow: var(--shadow-lg);
}
.auth-card h2 { font-size: 22px; font-weight: 700; margin-bottom: 24px; color: var(--primary); }

.auth-demo-accounts { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }
.auth-demo-accounts p { font-size: 12px; color: var(--text-muted); margin-bottom: 10px; }
.btn-demo {
  display: inline-block; padding: 5px 12px; margin: 3px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 20px; font-size: 12px; cursor: pointer;
  transition: var(--transition); color: var(--text);
}
.btn-demo:hover { background: var(--primary); color: white; border-color: var(--primary); }

.twofa-info {
  background: #e8f4fd; border: 1px solid #2980b9;
  border-radius: 10px; padding: 16px;
  text-align: center; margin-bottom: 20px;
}
.twofa-info i { font-size: 24px; color: #2980b9; display: block; margin-bottom: 8px; }

/* ============================================================
   LAYOUT
============================================================ */
#app { display: flex; min-height: 100vh; }

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  height: 100vh;
  position: fixed;
  top: 0; left: 0;
  display: flex; flex-direction: column;
  z-index: 100;
  transition: var(--transition);
  overflow: hidden;
}
.sidebar.collapsed { width: 60px; }

.sidebar-header {
  padding: 16px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  flex-shrink: 0;
}
.sidebar-logo { display: flex; align-items: center; gap: 10px; overflow: hidden; }
.logo-icon-sm {
  width: 36px; height: 36px; min-width: 36px;
  background: rgba(255,255,255,0.2);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: white;
}
#sidebar-logo-img { width: 36px; height: 36px; border-radius: 8px; object-fit: cover; }
.sidebar-brand { overflow: hidden; }
.sidebar-brand span { display: block; color: white; font-weight: 700; font-size: 15px; white-space: nowrap; }
.sidebar-brand small { display: block; color: rgba(255,255,255,0.6); font-size: 11px; }
.sidebar-toggle {
  background: transparent; border: none; color: rgba(255,255,255,0.7);
  cursor: pointer; padding: 6px; border-radius: 6px;
  transition: var(--transition);
}
.sidebar-toggle:hover { background: var(--sidebar-hover); color: white; }

/* Favorites bar */
.favorites-bar {
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  flex-shrink: 0;
}
.favorites-title { color: rgba(255,255,255,0.5); font-size: 10px; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; }
#favorites-list { display: flex; flex-direction: column; gap: 4px; }
.fav-item {
  display: flex; align-items: center; gap: 8px;
  color: rgba(255,255,255,0.8); font-size: 12px;
  padding: 4px 6px; border-radius: 6px; cursor: pointer;
  transition: var(--transition);
}
.fav-item:hover { background: var(--sidebar-hover); }
.fav-item .fav-star { color: #f39c12; }

/* Sidebar nav */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.2) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; }

.nav-section-title {
  padding: 12px 20px 6px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: rgba(255,255,255,0.4);
  font-weight: 600;
}
.sidebar.collapsed .nav-section-title { display: none; }

.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px;
  color: var(--sidebar-text);
  text-decoration: none;
  transition: var(--transition);
  border-radius: 0;
  position: relative;
  font-size: 14px;
  font-weight: 500;
}
.nav-item:hover { background: var(--sidebar-hover); color: white; }
.nav-item.active {
  background: var(--sidebar-active);
  color: white;
  border-left: 3px solid rgba(255,255,255,0.8);
}
.nav-item i { width: 20px; text-align: center; font-size: 15px; flex-shrink: 0; }
.sidebar.collapsed .nav-item span { display: none; }
.sidebar.collapsed .nav-badge { display: none; }

.nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}
.nav-badge.danger { background: var(--danger); }

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,0.1);
  display: flex; align-items: center; gap: 10px;
  flex-shrink: 0;
}
.user-info { display: flex; align-items: center; gap: 10px; flex: 1; overflow: hidden; }
.user-avatar {
  width: 36px; height: 36px; min-width: 36px;
  background: var(--accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 14px;
}
.sidebar-footer > .user-info > div { overflow: hidden; }
.sidebar-footer > .user-info > div > div:first-child { color: white; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn-logout { background: transparent; border: none; color: rgba(255,255,255,0.6); cursor: pointer; padding: 8px; border-radius: 8px; transition: var(--transition); }
.btn-logout:hover { background: rgba(231,76,60,0.2); color: #e74c3c; }

/* MAIN WRAPPER */
.main-wrapper {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: var(--transition);
}
.sidebar.collapsed ~ .main-wrapper { margin-left: 60px; }

/* TOPBAR */
.topbar {
  height: var(--topbar-height);
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 1px 10px rgba(0,0,0,0.05);
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.breadcrumb { font-size: 14px; font-weight: 600; color: var(--primary); }
.mobile-menu-btn { display: none; background: transparent; border: none; font-size: 20px; cursor: pointer; color: var(--text); }

.topbar-right { display: flex; align-items: center; gap: 8px; }

.search-wrapper { position: relative; }
.search-input {
  width: 220px; padding: 8px 36px 8px 12px;
  border: 1px solid var(--border); border-radius: 20px;
  background: var(--bg); color: var(--text); font-size: 13px;
  transition: var(--transition);
  outline: none;
}
.search-input:focus { width: 300px; border-color: var(--accent); background: var(--card-bg); }
.search-icon { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 13px; }
.search-dropdown {
  position: absolute; top: 40px; left: 0; right: 0;
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow-lg);
  max-height: 400px; overflow-y: auto; z-index: 200;
}
.search-item {
  padding: 10px 16px; cursor: pointer; display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--border); transition: var(--transition);
}
.search-item:last-child { border-bottom: none; }
.search-item:hover { background: var(--bg); }
.search-item-icon { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 13px; }
.search-item-text { flex: 1; }
.search-item-text strong { display: block; font-size: 13px; }
.search-item-text span { font-size: 11px; color: var(--text-muted); }

.topbar-btn {
  background: transparent; border: none;
  padding: 8px 10px; border-radius: 8px;
  cursor: pointer; color: var(--text-muted);
  transition: var(--transition); font-size: 15px;
  display: flex; align-items: center; gap: 6px;
  position: relative;
}
.topbar-btn:hover { background: var(--bg); color: var(--primary); }

.notif-count {
  position: absolute; top: 4px; right: 4px;
  background: var(--danger); color: white;
  border-radius: 50%; width: 17px; height: 17px;
  font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.notif-panel {
  position: absolute; top: 60px; right: 16px;
  width: 360px; background: var(--card-bg);
  border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow-lg); z-index: 200; overflow: hidden;
}
.notif-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.notif-header h4 { font-size: 15px; font-weight: 700; }
.notif-list { max-height: 400px; overflow-y: auto; }
.notif-item {
  padding: 14px 20px; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: var(--transition);
  display: flex; gap: 12px; align-items: flex-start;
}
.notif-item:hover { background: var(--bg); }
.notif-item.unread { background: #ebf5fb; }
.dark-mode .notif-item.unread { background: rgba(41,128,185,0.1); }
.notif-item-icon { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 15px; flex-shrink: 0; }
.notif-item-text strong { display: block; font-size: 13px; font-weight: 600; }
.notif-item-text span { font-size: 12px; color: var(--text-muted); }
.notif-item-time { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.company-select {
  padding: 6px 10px; border: 1px solid var(--border);
  border-radius: 8px; background: var(--bg); color: var(--text);
  font-size: 13px; cursor: pointer;
}
.user-btn { font-size: 13px; gap: 8px; }
.user-avatar-sm {
  width: 28px; height: 28px;
  background: var(--primary); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 12px; font-weight: 700;
}
.user-dropdown {
  position: absolute; top: 60px; right: 16px;
  width: 200px; background: var(--card-bg);
  border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-lg); z-index: 200;
  padding: 8px 0;
}
.user-dropdown a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; color: var(--text); text-decoration: none;
  font-size: 13px; transition: var(--transition);
}
.user-dropdown a:hover { background: var(--bg); }
.user-dropdown hr { border: none; border-top: 1px solid var(--border); margin: 6px 0; }
.text-danger { color: var(--danger) !important; }

/* PAGE CONTENT */
.page-content { flex: 1; padding: 24px; overflow-y: auto; }
.loading-screen { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 60vh; gap: 16px; color: var(--text-muted); }
.spinner { width: 40px; height: 40px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   CARDS & UI COMPONENTS
============================================================ */
.card {
  background: var(--card-bg);
  border-radius: var(--border-radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px;
}
.card-header h3 { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card-body { padding: 20px; }
.card-footer { padding: 14px 20px; border-top: 1px solid var(--border); background: var(--bg); }

/* PAGE HEADER */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
}
.page-title { font-size: 22px; font-weight: 800; color: var(--primary); display: flex; align-items: center; gap: 10px; }
.page-title i { font-size: 20px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* BUTTONS */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px; border-radius: 8px;
  font-size: 13px; font-weight: 600; cursor: pointer;
  border: none; transition: var(--transition);
  text-decoration: none; white-space: nowrap;
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); transform: translateY(-1px); }
.btn-accent { background: var(--accent); color: white; }
.btn-accent:hover:not(:disabled) { background: #2471a3; }
.btn-success { background: var(--success); color: white; }
.btn-success:hover:not(:disabled) { background: #1e8449; }
.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover:not(:disabled) { background: #d68910; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover:not(:disabled) { background: #c0392b; }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg); }
.btn-outline-primary { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline-primary:hover { background: var(--primary); color: white; }
.btn-sm { padding: 5px 12px; font-size: 12px; border-radius: 6px; }
.btn-xs { padding: 3px 8px; font-size: 11px; border-radius: 5px; }
.btn-icon { width: 34px; height: 34px; padding: 0; border-radius: 8px; justify-content: center; }
.btn-full { width: 100%; justify-content: center; }

/* FORMS */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.form-control {
  width: 100%; padding: 10px 14px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--input-bg); color: var(--text);
  font-size: 14px; transition: var(--transition);
  outline: none; font-family: inherit;
}
.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(41,128,185,0.1); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 90px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.input-icon-right { position: relative; }
.input-icon-right .form-control { padding-right: 40px; }
.toggle-pw { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); cursor: pointer; color: var(--text-muted); }

/* TABLES */
.table-responsive { overflow-x: auto; border-radius: var(--border-radius); }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { padding: 12px 16px; background: var(--bg); color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.8px; font-weight: 700; text-align: left; border-bottom: 2px solid var(--border); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr { transition: var(--transition); }
.table tbody tr:hover { background: var(--bg); }
.table-striped tbody tr:nth-child(even) { background: rgba(0,0,0,0.02); }

/* BADGES */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 700;
}
.badge-success { background: #d5f5e3; color: #1e8449; }
.badge-warning { background: #fef9e7; color: #d68910; }
.badge-danger { background: #fdecea; color: #c0392b; }
.badge-info { background: #d6eaf8; color: #1a6fa3; }
.badge-secondary { background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); }
.badge-primary { background: #d0e8f5; color: var(--primary); }

/* KPI CARDS */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 18px; margin-bottom: 24px; }
.kpi-card {
  background: var(--card-bg); border-radius: 14px;
  padding: 20px 22px; display: flex; align-items: center; gap: 16px;
  border: 1px solid var(--border); box-shadow: var(--shadow);
  transition: var(--transition); cursor: pointer;
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.kpi-icon {
  width: 52px; height: 52px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
}
.kpi-info { flex: 1; overflow: hidden; }
.kpi-value { font-size: 22px; font-weight: 800; color: var(--primary); line-height: 1.2; }
.kpi-label { font-size: 12px; color: var(--text-muted); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-trend { font-size: 11px; font-weight: 600; margin-top: 4px; }
.kpi-trend.up { color: var(--success); }
.kpi-trend.down { color: var(--danger); }

/* MODALS */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 20px;
  backdrop-filter: blur(4px);
}
.modal-box {
  background: var(--card-bg);
  border-radius: 16px;
  width: 100%; max-width: 700px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.25s ease;
}
.modal-sm { max-width: 420px; padding: 32px 28px; text-align: center; }
.modal-lg { max-width: 900px; }
.modal-xl { max-width: 1100px; }
@keyframes modalIn { from { opacity: 0; transform: scale(0.95) translateY(20px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-header h3 { font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.modal-close { background: transparent; border: none; font-size: 22px; cursor: pointer; color: var(--text-muted); width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 50%; transition: var(--transition); }
.modal-close:hover { background: var(--bg); color: var(--text); }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; background: var(--bg); border-radius: 0 0 16px 16px; }
.modal-icon { font-size: 48px; margin-bottom: 16px; }

/* ALERTS */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 13px; display: flex; align-items: flex-start; gap: 10px; }
.alert i { flex-shrink: 0; margin-top: 1px; }
.alert-danger { background: #fdecea; color: #c0392b; border: 1px solid #f5b7b1; }
.alert-success { background: #d5f5e3; color: #1e8449; border: 1px solid #a9dfbf; }
.alert-warning { background: #fef9e7; color: #9a7d0a; border: 1px solid #f9e79f; }
.alert-info { background: #d6eaf8; color: #1a6fa3; border: 1px solid #aed6f1; }

/* TABS */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 24px; overflow-x: auto; }
.tab-btn {
  padding: 10px 20px; background: transparent; border: none;
  cursor: pointer; font-size: 13px; font-weight: 600;
  color: var(--text-muted); border-bottom: 2px solid transparent;
  margin-bottom: -2px; white-space: nowrap; transition: var(--transition);
  display: flex; align-items: center; gap: 7px;
}
.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* CHARTS */
.charts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 20px; margin-bottom: 24px; }
.chart-wrapper { position: relative; height: 280px; }

/* KANBAN */
.kanban-board { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 16px; }
.kanban-col {
  min-width: 280px; max-width: 320px;
  background: var(--bg); border-radius: 12px;
  padding: 12px;
}
.kanban-col-header { font-size: 13px; font-weight: 700; margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; }
.kanban-col-count { background: var(--border); padding: 2px 8px; border-radius: 20px; font-size: 11px; }
.kanban-cards { display: flex; flex-direction: column; gap: 10px; min-height: 100px; }
.kanban-card {
  background: var(--card-bg); border-radius: 10px;
  padding: 14px; border: 1px solid var(--border);
  cursor: grab; transition: var(--transition);
  box-shadow: var(--shadow);
}
.kanban-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--accent); }
.kanban-card.dragging { opacity: 0.5; transform: scale(0.98); }
.kanban-drop-zone { background: rgba(41,128,185,0.08); border: 2px dashed var(--accent); border-radius: 10px; padding: 20px; text-align: center; color: var(--accent); font-size: 12px; }

/* TIMELINE */
.timeline { position: relative; padding: 0; }
.timeline::before { content: ''; position: absolute; left: 20px; top: 0; bottom: 0; width: 2px; background: var(--border); }
.timeline-item { position: relative; padding-left: 50px; margin-bottom: 20px; }
.timeline-dot {
  position: absolute; left: 12px; top: 4px;
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--card-bg); box-shadow: 0 0 0 2px var(--accent);
  background: var(--accent); display: flex; align-items: center; justify-content: center;
  font-size: 8px; color: white;
}
.timeline-content { background: var(--bg); border-radius: 10px; padding: 12px 14px; border: 1px solid var(--border); }
.timeline-content strong { display: block; font-size: 13px; margin-bottom: 4px; }
.timeline-content span { font-size: 12px; color: var(--text-muted); }
.timeline-time { font-size: 11px; color: var(--text-muted); margin-top: 4px; display: block; }

/* CALENDAR */
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.calendar-day-name { text-align: center; font-size: 12px; font-weight: 700; color: var(--text-muted); padding: 8px 4px; }
.calendar-day {
  min-height: 80px; border: 1px solid var(--border);
  border-radius: 8px; padding: 6px; background: var(--card-bg);
  cursor: pointer; transition: var(--transition);
}
.calendar-day:hover { border-color: var(--accent); background: var(--bg); }
.calendar-day.today { border-color: var(--accent); background: rgba(41,128,185,0.05); }
.calendar-day.other-month { opacity: 0.4; }
.calendar-day-num { font-size: 12px; font-weight: 700; margin-bottom: 4px; }
.calendar-event { font-size: 10px; padding: 2px 5px; border-radius: 4px; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* PIPELINE */
.pipeline-board { display: flex; gap: 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.pipeline-stage { flex: 1; padding: 16px; border-right: 1px solid var(--border); min-width: 160px; }
.pipeline-stage:last-child { border-right: none; }
.pipeline-stage-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 12px; padding-bottom: 10px; border-bottom: 2px solid; }
.pipeline-items { display: flex; flex-direction: column; gap: 8px; }
.pipeline-item {
  background: var(--bg); border-radius: 8px;
  padding: 10px 12px; border: 1px solid var(--border);
  cursor: pointer; transition: var(--transition);
}
.pipeline-item:hover { background: var(--card-bg); border-color: var(--accent); }
.pipeline-item-name { font-size: 13px; font-weight: 600; }
.pipeline-item-value { font-size: 12px; color: var(--text-muted); }
.pipeline-stats { display: flex; gap: 16px; margin-bottom: 20px; }
.pipeline-stat { flex: 1; text-align: center; padding: 12px; background: var(--bg); border-radius: 10px; border: 1px solid var(--border); }
.pipeline-stat-value { font-size: 20px; font-weight: 800; color: var(--primary); }
.pipeline-stat-label { font-size: 11px; color: var(--text-muted); }

/* SIGNATURE */
.signature-canvas {
  border: 2px dashed var(--border); border-radius: 12px;
  cursor: crosshair; background: white; max-width: 100%; display: block; margin: 0 auto;
}
.signature-canvas.signed { border-color: var(--success); border-style: solid; }

/* UPLOAD ZONE */
.upload-zone {
  border: 2px dashed var(--border); border-radius: 12px;
  padding: 40px 20px; text-align: center;
  cursor: pointer; transition: var(--transition); color: var(--text-muted);
}
.upload-zone:hover, .upload-zone.dragover { border-color: var(--accent); background: rgba(41,128,185,0.05); }
.upload-zone i { font-size: 36px; display: block; margin-bottom: 12px; color: var(--text-muted); }

/* STATS ROW */
.stats-row { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.stat-item { flex: 1; min-width: 140px; background: var(--bg); border-radius: 10px; padding: 14px; border: 1px solid var(--border); text-align: center; }
.stat-item-value { font-size: 22px; font-weight: 800; }
.stat-item-label { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* PROGRESS BAR */
.progress-bar { background: var(--bg); border-radius: 20px; height: 8px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 20px; transition: width 0.4s ease; }

/* TOAST */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--card-bg); border-radius: 12px;
  padding: 14px 18px; min-width: 280px; max-width: 400px;
  box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 12px;
  border-left: 4px solid var(--success);
  animation: slideIn 0.3s ease; border: 1px solid var(--border);
}
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast.info { border-left-color: var(--info); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.toast-close { margin-left: auto; cursor: pointer; color: var(--text-muted); font-size: 16px; background: transparent; border: none; }

/* STAR FAVORITE */
.star-btn { background: transparent; border: none; cursor: pointer; color: var(--text-muted); font-size: 16px; transition: var(--transition); padding: 4px; }
.star-btn:hover { color: #f39c12; }
.star-btn.active { color: #f39c12; }

/* MISC */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-xs { font-size: 11px; }
.text-sm { font-size: 12px; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.p-3 { padding: 20px; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 10px; }
.gap-3 { gap: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.hidden { display: none !important; }
.btn-link { background: transparent; border: none; color: var(--accent); cursor: pointer; font-size: 13px; text-decoration: underline; padding: 0; }

/* FILTER BAR */
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; align-items: center; }
.filter-bar .form-control { flex: 1; min-width: 180px; }

/* EMPTY STATE */
.empty-state { text-align: center; padding: 60px 20px; }
.empty-state i { font-size: 56px; color: var(--text-muted); opacity: 0.4; display: block; margin-bottom: 16px; }
.empty-state h3 { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.empty-state p { color: var(--text-muted); font-size: 14px; margin-bottom: 24px; }

/* PHOTO GRID */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.photo-item { border-radius: 10px; overflow: hidden; border: 1px solid var(--border); cursor: pointer; transition: var(--transition); aspect-ratio: 4/3; background: var(--bg); position: relative; }
.photo-item:hover { transform: scale(1.02); box-shadow: var(--shadow-lg); }
.photo-item img { width: 100%; height: 100%; object-fit: cover; }
.photo-item-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.5); opacity: 0; transition: var(--transition); display: flex; align-items: center; justify-content: center; gap: 8px; }
.photo-item:hover .photo-item-overlay { opacity: 1; }

/* MAPPING */
.mapping-container { background: var(--bg); border-radius: 10px; padding: 16px; border: 1px solid var(--border); }
.mapping-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.mapping-row label { flex: 1; font-size: 13px; }
.mapping-row select { flex: 1; }

/* EMAIL ATTACHMENT */
.email-attachment { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-muted); }
.email-attachment i { color: var(--accent); }

/* RELANCE LEVELS */
.relance-level-0 { border-left: 3px solid var(--text-muted); }
.relance-level-1 { border-left: 3px solid var(--warning); }
.relance-level-2 { border-left: 3px solid #e67e22; }
.relance-level-3 { border-left: 3px solid var(--danger); }

/* DARK MODE TOGGLING */
.dark-mode .table-striped tbody tr:nth-child(even) { background: rgba(255,255,255,0.02); }
.dark-mode .kpi-card:hover { box-shadow: 0 8px 30px rgba(0,0,0,0.3); }

/* STOCK ALERTS */
.stock-low { color: var(--danger); font-weight: 700; }
.stock-ok { color: var(--success); }
.stock-medium { color: var(--warning); }

/* GUARANTEE STATUS */
.guarantee-active { background: #d5f5e3; color: #1e8449; }
.guarantee-expiring { background: #fef9e7; color: #d68910; }
.guarantee-expired { background: #fdecea; color: #c0392b; }

/* PDF PREVIEW */
.pdf-preview-wrapper { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: white; padding: 32px; }
.pdf-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 24px; border-bottom: 2px solid #1e3a5f; padding-bottom: 16px; }
.pdf-logo { font-size: 22px; font-weight: 800; color: #1e3a5f; }
.pdf-doc-info { text-align: right; }
.pdf-doc-number { font-size: 20px; font-weight: 800; }
.pdf-section { margin-bottom: 20px; }
.pdf-table { width: 100%; border-collapse: collapse; }
.pdf-table th, .pdf-table td { padding: 10px 12px; text-align: left; font-size: 12px; }
.pdf-table th { background: #1e3a5f; color: white; }
.pdf-table tr:nth-child(even) td { background: #f8fafc; }
.pdf-totals { text-align: right; margin-top: 16px; }
.pdf-totals table { margin-left: auto; min-width: 250px; }
.pdf-totals td { padding: 6px 12px; font-size: 13px; }
.pdf-total-ht { font-weight: 600; }
.pdf-total-ttc { font-size: 16px; font-weight: 800; color: #1e3a5f; border-top: 2px solid #1e3a5f; }

/* RTL SUPPORT */
[dir="rtl"] .sidebar { left: auto; right: 0; }
[dir="rtl"] .main-wrapper { margin-left: 0; margin-right: var(--sidebar-width); }
[dir="rtl"] .sidebar.collapsed ~ .main-wrapper { margin-left: 0; margin-right: 60px; }
[dir="rtl"] .nav-item { border-left: none; }
[dir="rtl"] .nav-item.active { border-left: none; border-right: 3px solid rgba(255,255,255,0.8); }

/* RESPONSIVE */
@media (max-width: 1024px) {
  .charts-grid { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  :root { --sidebar-width: 260px; }
  .sidebar { transform: translateX(-100%); }
  [dir="rtl"] .sidebar { transform: translateX(100%); }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-wrapper { margin-left: 0 !important; }
  [dir="rtl"] .main-wrapper { margin-right: 0 !important; }
  .mobile-menu-btn { display: block; }
  .search-input { width: 140px; }
  .search-input:focus { width: 180px; }
  .page-content { padding: 16px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .topbar-right .search-wrapper { display: none; }
  .kanban-board { flex-direction: column; }
  .pipeline-board { flex-direction: column; }
}
@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .page-title { font-size: 18px; }
  .btn { padding: 8px 14px; font-size: 12px; }
}
