@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700;900&display=swap');

:root {
  --primary: #0A2342;
  --primary-light: #0d2e54;
  --primary-dark: #071830;
  --gold: #C9A84C;
  --gold-light: #dbb95d;
  --gold-dark: #a8882e;
  --success: #2E7D32;
  --success-light: #4CAF50;
  --danger: #C62828;
  --danger-light: #EF5350;
  --warning: #F57C00;
  --warning-light: #FFA726;
  --info: #0288D1;
  --bg: #F0F4F8;
  --bg-dark: #E4EAF0;
  --white: #FFFFFF;
  --card: #FFFFFF;
  --border: #D0D9E4;
  --text: #1A2E45;
  --text-muted: #6B7E94;
  --text-light: #A0B0C0;
  --sidebar-w: 260px;
  --header-h: 64px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 2px 12px rgba(10,35,66,0.10);
  --shadow-md: 0 4px 24px rgba(10,35,66,0.14);
  --shadow-lg: 0 8px 40px rgba(10,35,66,0.18);
  --transition: 0.22s cubic-bezier(0.4,0,0.2,1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 15px; }
body {
  font-family: 'Tajawal', sans-serif;
  direction: rtl;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

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

/* ========== SIDEBAR ========== */
.sidebar {
  width: var(--sidebar-w);
  background: var(--primary);
  height: 100vh;
  position: fixed;
  right: calc(-1 * var(--sidebar-w) - 30px); /* دائماً مخفي افتراضياً */
  top: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: -4px 0 20px rgba(0,0,0,0.2);
  transition: right var(--transition);
}
.sidebar-brand {
  padding: 22px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 12px;
}
.sidebar-brand .brand-icon {
  width: 42px; height: 42px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: var(--white);
  flex-shrink: 0;
}
.sidebar-brand .brand-text { color: var(--white); }
.sidebar-brand .brand-text .brand-name { font-size: 1.1rem; font-weight: 700; line-height: 1.2; }
.sidebar-brand .brand-text .brand-sub { font-size: 0.72rem; color: rgba(255,255,255,0.55); }

.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.nav-section-title {
  font-size: 0.68rem;
  font-weight: 700;
  color: rgba(255,255,255,0.35);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 14px 20px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 20px;
  color: rgba(255,255,255,0.72);
  text-decoration: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(201,168,76,0.2);
  font-size: 0.88rem;
  font-weight: 500;
  border-right: 3px solid transparent;
  transition: all var(--transition);
  cursor: pointer;
  position: relative;
}
.nav-item:hover {
  background: rgba(255,255,255,0.07);
  color: var(--white);
  border-right-color: rgba(201,168,76,0.5);
}
.nav-item.active {
  background: rgba(201,168,76,0.12);
  color: var(--gold);
  border-right-color: var(--gold);
  font-weight: 600;
}
.nav-item .nav-icon { font-size: 1.1rem; width: 22px; text-align: center; flex-shrink: 0; }
.nav-badge {
  margin-right: auto;
  background: var(--danger);
  color: white;
  font-size: 0.65rem;
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 700;
  min-width: 18px; text-align: center;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
}
.sidebar-user .user-avatar {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.85rem; color: white;
  flex-shrink: 0;
}
.sidebar-user .user-info { flex: 1; min-width: 0; }
.sidebar-user .user-name { font-size: 0.85rem; font-weight: 600; color: white; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .user-role { font-size: 0.7rem; color: rgba(255,255,255,0.45); }
.btn-logout {
  background: none; border: none; cursor: pointer;
  color: rgba(255,255,255,0.45); font-size: 1rem; padding: 4px;
  transition: color var(--transition);
}
.btn-logout:hover { color: var(--danger-light); }

/* ========== MAIN CONTENT ========== */
.main-content {
  margin-right: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ========== TOP BAR ========== */
.topbar {
  height: var(--header-h);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 12px rgba(10,35,66,0.08);
}
.topbar-title {
  font-size: 1.0rem; font-weight: 700; color: var(--primary); flex: 1;
  letter-spacing: 0.01em;
}
.topbar-actions { display: flex; align-items: center; gap: 6px; }
.topbar-btn {
  width: 38px; height: 38px;
  border: 1px solid var(--border); background: var(--white);
  border-radius: var(--radius-sm); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.0rem; color: var(--text-muted);
  transition: all var(--transition); position: relative;
  box-shadow: 0 1px 3px rgba(10,35,66,0.06);
}
.topbar-btn:hover { background: var(--primary); color: white; border-color: var(--primary); box-shadow: 0 3px 10px rgba(10,35,66,0.2); }
.topbar-btn .badge {
  position: absolute; top: 4px; right: 4px;
  width: 16px; height: 16px;
  background: var(--danger); color: white;
  border-radius: 50%; font-size: 0.6rem;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
}

/* ========== TOPBAR NAV DROPDOWNS ========== */
.topbar-brand-inline {
  display: none;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.topbar-brand-icon { font-size: 1.3rem; }
.topbar-brand-name { font-size: 0.9rem; font-weight: 800; color: var(--primary); white-space: nowrap; }

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  justify-content: flex-start;
}

.tnav-dd { position: relative; }

.tnav-btn {
  display: flex; align-items: center; gap: 5px;
  padding: 7px 13px;
  background: none; border: none;
  border-radius: var(--radius-sm);
  font-family: inherit; font-size: 0.83rem; font-weight: 600;
  color: var(--text); cursor: pointer; white-space: nowrap;
  transition: all var(--transition);
  border: 1px solid transparent;
}
.tnav-btn:hover,
.tnav-dd.open .tnav-btn,
.tnav-dd.has-active .tnav-btn {
  background: var(--primary); color: white;
  border-color: var(--primary);
}
.tnav-dd.has-active .tnav-btn {
  background: var(--primary); color: var(--gold);
}
.tnav-arrow { font-size: 0.5rem; opacity: 0.6; transition: transform var(--transition); }
.tnav-dd.open .tnav-arrow { transform: rotate(180deg); }

.tnav-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 195px;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 300;
  overflow: hidden;
  animation: ddFadeIn .15s ease;
}
@keyframes ddFadeIn { from { opacity:0; transform:translateY(-6px); } to { opacity:1; transform:none; } }
.tnav-dd.open .tnav-menu { display: block; }

.tnav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  color: var(--text); text-decoration: none;
  font-size: 0.84rem;
  border-bottom: 1px solid rgba(208,217,228,0.5);
  transition: all var(--transition);
}
.tnav-item:last-child { border-bottom: none; }
.tnav-item:hover { background: var(--primary); color: white; }
.tnav-item.tnav-active {
  background: rgba(10,35,66,0.07); color: var(--primary); font-weight: 700;
  border-right: 3px solid var(--gold);
}

/* Desktop: إخفاء الـ sidebar + إظهار brand في الـ topbar */
@media (min-width: 901px) {
  .sidebar { display: none; }
  .main-content { margin-right: 0; }
  .topbar-brand-inline { display: flex; }
  .topbar-title { display: none; }
}

/* Mobile: إخفاء قوائم الـ topbar */
@media (max-width: 900px) {
  .topbar-nav { display: none; }
  .topbar-brand-inline { display: none; }
}

/* ========== PAGE CONTENT ========== */
.page-content { flex: 1; padding: 24px; }
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px 20px;
  background: white;
  border-radius: var(--radius);
  border: 1px solid rgba(208,217,228,0.6);
  box-shadow: 0 1px 4px rgba(10,35,66,0.05);
}
.page-title { font-size: 1.3rem; font-weight: 800; color: var(--primary); display: flex; align-items: center; gap: 8px; }
.page-subtitle { font-size: 0.8rem; color: var(--text-muted); margin-top: 3px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ========== CARDS ========== */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 1px 4px rgba(10,35,66,0.06), 0 4px 16px rgba(10,35,66,0.08);
  border: 1px solid rgba(208,217,228,0.7);
  overflow: hidden;
  transition: box-shadow var(--transition);
}
.card:hover { box-shadow: 0 2px 8px rgba(10,35,66,0.08), 0 8px 24px rgba(10,35,66,0.10); }
.card-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(to left, rgba(240,244,248,0.8), rgba(255,255,255,0.95));
  gap: 10px;
}
.card-title {
  font-size: 0.93rem; font-weight: 700; color: var(--primary);
  display: flex; align-items: center; gap: 8px;
}
.card-body { padding: 20px; }
.card-footer {
  padding: 12px 20px; border-top: 1px solid var(--border);
  background: var(--bg); display: flex; align-items: center; gap: 8px;
  justify-content: flex-end;
}

