/* =====================================================================
   النظام المحاسبي المتكامل - style.css
   VERSION 6 - Modern Admin Dashboard (مطابق للصورة المرجعية)
   ===================================================================== */

* { margin:0; padding:0; box-sizing:border-box; }

:root {
  /* الألوان الأساسية */
  --primary: #1a3b5c;
  --primary-dark: #0f2645;
  --primary-light: #2563a8;
  --primary-soft: #e8f0f9;
  --accent: #4a9eff;
  --accent-light: #7db9ff;

  /* ألوان الإحصائيات */
  --green: #10b981;
  --green-soft: #d1fae5;
  --orange: #f59e0b;
  --orange-soft: #fef3c7;
  --red: #ef4444;
  --red-soft: #fee2e2;
  --blue: #3b82f6;
  --blue-soft: #dbeafe;
  --purple: #8b5cf6;
  --purple-soft: #ede9fe;

  /* الأساسيات */
  --white: #ffffff;
  --text: #1e293b;
  --text-2: #475569;
  --muted: #94a3b8;
  --border: #e8eef5;
  --border-2: #dbe3ec;
  --bg: #f4f7fb;
  --bg-2: #edf2f8;
  --bg-3: #e4ebf3;

  /* القياسات */
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* الظلال */
  --shadow-sm: 0 1px 3px rgba(15,38,69,0.04);
  --shadow: 0 2px 8px rgba(15,38,69,0.06);
  --shadow-md: 0 4px 14px rgba(15,38,69,0.08);
  --shadow-lg: 0 10px 30px rgba(15,38,69,0.12);

  --transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

html, body { height:100%; }

body {
  font-family: 'Cairo', sans-serif;
  background: var(--bg);
  color: var(--text);
  direction: rtl;
  overflow-x: hidden;
  font-weight: 500;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

.hidden { display:none !important; }

/* Scrollbar */
::-webkit-scrollbar { width:8px; height:8px; }
::-webkit-scrollbar-track { background:var(--bg-2); }
::-webkit-scrollbar-thumb { background:var(--border-2); border-radius:4px; }
::-webkit-scrollbar-thumb:hover { background:var(--muted); }

/* ============================================================
   LOGIN
   ============================================================ */
.login-screen {
  min-height:100vh;
  display:flex; align-items:center; justify-content:center;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 60%, var(--primary-light) 100%);
  padding:20px;
  position:relative;
  overflow:hidden;
}
.login-screen::before {
  content:'';
  position:absolute;
  width:600px; height:600px;
  border-radius:50%;
  background: radial-gradient(circle, rgba(74,158,255,0.3) 0%, transparent 70%);
  top:-200px; right:-200px;
  filter: blur(60px);
}
.login-screen::after {
  content:'';
  position:absolute;
  width:500px; height:500px;
  border-radius:50%;
  background: radial-gradient(circle, rgba(74,158,255,0.2) 0%, transparent 70%);
  bottom:-200px; left:-200px;
  filter: blur(60px);
}

.login-card {
  position:relative;
  z-index:2;
  background:#fff;
  border-radius: var(--radius-xl);
  padding: 48px 40px;
  text-align:center;
  max-width: 420px;
  width:100%;
  box-shadow: 0 30px 70px rgba(0,0,0,0.35);
}
.logo-circle {
  width: 84px; height: 84px;
  margin: 0 auto 22px;
  border-radius: 22px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  display: flex; align-items:center; justify-content:center;
  font-size: 42px;
  box-shadow: 0 15px 35px rgba(74,158,255,0.35);
}
.login-card h1 { font-size:22px; font-weight:800; margin-bottom:8px; color:var(--text); }
.login-card .sub { color:var(--muted); font-size:14px; margin-bottom:28px; line-height:1.7; }

.btn-google {
  display: flex; align-items:center; justify-content:center; gap:12px;
  width:100%; padding:14px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  font-family: 'Cairo', sans-serif;
  font-size: 14px; font-weight: 700;
  color: var(--text);
  cursor: pointer;
  transition: var(--transition);
}
.btn-google:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(26,59,92,0.25);
}
.btn-google:hover svg { filter: brightness(0) invert(1); }

.error-msg { color:var(--red); margin-top:14px; font-size:13px; font-weight:700; }

/* ============================================================
   APP LAYOUT
   ============================================================ */
.app { display: flex; min-height: 100vh; }

/* ============================================================
   SIDEBAR - Navy Blue Professional
   ============================================================ */
.sidebar {
  width: 240px;
  background: linear-gradient(180deg, var(--primary-dark) 0%, var(--primary) 100%);
  color: #fff;
  padding: 0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; bottom: 0; right: 0;
  z-index: 100;
  transition: transform 0.3s ease;
  overflow: hidden;
}

.brand {
  padding: 20px 22px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  background: rgba(0,0,0,0.15);
  min-height: 76px;
}
.brand-icon {
  width: 42px; height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent) 0%, #1a7bea 100%);
  display: flex; align-items:center; justify-content:center;
  font-size: 22px;
  box-shadow: 0 6px 16px rgba(74,158,255,0.4);
  flex-shrink: 0;
}
.brand-text { display:flex; flex-direction:column; gap:2px; min-width:0; }
.brand-text .name { font-size:16px; font-weight:800; color:#fff; letter-spacing:0.3px; }
.brand-text .sub { font-size:10px; color:rgba(255,255,255,0.55); font-weight:600; letter-spacing:1.5px; text-transform:uppercase; }

.nav {
  flex: 1;
  overflow-y: auto;
  padding: 14px 10px 20px;
}
.nav::-webkit-scrollbar { width: 4px; }
.nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

.nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  margin-bottom: 4px;
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  border-radius: 10px;
  position: relative;
}
.nav a > span:first-child {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.nav a:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}
.nav a.active {
  background: linear-gradient(135deg, var(--accent) 0%, #2e7dd6 100%);
  color: #fff;
  box-shadow: 0 6px 18px rgba(74,158,255,0.35);
}

/* User info at bottom of sidebar */
.sidebar-user {
  padding: 16px 18px;
  border-top: 1px solid rgba(255,255,255,0.08);
  background: rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-user img {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.2);
}
.sidebar-user .info { flex: 1; min-width: 0; }
.sidebar-user .info .name { font-size:13px; font-weight:700; color:#fff; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.sidebar-user .info .role { font-size:11px; color:rgba(255,255,255,0.55); font-weight:600; }

/* ============================================================
   MAIN
   ============================================================ */
.main {
  flex: 1;
  margin-right: 240px;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
  background: #fff;
  padding: 0 24px;
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  gap: 16px;
}
.menu-toggle {
  display: none;
  background: var(--bg-2);
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--primary);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.menu-toggle:hover { background: var(--primary); color: #fff; }

.topbar-search {
  flex: 1;
  max-width: 480px;
  position: relative;
}
.topbar-search input {
  width: 100%;
  padding: 11px 44px 11px 16px;
  border: 1.5px solid var(--border);
  border-radius: 100px;
  background: var(--bg);
  font-family: 'Cairo', sans-serif;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  outline: none;
  transition: var(--transition);
}
.topbar-search input::placeholder { color: var(--muted); font-weight: 500; }
.topbar-search input:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(74,158,255,0.1);
}
.topbar-search::before {
  content: '🔍';
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  opacity: 0.5;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.icon-btn {
  width: 42px; height: 42px;
  border-radius: 12px;
  background: var(--bg);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  color: var(--primary);
  transition: var(--transition);
  position: relative;
}
.icon-btn:hover {
  background: var(--primary);
  color: #fff;
  transform: translateY(-2px);
}
.icon-btn .badge-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--red);
  border: 2px solid #fff;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 5px 5px 14px;
  background: var(--bg);
  border-radius: 100px;
  cursor: pointer;
  transition: var(--transition);
  border: 1.5px solid transparent;
}
.topbar-user:hover { border-color: var(--accent); }
.topbar-user img {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 2px solid #fff;
  object-fit: cover;
}
.topbar-user .info { text-align: right; }
.topbar-user .info .name { font-size:12.5px; font-weight:800; color:var(--text); line-height:1.2; }
.topbar-user .info .role { font-size:10.5px; color:var(--muted); font-weight:600; }

.btn-logout {
  background: transparent;
  color: var(--red);
  border: none;
  padding: 8px 12px;
  border-radius: 10px;
  font-family: 'Cairo', sans-serif;
  font-weight: 800;
  font-size: 12.5px;
  cursor: pointer;
  transition: var(--transition);
}
.btn-logout:hover {
  background: var(--red-soft);
}

/* ============================================================
   CONTENT
   ============================================================ */
.content {
  padding: 22px 24px 32px;
  max-width: 1600px;
  width: 100%;
  flex: 1;
}

/* Page Header */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 16px;
  flex-wrap: wrap;
}
.page-header h2 {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
}
.page-header .page-subtitle {
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
  font-weight: 600;
}