/* Stats Cards */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: 0 1px 4px rgba(10,35,66,0.06), 0 4px 16px rgba(10,35,66,0.07);
  border: 1px solid rgba(208,217,228,0.6);
  display: flex; align-items: center; gap: 16px;
  transition: transform var(--transition), box-shadow var(--transition);
  cursor: pointer; overflow: hidden; position: relative;
}
.stat-card::after {
  content: ''; position: absolute; top: 0; right: 0;
  width: 4px; height: 100%;
  background: var(--border); border-radius: 0 var(--radius) var(--radius) 0;
  transition: background var(--transition);
}
.stat-card:hover { transform: translateY(-3px); box-shadow: 0 6px 24px rgba(10,35,66,0.12); }
.stat-card:hover::after { background: var(--primary); }
.stat-icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; flex-shrink: 0;
}
.stat-icon.primary   { background: linear-gradient(135deg, rgba(10,35,66,0.1), rgba(10,35,66,0.06)); color: var(--primary); }
.stat-icon.gold      { background: linear-gradient(135deg, rgba(201,168,76,0.18), rgba(201,168,76,0.08)); color: var(--gold-dark); }
.stat-icon.success   { background: linear-gradient(135deg, rgba(46,125,50,0.14), rgba(46,125,50,0.06)); color: var(--success); }
.stat-icon.danger    { background: linear-gradient(135deg, rgba(198,40,40,0.12), rgba(198,40,40,0.05)); color: var(--danger); }
.stat-icon.info      { background: linear-gradient(135deg, rgba(2,136,209,0.12), rgba(2,136,209,0.05)); color: var(--info); }
.stat-icon.warning   { background: linear-gradient(135deg, rgba(245,124,0,0.12), rgba(245,124,0,0.05)); color: var(--warning); }
.stat-body { flex: 1; min-width: 0; }
.stat-value { font-size: 1.5rem; font-weight: 800; color: var(--primary); line-height: 1.2; }
.stat-label { font-size: 0.76rem; color: var(--text-muted); margin-top: 3px; font-weight: 500; }
.stat-delta { font-size: 0.74rem; margin-top: 5px; display: flex; align-items: center; gap: 3px; }
.stat-delta.up   { color: var(--success); }
.stat-delta.down { color: var(--danger); }

/* ========== TABLES ========== */
.table-wrapper { overflow-x: auto; border-radius: 0 0 var(--radius) var(--radius); }
table { width: 100%; border-collapse: collapse; }
thead th {
  background: linear-gradient(to bottom, #f4f7fb, var(--bg));
  color: var(--primary);
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 11px 14px;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  text-align: right;
}
tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid rgba(208,217,228,0.5);
  font-size: 0.87rem;
  color: var(--text);
  vertical-align: middle;
}
tbody tr { transition: background var(--transition); }
tbody tr:hover { background: rgba(10,35,66,0.03); }
tbody tr:last-child td { border-bottom: none; }
/* Actions column */
td.actions, th.actions { text-align: center; white-space: nowrap; width: 1%; }
td.actions { display: flex; gap: 5px; align-items: center; justify-content: center; flex-wrap: nowrap; }

/* ========== BADGES / STATUS ========== */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 0.75rem; font-weight: 600; white-space: nowrap;
}
.badge-primary  { background: rgba(10,35,66,0.1); color: var(--primary); }
.badge-gold     { background: rgba(201,168,76,0.15); color: var(--gold-dark); }
.badge-success  { background: rgba(46,125,50,0.1); color: var(--success); }
.badge-danger   { background: rgba(198,40,40,0.1); color: var(--danger); }
.badge-warning  { background: rgba(245,124,0,0.1); color: var(--warning); }
.badge-info     { background: rgba(2,136,209,0.1); color: var(--info); }
.badge-muted    { background: var(--bg); color: var(--text-muted); }

/* ========== BUTTONS ========== */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px;
  border: none; border-radius: var(--radius-sm);
  font-family: 'Tajawal', sans-serif;
  font-size: 0.88rem; font-weight: 600;
  cursor: pointer; transition: all var(--transition);
  text-decoration: none; white-space: nowrap;
  letter-spacing: 0.01em;
}
.btn-sm { padding: 6px 13px; font-size: 0.8rem; border-radius: 6px; }
.btn-xs { padding: 4px 10px; font-size: 0.75rem; border-radius: 6px; }
.btn-lg { padding: 12px 26px; font-size: 0.98rem; }
.btn-icon { width: 36px; height: 36px; padding: 0; justify-content: center; border-radius: var(--radius-sm); }
.btn-icon-sm { width: 30px; height: 30px; padding: 0; justify-content: center; border-radius: 6px; font-size: 0.85rem; }