/* ============================================================
   WELCOME BANNER
   ============================================================ */
.welcome-banner {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 50%, #0a1f38 100%);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  margin-bottom: 22px;
  color: #fff;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  box-shadow: 0 10px 30px rgba(26,59,92,0.15);
}
.welcome-banner::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 90% 10%, rgba(74,158,255,0.3) 0%, transparent 45%),
    radial-gradient(circle at 10% 90%, rgba(74,158,255,0.15) 0%, transparent 40%);
  pointer-events: none;
}
.welcome-content { position: relative; z-index: 1; flex: 1; }
.welcome-banner h2 {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 8px;
  color: #fff;
}
.welcome-banner p {
  font-size: 13.5px;
  color: rgba(255,255,255,0.75);
  font-weight: 600;
}
.welcome-icon {
  font-size: 90px;
  opacity: 0.15;
  position: absolute;
  left: 30px;
  bottom: -10px;
  transform: rotate(-10deg);
}

/* ============================================================
   STATS CARDS
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}
.stats-grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

.stat-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  border: 1px solid var(--border);
  transition: var(--transition);
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 100px;
  overflow: hidden;
}
.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
}

.stat-card .stat-icon {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
  position: relative;
}
.stat-card .stat-icon.green { background: var(--green-soft); color: var(--green); }
.stat-card .stat-icon.orange { background: var(--orange-soft); color: var(--orange); }
.stat-card .stat-icon.red { background: var(--red-soft); color: var(--red); }
.stat-card .stat-icon.blue { background: var(--blue-soft); color: var(--blue); }
.stat-card .stat-icon.purple { background: var(--purple-soft); color: var(--purple); }
.stat-card .stat-icon.primary { background: var(--primary-soft); color: var(--primary); }

.stat-card .stat-body { flex: 1; min-width: 0; }
.stat-card .stat-label {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stat-card .stat-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.15;
  letter-spacing: -0.3px;
}
.stat-card .stat-value.small { font-size: 17px; }
.stat-card .stat-currency {
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
  margin-top: 3px;
}

/* ============================================================
   DASHBOARD GRID
   ============================================================ */
.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 22px;
}
.dashboard-grid.equal { grid-template-columns: 1fr 1fr; }
.dashboard-grid.single { grid-template-columns: 1fr; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  border: 1px solid var(--border);
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}
.card:hover { box-shadow: var(--shadow); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.card-header h3 {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-header .card-action {
  font-size: 12.5px;
  color: var(--accent);
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
  padding: 5px 10px;
  border-radius: 8px;
}
.card-header .card-action:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

/* legacy .card h3 (fallback) */
.card > h3 {
  margin-bottom: 18px;
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

/* ============================================================
   QUICK ACTIONS
   ============================================================ */
.quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.quick-action {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 12px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.quick-action:hover {
  background: #fff;
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}
.quick-action .qa-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}
.quick-action .qa-icon.blue { background: var(--blue-soft); color: var(--blue); }
.quick-action .qa-icon.green { background: var(--green-soft); color: var(--green); }
.quick-action .qa-icon.orange { background: var(--orange-soft); color: var(--orange); }
.quick-action .qa-icon.purple { background: var(--purple-soft); color: var(--purple); }
.quick-action .qa-icon.red { background: var(--red-soft); color: var(--red); }
.quick-action .qa-icon.primary { background: var(--primary-soft); color: var(--primary); }
.quick-action .qa-label {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--text);
}

/* ============================================================
   ALERTS LIST
   ============================================================ */
.alerts-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.alert-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  transition: var(--transition);
}
.alert-item:hover {
  background: #fff;
  border-color: var(--border-2);
  transform: translateX(-4px);
}
.alert-item .alert-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.alert-item .alert-icon.red { background: var(--red-soft); color: var(--red); }
.alert-item .alert-icon.orange { background: var(--orange-soft); color: var(--orange); }
.alert-item .alert-icon.green { background: var(--green-soft); color: var(--green); }
.alert-item .alert-icon.blue { background: var(--blue-soft); color: var(--blue); }
.alert-item .alert-body { flex: 1; min-width: 0; }
.alert-item .alert-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 2px;
}
.alert-item .alert-sub {
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 600;
}
.alert-item .alert-count {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
}