.btn-primary  {
  background: linear-gradient(135deg, var(--primary) 0%, #1a3a6e 100%);
  color: white; box-shadow: 0 2px 8px rgba(10,35,66,0.25);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #0d2e54 0%, #1a3a6e 100%);
  box-shadow: 0 4px 16px rgba(10,35,66,0.35); transform: translateY(-1px);
}
.btn-gold {
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
  color: white; box-shadow: 0 2px 8px rgba(201,168,76,0.3);
}
.btn-gold:hover {
  background: linear-gradient(135deg, var(--gold-light) 0%, var(--gold) 100%);
  box-shadow: 0 4px 16px rgba(201,168,76,0.4); transform: translateY(-1px);
}
.btn-success {
  background: linear-gradient(135deg, var(--success) 0%, #388e3c 100%);
  color: white; box-shadow: 0 2px 8px rgba(46,125,50,0.25);
}
.btn-success:hover { background: linear-gradient(135deg, #1b5e20 0%, var(--success) 100%); transform: translateY(-1px); }
.btn-danger {
  background: linear-gradient(135deg, var(--danger) 0%, #d32f2f 100%);
  color: white; box-shadow: 0 2px 8px rgba(198,40,40,0.25);
}
.btn-danger:hover { background: linear-gradient(135deg, #b71c1c 0%, var(--danger) 100%); transform: translateY(-1px); }
.btn-info {
  background: linear-gradient(135deg, var(--info) 0%, #0277bd 100%);
  color: white; box-shadow: 0 2px 8px rgba(2,136,209,0.25);
}
.btn-info:hover { transform: translateY(-1px); }
.btn-warning {
  background: linear-gradient(135deg, var(--warning) 0%, #ef6c00 100%);
  color: white; box-shadow: 0 2px 8px rgba(245,124,0,0.25);
}
.btn-warning:hover { transform: translateY(-1px); }

.btn-outline  {
  background: transparent; border: 1.5px solid var(--border);
  color: var(--text); box-shadow: 0 1px 4px rgba(10,35,66,0.06);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: rgba(10,35,66,0.04); }
.btn-outline-primary { background: transparent; border: 1.5px solid var(--primary); color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); color: white; }
.btn-outline-danger { background: transparent; border: 1.5px solid var(--danger); color: var(--danger); }
.btn-outline-danger:hover { background: var(--danger); color: white; }
.btn-ghost    { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none !important; }
.btn:active:not(:disabled) { transform: translateY(0) !important; }

/* Upload / AI action buttons */
.btn-upload {
  background: linear-gradient(135deg, #1a3a6e 0%, var(--primary) 100%);
  color: white; border: none; border-radius: var(--radius-sm);
  padding: 7px 14px; font-size: 0.82rem; font-weight: 600;
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  font-family: 'Tajawal', sans-serif; transition: all var(--transition);
  box-shadow: 0 2px 8px rgba(10,35,66,0.2);
}
.btn-upload:hover { box-shadow: 0 4px 14px rgba(10,35,66,0.3); transform: translateY(-1px); }
.btn-upload input[type=file] { display: none; }

/* Row action buttons */
.btn-action {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 4px; padding: 5px 10px; border-radius: 6px;
  font-size: 0.77rem; font-weight: 600; cursor: pointer;
  border: 1.5px solid transparent; transition: all var(--transition);
  font-family: 'Tajawal', sans-serif; white-space: nowrap;
}
.btn-action-edit   { background: rgba(2,136,209,0.1);  color: var(--info);    border-color: rgba(2,136,209,0.2); }
.btn-action-edit:hover   { background: var(--info);    color: white; border-color: var(--info); }
.btn-action-delete { background: rgba(198,40,40,0.1);  color: var(--danger);  border-color: rgba(198,40,40,0.2); }
.btn-action-delete:hover { background: var(--danger);  color: white; border-color: var(--danger); }
.btn-action-view   { background: rgba(10,35,66,0.08);  color: var(--primary); border-color: rgba(10,35,66,0.15); }
.btn-action-view:hover   { background: var(--primary); color: white; border-color: var(--primary); }
.btn-action-open   { background: rgba(46,125,50,0.1);  color: var(--success); border-color: rgba(46,125,50,0.2); }
.btn-action-open:hover   { background: var(--success); color: white; border-color: var(--success); }
.btn-action-upload { background: rgba(201,168,76,0.12); color: var(--gold-dark); border-color: rgba(201,168,76,0.25); }
.btn-action-upload:hover { background: var(--gold); color: white; border-color: var(--gold); }

/* ========== FORMS ========== */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.form-label .required { color: var(--danger); margin-right: 3px; }
.form-control, .form-select {
  width: 100%;
  padding: 10px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Tajawal', sans-serif;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--white);
  transition: border-color var(--transition), box-shadow var(--transition);
  direction: rtl;
  outline: none;
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(10,35,66,0.1);
}
.form-control::placeholder { color: var(--text-light); }
textarea.form-control { resize: vertical; min-height: 90px; }
.form-hint { font-size: 0.74rem; color: var(--text-muted); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

/* ========== MODALS ========== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(10,35,66,0.55);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; visibility: hidden;
  transition: all var(--transition);
}
.modal-overlay.open { opacity: 1; visibility: visible; }
.modal {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95) translateY(20px);
  transition: transform var(--transition);
}
.modal-overlay.open .modal { transform: scale(1) translateY(0); }
.modal-sm { max-width: 420px; }
.modal-md { max-width: 600px; }
.modal-lg { max-width: 820px; }
.modal-xl { max-width: 1050px; }
.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(to left, var(--primary), var(--primary-light));
  color: white;
  border-radius: var(--radius) var(--radius) 0 0;
}
.modal-title { font-size: 1rem; font-weight: 700; }
.modal-close {
  background: rgba(255,255,255,0.15); border: none;
  width: 32px; height: 32px; border-radius: 8px;
  color: white; cursor: pointer; font-size: 1.1rem;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition);
}
.modal-close:hover { background: rgba(255,255,255,0.25); }
.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex; gap: 10px; justify-content: flex-end;
  background: var(--bg);
}

/* ========== SEARCH BAR ========== */
.search-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 20px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.search-input-wrap { position: relative; flex: 1; min-width: 200px; }
.search-input-wrap .search-icon {
  position: absolute; right: 11px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-size: 0.9rem; pointer-events: none;
}
.search-input-wrap input {
  width: 100%; padding: 9px 36px 9px 13px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-family: 'Tajawal', sans-serif; font-size: 0.88rem;
  background: var(--white); color: var(--text);
  transition: border-color var(--transition);
  outline: none; direction: rtl;
}
.search-input-wrap input:focus { border-color: var(--primary); }
.filter-select {
  padding: 9px 13px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-family: 'Tajawal', sans-serif; font-size: 0.85rem;
  background: var(--white); color: var(--text);
  cursor: pointer; outline: none;
}

/* ========== ALERTS / TOASTS ========== */
.toast-container { position: fixed; top: 80px; left: 20px; z-index: 999; display: flex; flex-direction: column; gap: 10px; }
.toast {
  min-width: 280px; max-width: 380px;
  background: var(--white); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  border-right: 4px solid var(--primary);
  padding: 14px 18px;
  display: flex; gap: 12px; align-items: flex-start;
  animation: slideIn 0.3s ease;
}
.toast.success { border-right-color: var(--success); }
.toast.error   { border-right-color: var(--danger); }
.toast.warning { border-right-color: var(--warning); }
.toast-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 1px; }
.toast.success .toast-icon { color: var(--success); }
.toast.error   .toast-icon { color: var(--danger); }
.toast.warning .toast-icon { color: var(--warning); }
.toast-content { flex: 1; }
.toast-title { font-size: 0.85rem; font-weight: 700; color: var(--text); }
.toast-msg { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }
@keyframes slideIn { from { transform: translateX(-30px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ========== DROPDOWN ========== */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px); left: 0;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  min-width: 180px; z-index: 200;
  opacity: 0; visibility: hidden;
  transform: translateY(-8px);
  transition: all var(--transition);
}
.dropdown.open .dropdown-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown-item {
  padding: 9px 14px; font-size: 0.85rem; color: var(--text);
  cursor: pointer; display: flex; align-items: center; gap: 9px;
  transition: background var(--transition);
}
.dropdown-item:hover { background: var(--bg); }
.dropdown-divider { border: none; border-top: 1px solid var(--border); margin: 4px 0; }

/* ========== AMOUNT DISPLAY ========== */
.amount { font-weight: 700; font-variant-numeric: tabular-nums; }
.amount.pos { color: var(--success); }
.amount.neg { color: var(--danger); }
.amount.neutral { color: var(--text); }
.currency { font-size: 0.75em; font-weight: 500; color: var(--text-muted); margin-right: 2px; }

/* ========== EMPTY STATE ========== */
.empty-state {
  text-align: center; padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 14px; opacity: 0.4; }
.empty-state h4 { font-size: 1rem; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.empty-state p { font-size: 0.85rem; }

/* ========== PAGINATION ========== */
.pagination { display: flex; align-items: center; gap: 6px; justify-content: center; padding: 16px; }
.page-btn {
  width: 36px; height: 36px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: white; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; color: var(--text);
  transition: all var(--transition);
}
.page-btn:hover, .page-btn.active { background: var(--primary); color: white; border-color: var(--primary); }

/* ========== AI CHAT ========== */
.ai-chat-panel {
  position: fixed; bottom: 20px; left: 20px;
  width: 400px; background: var(--white);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  border: 1px solid var(--border); z-index: 300;
  display: flex; flex-direction: column;
  transform: translateY(calc(100% + 20px));
  transition: transform var(--transition);
  max-height: 600px; height: 600px;
  min-height: 320px;
}
.ai-chat-panel.open { transform: translateY(0); }

/* شريط السحب للتكبير */
.ai-resize-handle {
  height: 10px; cursor: ns-resize;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg); border-bottom: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  flex-shrink: 0; user-select: none;
  transition: background .15s;
}
.ai-resize-handle:hover,
.ai-resize-handle.dragging { background: rgba(201,168,76,0.15); }
.ai-resize-dots {
  width: 32px; height: 3px; border-radius: 2px;
  background: var(--border); position: relative;
}
.ai-resize-dots::before,
.ai-resize-dots::after {
  content:''; position:absolute; left:0; right:0; height:3px;
  border-radius:2px; background:var(--border);
}
.ai-resize-dots::before { top: -5px; }
.ai-resize-dots::after  { top:  5px; }
.ai-chat-header {
  padding: 14px 18px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white; border-radius: var(--radius) var(--radius) 0 0;
  display: flex; align-items: center; gap: 10px;
}
.ai-chat-header .ai-avatar {
  width: 34px; height: 34px;
  background: rgba(201,168,76,0.25); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
}
.ai-chat-header .ai-title { flex: 1; font-size: 0.9rem; font-weight: 700; }
.ai-chat-header .ai-status { font-size: 0.72rem; opacity: 0.7; }
.ai-chat-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.ai-msg { display: flex; gap: 8px; align-items: flex-start; }
.ai-msg.user { flex-direction: row-reverse; }
.ai-msg-bubble {
  max-width: 80%; padding: 10px 14px;
  border-radius: 16px; font-size: 0.85rem; line-height: 1.55;
}
.ai-msg.assistant .ai-msg-bubble { background: var(--bg); color: var(--text); border-radius: 4px 16px 16px 16px; }
.ai-msg.user .ai-msg-bubble { background: var(--primary); color: white; border-radius: 16px 4px 16px 16px; }
.ai-chat-input {
  padding: 12px;
  border-top: 1px solid var(--border);
  display: flex; gap: 8px; align-items: center;
}
.ai-chat-input input {
  flex: 1; padding: 9px 13px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-family: 'Tajawal', sans-serif; font-size: 0.88rem;
  outline: none; direction: rtl;
}
.ai-chat-input input:focus { border-color: var(--primary); }
.dot-pulse {
  display: inline-block; width: 7px; height: 7px;
  background: var(--primary); border-radius: 50%;
  animation: dotBounce 1s infinite ease-in-out;
}
@keyframes dotBounce {
  0%,80%,100% { transform: scale(0.6); opacity:.4; }
  40% { transform: scale(1); opacity:1; }
}
.ai-quick-btns {
  padding: 8px 12px 0;
  display: flex; flex-wrap: wrap; gap: 6px;
}
.ai-quick-btn {
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: 20px; padding: 5px 12px;
  font-size: 0.78rem; cursor: pointer; color: var(--text-light);
  font-family: inherit; transition: all .2s;
  white-space: nowrap;
}
.ai-quick-btn:hover { background: var(--primary); color: white; border-color: var(--primary); }
.ai-msg-bubble h4 { font-size: 0.9rem; }
.ai-msg-bubble ul { margin: 4px 0; }
.ai-msg-bubble table { font-size: 0.82rem; }
.ai-fab {
  position: fixed; bottom: 20px; left: 20px; z-index: 299;
  width: 54px; height: 54px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border: none; border-radius: 50%;
  box-shadow: var(--shadow-md);
  cursor: pointer; font-size: 1.4rem; color: white;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.ai-fab:hover { transform: scale(1.08); box-shadow: var(--shadow-lg); }
.ai-fab.hidden { opacity: 0; pointer-events: none; }

/* ========== TABS ========== */
.tab-nav {
  display: flex; gap: 2px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px; flex-wrap: wrap;
  background: linear-gradient(to bottom, rgba(240,244,248,0.6), transparent);
  padding: 6px 6px 0; border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.tab-btn {
  padding: 9px 16px; border: none; background: transparent;
  font-family: 'Tajawal', sans-serif; font-size: 0.86rem;
  color: var(--text-muted); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: all var(--transition); font-weight: 500;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  display: flex; align-items: center; gap: 6px;
}
.tab-btn:hover { color: var(--primary); background: rgba(10,35,66,0.04); }
.tab-btn.active {
  color: var(--primary); border-bottom-color: var(--primary);
  font-weight: 700; background: white;
  box-shadow: 0 -2px 8px rgba(10,35,66,0.06);
}
.tab-pane { display: none; }
.tab-pane.active { display: block; animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* ========== TIMELINE / STEPS ========== */
.timeline { display: flex; flex-direction: column; gap: 16px; }
.timeline-item { display: flex; gap: 14px; }
.timeline-marker {
  width: 32px; height: 32px;
  border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; border: 2px solid;
}
.timeline-marker.success { background: rgba(46,125,50,0.1); border-color: var(--success); color: var(--success); }
.timeline-marker.pending { background: var(--bg); border-color: var(--border); color: var(--text-muted); }
.timeline-marker.active  { background: rgba(10,35,66,0.1); border-color: var(--primary); color: var(--primary); }
.timeline-content { flex: 1; }
.timeline-title { font-size: 0.88rem; font-weight: 600; color: var(--text); }
.timeline-sub { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }

/* ========== CHARTS ========== */
.chart-container { position: relative; height: 220px; }

/* ========== ALERT PANEL ========== */
.alert-item {
  display: flex; gap: 12px; padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}
.alert-item:last-child { border-bottom: none; }
.alert-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; margin-top: 6px; }
.alert-dot.high   { background: var(--danger); }
.alert-dot.medium { background: var(--warning); }
.alert-dot.low    { background: var(--info); }
.alert-text { flex: 1; }
.alert-title { font-size: 0.85rem; font-weight: 600; color: var(--text); }
.alert-msg { font-size: 0.77rem; color: var(--text-muted); margin-top: 2px; }
.alert-time { font-size: 0.7rem; color: var(--text-light); margin-top: 4px; }

/* ========== LOGIN PAGE ========== */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.login-card {
  background: var(--white);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
  width: 100%; max-width: 420px;
  overflow: hidden;
}
.login-header {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  padding: 36px 32px;
  text-align: center;
}
.login-logo {
  width: 70px; height: 70px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem; color: white; margin: 0 auto 16px;
  box-shadow: 0 8px 24px rgba(201,168,76,0.4);
}
.login-title { color: white; font-size: 1.4rem; font-weight: 800; }
.login-subtitle { color: rgba(255,255,255,0.65); font-size: 0.85rem; margin-top: 6px; }
.login-body { padding: 32px; }
.login-btn {
  width: 100%; padding: 13px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white; border: none; border-radius: var(--radius-sm);
  font-family: 'Tajawal', sans-serif; font-size: 0.98rem; font-weight: 700;
  cursor: pointer; transition: all var(--transition);
  margin-top: 8px;
}
.login-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.login-error { background: rgba(198,40,40,0.08); border: 1px solid rgba(198,40,40,0.25); border-radius: var(--radius-sm); padding: 10px 14px; color: var(--danger); font-size: 0.85rem; margin-top: 14px; display: none; }
.login-error.show { display: block; }

/* ========== PROGRESS BAR ========== */
.progress-bar { height: 8px; background: var(--bg-dark); border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 4px; transition: width 0.5s ease; }
.progress-fill.primary { background: var(--primary); }
.progress-fill.gold    { background: var(--gold); }
.progress-fill.success { background: var(--success-light); }
.progress-fill.danger  { background: var(--danger-light); }

/* ========== VOICE BTN ========== */
.voice-btn {
  width: 36px; height: 36px; flex-shrink: 0;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: white; cursor: pointer; font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.voice-btn:hover { background: var(--danger); border-color: var(--danger); color: white; }
.voice-btn.listening { background: var(--danger); border-color: var(--danger); color: white; animation: pulse 1.2s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(198,40,40,0.4); } 50% { box-shadow: 0 0 0 8px rgba(198,40,40,0); } }

/* ========== LOADING ========== */
.loading-overlay {
  position: absolute; inset: 0;
  background: rgba(255,255,255,0.8);
  display: flex; align-items: center; justify-content: center;
  border-radius: inherit; z-index: 10;
}
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton {
  background: linear-gradient(90deg, var(--bg) 25%, var(--bg-dark) 50%, var(--bg) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ========== UTILITIES ========== */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-gold { color: var(--gold-dark); }
.text-primary { color: var(--primary); }
.fw-bold { font-weight: 700; }
.fw-normal { font-weight: 400; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.p-0 { padding: 0; }
.hidden { display: none !important; }
.w-full { width: 100%; }

/* ========== RESPONSIVE ========== */

/* Overlay backdrop for mobile sidebar */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(10,35,66,0.5);
  z-index: 149;
}
.sidebar-overlay.visible { display: block; }

/* زر فتح القائمة العائم — منتصف يمين الشاشة */
#sidebar-float-btn {
  display: none;
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 200;
  background: var(--primary);
  color: var(--white);
  border: none;
  border-radius: 10px 0 0 10px;
  padding: 16px 10px;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: -3px 0 14px rgba(10,35,66,0.35);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background var(--transition), padding var(--transition);
}
#sidebar-float-btn:active { background: var(--primary-light); padding-right: 14px; }

@media (max-width: 900px) {
  #sidebar-float-btn { display: flex; align-items: center; justify-content: center; }
}

/* Sidebar open state — يتغلب على display:none في أي viewport حتى لو desktop mode */
.sidebar.open {
  display: flex !important;
  right: 0 !important;
  z-index: 150 !important;
}

/* Tables horizontal scroll on mobile */
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.dash-table-body { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.dash-table-body table { min-width: 500px; }

@media (max-width: 900px) {
  /* Sidebar as drawer */
  .sidebar {
    z-index: 150;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { right: 0; }

  /* Main fills full width */
  .main-content { margin-right: 0; width: 100%; }

  /* Topbar hamburger */
  #sidebar-toggle { display: flex !important; }

  /* Forms */
  .form-row-2, .form-row-3 { grid-template-columns: 1fr; }

  /* Stats */
  .stat-grid { grid-template-columns: repeat(2, 1fr); }

  /* AI floating panel */
  .ai-chat-panel { width: calc(100vw - 24px); left: 12px; right: 12px; }

  /* Topbar AI button hidden (use dashboard panel instead) */
  .ai-fab-toggle { display: none; }

  /* Modals full width */
  .modal-content { width: 96vw !important; margin: 20px auto; max-height: 90vh; overflow-y: auto; }

  /* Cards padding */
  .card-body { padding: 12px; }
  .card-header { padding: 12px 14px; }
}

@media (max-width: 600px) {
  /* Single column stats */
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }

  /* Page padding */
  .page-content { padding: 12px; }
  .topbar { padding: 0 12px; }
  .topbar-title { font-size: 0.9rem; }

  /* Dashboard KPIs scroll */
  .dash-ai-kpis { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
  .dash-kpi { min-width: 80px; flex-shrink: 0; }

  /* Dashboard AI header stack */
  .dash-ai-header { flex-wrap: wrap; gap: 10px; }
  .dash-ai-kpis { width: 100%; order: 3; }

  /* Tabs scroll */
  .dash-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; flex-wrap: nowrap; }
  .dash-tab { flex-shrink: 0; font-size: 0.76rem; padding: 8px 12px; }

  /* Quick btns scroll */
  .dash-quick-btns { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; padding-bottom: 6px; }
  .dash-quick-btn { flex-shrink: 0; }

  /* AI messages shorter */
  .dash-ai-msgs { min-height: 100px; max-height: 200px; }

  /* Send button compact */
  .dash-ai-input .btn-send { padding: 10px 14px; font-size: 0.8rem; }

  /* Table action buttons */
  .dash-action-btn { font-size: 0.7rem; padding: 3px 8px; }

  /* Topbar actions */
  .topbar-actions { gap: 4px; }
  .topbar-btn { width: 34px; height: 34px; font-size: 0.9rem; }
}

@media (max-width: 400px) {
  .stat-grid { grid-template-columns: 1fr; }
  .dash-ai-input { gap: 6px; padding: 10px 12px 12px; }
  .dash-ai-input input { font-size: 0.82rem; }
}

/* ========== PROJECT PAGE ENHANCEMENTS ========== */
/* Section header with action */
.section-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px; background: linear-gradient(to left, #f4f7fb, white);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  margin-bottom: 14px; gap: 10px;
}
.section-bar-title {
  font-size: 0.9rem; font-weight: 700; color: var(--primary);
  display: flex; align-items: center; gap: 7px;
}
.section-bar-actions { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }

/* Milestone / payment card rows */
.milestone-row {
  display: grid; grid-template-columns: 1fr auto auto auto;
  align-items: center; gap: 12px; padding: 12px 16px;
  border-bottom: 1px solid rgba(208,217,228,0.5);
  transition: background var(--transition);
}
.milestone-row:hover { background: rgba(10,35,66,0.02); }
.milestone-row:last-child { border-bottom: none; }

/* File upload zone */
.upload-zone {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 20px; text-align: center; cursor: pointer;
  transition: all var(--transition); background: rgba(240,244,248,0.5);
  color: var(--text-muted);
}
.upload-zone:hover { border-color: var(--primary); background: rgba(10,35,66,0.04); color: var(--primary); }
.upload-zone input[type=file] { display: none; }

/* Amount highlight */
.amount-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 0.82rem; font-weight: 700;
  background: rgba(10,35,66,0.07); color: var(--primary);
}
.amount-pill.success { background: rgba(46,125,50,0.1); color: var(--success); }
.amount-pill.danger  { background: rgba(198,40,40,0.1); color: var(--danger); }
.amount-pill.gold    { background: rgba(201,168,76,0.15); color: var(--gold-dark); }

/* Info row in card */
.info-row { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 14px; }
.info-item { display: flex; flex-direction: column; gap: 3px; min-width: 140px; }
.info-label { font-size: 0.72rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.info-value { font-size: 0.9rem; color: var(--text); font-weight: 600; }

/* Status dot inline */
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.status-dot.active   { background: var(--success); box-shadow: 0 0 0 3px rgba(46,125,50,0.15); }
.status-dot.pending  { background: var(--warning); box-shadow: 0 0 0 3px rgba(245,124,0,0.15); }
.status-dot.inactive { background: var(--text-light); }
.status-dot.danger   { background: var(--danger); box-shadow: 0 0 0 3px rgba(198,40,40,0.15); }

/* Inline label-button pairs */
.label-file-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 13px; border-radius: var(--radius-sm);
  font-size: 0.8rem; font-weight: 600; cursor: pointer;
  transition: all var(--transition); font-family: 'Tajawal', sans-serif;
}
.label-file-btn input[type=file] { display: none; }

/* ========== FORM ENHANCEMENTS ========== */
.form-section { margin-bottom: 24px; }
.form-section-title {
  font-size: 0.8rem; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.06em;
  margin-bottom: 12px; padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 7px;
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px rgba(10,35,66,0.08) !important;
}

/* ========== BADGE IMPROVEMENTS ========== */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 20px;
  font-size: 0.73rem; font-weight: 700; white-space: nowrap;
  letter-spacing: 0.02em;
}
.badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.badge-primary  { background: rgba(10,35,66,0.1);  color: var(--primary); }
.badge-gold     { background: rgba(201,168,76,0.15); color: var(--gold-dark); }
.badge-success  { background: rgba(46,125,50,0.1);  color: #2e7d32; }
.badge-danger   { background: rgba(198,40,40,0.1);  color: var(--danger); }
.badge-warning  { background: rgba(245,124,0,0.12); color: #e65100; }
.badge-info     { background: rgba(2,136,209,0.1);  color: var(--info); }
.badge-muted    { background: var(--bg-dark); color: var(--text-muted); }
.badge-muted::before { opacity: 0.5; }

/* ========== DIVIDER ========== */
.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.divider-label {
  display: flex; align-items: center; gap: 10px; color: var(--text-muted);
  font-size: 0.75rem; font-weight: 600; margin: 16px 0;
}
.divider-label::before, .divider-label::after {
  content: ''; flex: 1; border-top: 1px solid var(--border);
}

/* ========== MODAL IMPROVEMENTS ========== */
.modal-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(135deg, var(--primary) 0%, #1a3a6e 100%);
  color: white;
  border-radius: var(--radius) var(--radius) 0 0;
  gap: 10px;
}
.modal-title { font-size: 0.98rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.modal-subtitle { font-size: 0.74rem; opacity: 0.7; margin-top: 2px; }

/* ========== PRINT / RECEIPT ========== */
@media print {
  .sidebar, .topbar, .ai-fab, .ai-chat-panel, .btn, .page-header .page-actions { display: none !important; }
  .main-content { margin-right: 0 !important; }
  .card { box-shadow: none !important; border: 1px solid #ddd !important; }
}