/* ============================================================
   TOOLBAR
   ============================================================ */
.toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.toolbar-left, .toolbar-right {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.search-input {
  padding: 10px 16px;
  border: 1.5px solid var(--border);
  border-radius: 100px;
  font-family: 'Cairo', sans-serif;
  font-size: 13.5px;
  min-width: 220px;
  outline: none;
  transition: var(--transition);
  background: var(--bg);
  color: var(--text);
  font-weight: 600;
}
.search-input::placeholder { color: var(--muted); font-weight: 500; }
.search-input:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(74,158,255,0.1);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  padding: 10px 18px;
  border: none;
  border-radius: 10px;
  font-family: 'Cairo', sans-serif;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, #2e7dd6 100%);
  color: #fff;
  box-shadow: 0 4px 12px rgba(74,158,255,0.3);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(74,158,255,0.4);
}

.btn-success {
  background: linear-gradient(135deg, var(--green) 0%, #059669 100%);
  color: #fff;
  box-shadow: 0 4px 12px rgba(16,185,129,0.25);
}
.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(16,185,129,0.35);
}

.btn-danger {
  background: linear-gradient(135deg, var(--red) 0%, #dc2626 100%);
  color: #fff;
  box-shadow: 0 4px 12px rgba(239,68,68,0.25);
}
.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(239,68,68,0.35);
}

.btn-secondary {
  background: #fff;
  color: var(--text-2);
  border: 1.5px solid var(--border-2);
}
.btn-secondary:hover {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: var(--accent);
}

.btn-sm {
  padding: 7px 12px;
  font-size: 12px;
  border-radius: 8px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* ============================================================
   TABLES
   ============================================================ */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}
th, td {
  padding: 13px 16px;
  text-align: right;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}
th {
  background: var(--bg);
  font-weight: 800;
  color: var(--text-2);
  font-size: 12px;
  white-space: nowrap;
  letter-spacing: 0.3px;
  border-bottom: 1px solid var(--border-2);
}
td { color: var(--text-2); font-weight: 600; }

tbody tr { transition: var(--transition); }
tbody tr:hover { background: var(--primary-soft); }
tbody tr:last-child td { border-bottom: none; }
td strong { color: var(--text); font-weight: 800; }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border-radius: 100px;
  font-size: 11.5px;
  font-weight: 800;
  white-space: nowrap;
}
.badge-green { background: var(--green-soft); color: #15803d; }
.badge-red { background: var(--red-soft); color: #991b1b; }
.badge-orange { background: var(--orange-soft); color: #92400e; }
.badge-blue { background: var(--blue-soft); color: #1e40af; }
.badge-gray { background: var(--bg-2); color: var(--muted); }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 50px 20px;
  color: var(--muted);
}
.empty-state .icon {
  font-size: 50px;
  margin-bottom: 12px;
  opacity: 0.5;
}
.empty-state p { font-size: 14px; font-weight: 700; }

/* ============================================================
   MODAL
   ============================================================ */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(15,38,69,0.5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-content {
  background: #fff;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 800px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(15,38,69,0.4);
  animation: modalIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  padding: 18px 24px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 {
  font-size: 17px;
  font-weight: 800;
  color: #fff;
}
.close-btn {
  background: rgba(255,255,255,0.15);
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #fff;
  line-height: 1;
  width: 34px; height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  font-weight: 700;
}
.close-btn:hover {
  background: var(--red);
  transform: rotate(90deg);
}
.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 12.5px;
  font-weight: 800;
  margin-bottom: 7px;
  color: var(--text-2);
}
.form-group label small { font-weight: 500; color: var(--muted); }

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-family: 'Cairo', sans-serif;
  font-size: 13.5px;
  outline: none;
  background: #fff;
  color: var(--text);
  transition: var(--transition);
  font-weight: 600;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(74,158,255,0.1);
}
.form-group input:disabled {
  background: var(--bg-2);
  color: var(--muted);
  cursor: not-allowed;
}
.form-group textarea { resize: vertical; min-height: 70px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

/* ============================================================
   ITEM ROWS
   ============================================================ */
.item-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr auto;
  gap: 8px;
  margin-bottom: 8px;
  align-items: center;
  padding: 10px;
  background: var(--bg);
  border-radius: 10px;
  border: 1px solid var(--border);
}
.item-row select,
.item-row input {
  padding: 9px 11px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: 'Cairo', sans-serif;
  font-size: 13px;
  width: 100%;
  outline: none;
  background: #fff;
  color: var(--text);
  font-weight: 600;
}
.item-row select:focus,
.item-row input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(74,158,255,0.1);
}
.item-row .row-total {
  font-weight: 800;
  font-size: 14px;
  color: var(--primary);
  text-align: center;
  padding: 8px;
  background: var(--primary-soft);
  border-radius: 8px;
}
.item-row .row-remove {
  background: var(--red-soft);
  color: var(--red);
  border: none;
  width: 34px; height: 34px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  transition: var(--transition);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.item-row .row-remove:hover { background: var(--red); color: #fff; }

/* ============================================================
   TOTALS
   ============================================================ */
.totals-box {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 18px;
  margin-top: 14px;
  border: 1px dashed var(--border-2);
}
.totals-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 13.5px;
  color: var(--text-2);
  font-weight: 600;
}
.totals-row strong { color: var(--text); font-weight: 800; }
.totals-row.grand {
  border-top: 2px dashed var(--border-2);
  margin-top: 8px;
  padding-top: 12px;
  font-size: 17px;
  color: var(--primary);
}
.totals-row.grand strong {
  color: var(--primary);
  font-size: 20px;
  font-weight: 800;
}

/* ============================================================
   FORM ACTIONS
   ============================================================ */
.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1200px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .stats-grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  .sidebar { transform: translateX(100%); width: 260px; box-shadow: -8px 0 24px rgba(0,0,0,0.2); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-right: 0; }
  .menu-toggle { display: flex; align-items: center; justify-content: center; }
  .topbar { padding: 0 14px; height: 66px; }
  .topbar-search { max-width: 100%; }
  .topbar-search input { font-size: 12.5px; padding: 9px 40px 9px 14px; }
  .topbar-user .info { display: none; }
  .topbar-user { padding: 4px; }
  .content { padding: 16px; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .item-row { grid-template-columns: 1fr; }
  .item-row .row-remove { width: 100%; height: 38px; }
  .search-input { min-width: 100%; }
  .toolbar { padding: 12px; }
  .toolbar-left, .toolbar-right { width: 100%; }
  .toolbar-right .btn { flex: 1; }
  .card { padding: 16px; border-radius: var(--radius); }
  .welcome-banner { padding: 22px 20px; }
  .welcome-banner h2 { font-size: 19px; }
  .welcome-icon { font-size: 60px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .stats-grid-4 { grid-template-columns: 1fr 1fr; }
  .page-header h2 { font-size: 18px; }
  .modal-body { padding: 18px; }
  .modal-header { padding: 14px 18px; }
}

@media (max-width: 480px) {
  .stats-grid, .stats-grid-4 { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 14px; min-height: 84px; gap: 10px; }
  .stat-card .stat-icon { width: 42px; height: 42px; font-size: 18px; border-radius: 10px; }
  .stat-value { font-size: 16px; }
  .stat-value.small { font-size: 13px; }
  .stat-label { font-size: 10.5px; }
  .quick-actions { grid-template-columns: 1fr 1fr; gap: 8px; }
  .quick-action { padding: 14px 8px; }
  .quick-action .qa-icon { width: 38px; height: 38px; font-size: 18px; }
  .quick-action .qa-label { font-size: 11px; }
  .btn { font-size: 12px; padding: 9px 14px; }
  .btn-sm { font-size: 11px; padding: 6px 10px; }
  th, td { padding: 10px 12px; font-size: 12px; }
}

/* ============================================================
   Print
   ============================================================ */
@media print {
  .sidebar, .topbar, .toolbar, .form-actions, .btn, .menu-toggle, .welcome-banner { display: none !important; }
  .main { margin-right: 0; }
  .content { padding: 0; }
  .card { box-shadow: none; border: 1px solid #ddd; page-break-inside: avoid; }
}