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

:root {
  --sidebar-bg: #1c1810;
  --sidebar-active-bg: #ffffff;
  --sidebar-active-color: #8a7250;
  --orange: #b49a6f;
  --orange-dark: #8a7250;
  --orange-light: #f5ede0;
  --teal: #1c1810;
  --teal-light: #f5ede0;
  --bg: #f2f4f7;
  --card-bg: #ffffff;
  --card-alt: #f8f9fb;
  --border: #e8ecf0;
  --text-dark: #1a2332;
  --text-med: #4a5568;
  --text-gray: #9aa5b4;
  --red: #e53e3e;
  --red-light: #fff5f5;
  --green: #38a169;
  --green-light: #f0fff4;
  --yellow: #d97706;
  --yellow-light: #fffbeb;
  --blue: #3182ce;
  --sidebar-width: 210px;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.12), 0 4px 8px rgba(0,0,0,0.06);
  --transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
}

/* ============= DARK MODE ============= */
[data-theme="dark"] {
  --bg: #0f1117;
  --card-bg: #1a1d27;
  --card-alt: #22263a;
  --border: #2d3148;
  --text-dark: #e8eaf0;
  --text-med: #a8afc0;
  --text-gray: #5a6278;
  --sidebar-bg: #0b1f1f;
  --sidebar-active-bg: #2a2015;
  --sidebar-active-color: #d4b87a;
  --orange-light: #2a2015;
  --teal-light: #2a2015;
  --red-light: #2d0f0f;
  --green-light: #0d2d1a;
  --yellow-light: #2d2005;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.5);
}
[data-theme="dark"] body { background: var(--bg); }
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
  background: var(--card-alt) !important;
  color: var(--text-dark) !important;
  border-color: var(--border) !important;
}
[data-theme="dark"] .modal { background: var(--card-bg); }
[data-theme="dark"] .modal-overlay { background: rgba(0,0,0,0.7); }
[data-theme="dark"] thead { background: var(--card-alt) !important; }
[data-theme="dark"] tbody tr:hover { background: var(--card-alt) !important; }
[data-theme="dark"] .tabs-bar { background: var(--card-alt); }
[data-theme="dark"] .tab-btn.active { background: var(--card-bg); color: var(--orange); }
[data-theme="dark"] .section-card { background: var(--card-bg); border-color: var(--border); }
[data-theme="dark"] .page-header { background: var(--card-bg); border-color: var(--border); }
[data-theme="dark"] .stat-card { background: var(--card-bg); border-color: var(--border); }
[data-theme="dark"] .entity-card { background: var(--card-bg); border-color: var(--border); }
[data-theme="dark"] .entity-card:hover { border-color: var(--orange) !important; }
[data-theme="dark"] .data-table { background: var(--card-bg); }
[data-theme="dark"] .data-table td { border-color: var(--border); }
[data-theme="dark"] .badge-ok { background: var(--green-light); color: #6ee7a0; }
[data-theme="dark"] .badge-expired, [data-theme="dark"] .badge-late { background: var(--red-light); color: #fc8181; }
[data-theme="dark"] .badge-warning, [data-theme="dark"] .badge-urgent { background: var(--yellow-light); color: #f6c05c; }
[data-theme="dark"] .badge-gray { background: var(--card-alt); color: var(--text-gray); }
[data-theme="dark"] .btn-secondary { background: var(--card-alt); border-color: var(--border); color: var(--text-med); }
[data-theme="dark"] .file-group { background: var(--card-alt); border-color: var(--border); }
[data-theme="dark"] .form-divider { border-color: var(--border); }
[data-theme="dark"] .sidebar { background: var(--sidebar-bg); }
[data-theme="dark"] .back-link { color: var(--text-med); }
[data-theme="dark"] .breadcrumb a { color: var(--text-med); }
[data-theme="dark"] .confirm-box { background: var(--card-bg); }
[data-theme="dark"] .toolbar { background: var(--card-bg); border-color: var(--border); }

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

body {
  font-family: 'Cairo', 'Segoe UI', system-ui, sans-serif;
  direction: rtl;
  background: var(--bg);
  color: var(--text-dark);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
}

/* ============= SCROLLBAR ============= */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c5cdd6; border-radius: 3px; }

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

.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 0;
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  z-index: 100;
  box-shadow: -4px 0 20px rgba(0,0,0,0.15);
}

.main {
  margin-right: var(--sidebar-width);
  flex: 1;
  padding: 28px 32px;
  min-height: 100vh;
}

/* ============= SIDEBAR ============= */
.sidebar-header {
  padding: 24px 18px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  background: rgba(0,0,0,0.15);
}

.sidebar-profile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.avatar {
  width: 54px;
  height: 54px;
  background: linear-gradient(135deg, var(--orange), #d4b87a);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 900;
  color: white;
  box-shadow: 0 4px 12px rgba(180,154,111,0.4);
  border: 3px solid rgba(255,255,255,0.2);
}

.sidebar-name {
  color: white;
  font-size: 13.5px;
  font-weight: 700;
  text-align: center;
}

.sidebar-role {
  color: rgba(255,255,255,0.55);
  font-size: 11.5px;
  background: rgba(255,255,255,0.1);
  padding: 2px 10px;
  border-radius: 20px;
}

.sidebar-nav {
  flex: 1;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-list { list-style: none; display: flex; flex-direction: column; gap: 3px; }
.nav-list li a, .nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.72);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: var(--transition);
  justify-content: flex-end;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  font-family: inherit;
}
.nav-list li a:hover, .nav-link:hover {
  background: rgba(255,255,255,0.1);
  color: white;
}
.nav-list li a.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-color);
  box-shadow: var(--shadow-sm);
}
.nav-list li a.active .nav-icon { color: var(--orange); }

.nav-icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }

.sidebar-footer {
  padding: 14px 12px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

/* ============= PAGE HEADER ============= */
.page-header { margin-bottom: 26px; }

.page-title {
  font-size: 24px;
  font-weight: 900;
  color: var(--text-dark);
  text-align: right;
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
}

.page-title-icon {
  width: 40px;
  height: 40px;
  background: var(--orange-light);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--orange);
  font-size: 18px;
}

.breadcrumb {
  font-size: 12px;
  color: var(--text-gray);
  text-align: right;
  margin-top: 5px;
  display: flex;
  align-items: center;
  gap: 5px;
  justify-content: flex-end;
}
.breadcrumb a { color: var(--text-gray); text-decoration: none; transition: var(--transition); }
.breadcrumb a:hover { color: var(--orange); }
.breadcrumb .sep { color: var(--border); }

/* ============= STATS CARDS ============= */
.stats-row {
  display: grid;
  gap: 16px;
  margin-bottom: 24px;
}
.stats-row.cols-3 { grid-template-columns: repeat(3,1fr); }
.stats-row.cols-4 { grid-template-columns: repeat(4,1fr); }
.stats-row.cols-2 { grid-template-columns: repeat(2,1fr); }
.stats-row.cols-6 { grid-template-columns: repeat(6,1fr); }

.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px 16px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--orange), #d4b87a);
  opacity: 0;
  transition: var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.stat-card:hover::before { opacity: 1; }

.stat-icon-wrap {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  background: var(--orange-light);
  color: var(--orange);
  margin-bottom: 2px;
}
.stat-icon { color: var(--orange); font-size: 20px; }
.stat-label { font-size: 11.5px; color: var(--text-med); font-weight: 600; line-height: 1.3; }
.stat-value { font-size: 28px; font-weight: 900; color: var(--orange); line-height: 1; }
.stat-unit { font-size: 11px; color: var(--text-gray); }

/* ============= TOOLBAR ============= */
.toolbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.toolbar-left {
  display: flex;
  gap: 10px;
  align-items: center;
  flex: 1;
  justify-content: flex-start;
}

/* ============= BUTTONS ============= */
.btn {
  padding: 9px 20px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-family: 'Cairo', inherit;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: var(--transition);
  white-space: nowrap;
  line-height: 1;
}
.btn:hover { opacity: 0.88; transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(0); }

.btn-primary  { background: var(--orange); color: white; }
.btn-danger   { background: var(--red); color: white; }
.btn-success  { background: var(--green); color: white; }
.btn-secondary { background: var(--card-alt); color: var(--text-med); border: 1px solid var(--border); }
.btn-outline  { background: transparent; border: 2px solid var(--orange); color: var(--orange); }
.btn-ghost    { background: transparent; color: var(--text-gray); }
.btn-sm       { padding: 6px 13px; font-size: 12px; }
.btn-icon     { padding: 8px; width: 34px; height: 34px; justify-content: center; border-radius: var(--radius-sm); }

/* ============= ENTITY CARDS ============= */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 16px;
}

.entity-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px 18px 20px;
  text-align: center;
  cursor: pointer;
  border: 2px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  user-select: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  position: relative;
  overflow: hidden;
}
.entity-card:hover {
  border-color: var(--orange);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}
.entity-card.selected {
  border-color: var(--orange);
  background: var(--orange-light);
  box-shadow: 0 0 0 3px rgba(180,154,111,0.15), var(--shadow);
}
.entity-card.selected::after {
  content: '✓';
  position: absolute;
  top: 10px;
  left: 12px;
  width: 22px;
  height: 22px;
  background: var(--orange);
  color: white;
  border-radius: 50%;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
}

.card-icon-wrap {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--card-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: var(--text-gray);
  transition: var(--transition);
}
.entity-card:hover .card-icon-wrap,
.entity-card.selected .card-icon-wrap {
  background: var(--orange-light);
  color: var(--orange);
}

.card-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1.3;
}

.card-meta {
  font-size: 11.5px;
  color: var(--text-gray);
}

.card-badge {
  font-size: 11px;
  padding: 2px 9px;
  border-radius: 20px;
  font-weight: 700;
}

/* ============= SECTION CARD ============= */
.section-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
}

.section-title-icon {
  width: 34px;
  height: 34px;
  background: var(--orange-light);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--orange);
  font-size: 15px;
}

/* ============= TABLE ============= */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table thead th {
  background: var(--card-alt);
  padding: 12px 14px;
  text-align: right;
  font-weight: 700;
  color: var(--text-med);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.data-table thead th:first-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.data-table thead th:last-child  { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.data-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: var(--card-alt); }
.data-table td { padding: 12px 14px; text-align: right; vertical-align: middle; }

/* ============= BADGES ============= */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}
.badge-expired { background: #fff5f5; color: #c53030; border: 1px solid #fed7d7; }
.badge-urgent  { background: #fffbeb; color: #c05621; border: 1px solid #fbd38d; }
.badge-warning { background: #fefce8; color: #92400e; border: 1px solid #fde68a; }
.badge-ok      { background: var(--green-light); color: #276749; border: 1px solid #c6f6d5; }
.badge-paid    { background: var(--green-light); color: #276749; border: 1px solid #c6f6d5; }
.badge-pending { background: #fffbeb; color: #c05621; border: 1px solid #fbd38d; }
.badge-late    { background: #fff5f5; color: #c53030; border: 1px solid #fed7d7; }
.badge-gray    { background: var(--card-alt); color: var(--text-gray); border: 1px solid var(--border); }
.badge-blue    { background: #ebf8ff; color: #2b6cb0; border: 1px solid #bee3f8; }
.badge-orange  { background: #fffbeb; color: #c05621; border: 1px solid #fbd38d; }
.badge-green   { background: var(--green-light); color: #276749; border: 1px solid #c6f6d5; }
.badge-red     { background: #fff5f5; color: #c53030; border: 1px solid #fed7d7; }

/* ============= TABS ============= */
.tabs-bar {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 5px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  justify-content: flex-end;
}
.tab-btn {
  padding: 9px 24px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-family: 'Cairo', inherit;
  font-weight: 700;
  background: transparent;
  color: var(--text-gray);
  transition: var(--transition);
}
.tab-btn:hover { color: var(--orange); background: var(--orange-light); }
.tab-btn.active { background: var(--orange); color: white; box-shadow: var(--shadow-sm); }

.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: none; } }

/* ============= FORM ============= */
.form-grid {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 16px;
}
.form-grid-2 { grid-template-columns: repeat(2,1fr); }
.form-grid-1 { grid-template-columns: 1fr; }

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 12px;
  color: var(--text-med);
  text-align: right;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 5px;
  justify-content: flex-end;
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 10px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  font-size: 13px;
  text-align: right;
  font-family: 'Cairo', inherit;
  color: var(--text-dark);
  direction: rtl;
  width: 100%;
  transition: var(--transition);
}
.form-group input:hover,
.form-group select:hover { border-color: #c5cdd6; }
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(180,154,111,0.12);
  background: white;
}

/* File input */
.file-group {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card-bg);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  transition: var(--transition);
}
.file-group:hover { border-color: var(--orange); }
.file-group input[type="file"] { display: none; }
.file-label {
  cursor: pointer;
  color: var(--orange);
  font-size: 16px;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--orange-light);
  border-radius: 6px;
  transition: var(--transition);
}
.file-label:hover { background: var(--orange); color: white; }
.file-display {
  font-size: 12px;
  color: var(--text-gray);
  flex: 1;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-view {
  color: var(--text-gray);
  font-size: 15px;
  text-decoration: none;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: var(--transition);
}
.file-view:hover { color: var(--orange); background: var(--orange-light); }
.file-view.hidden { display: none; }

.form-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

.form-section-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-med);
  text-align: right;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}
.form-section-label::before {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  justify-content: flex-start;
}

/* ============= MODAL ============= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  animation: fadeIn 0.15s ease;
}
.modal-overlay.hidden { display: none; }

.modal {
  background: white;
  border-radius: var(--radius-lg);
  padding: 0;
  width: 92%;
  max-width: 520px;
  direction: rtl;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.2s cubic-bezier(0.4,0,0.2,1);
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: 8px;
}
.modal-close {
  background: var(--card-alt);
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 30px;
  height: 30px;
  cursor: pointer;
  color: var(--text-gray);
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.modal-close:hover { background: var(--red-light); color: var(--red); border-color: #fed7d7; }

.modal-body { padding: 20px 22px; }
.modal-form { display: flex; flex-direction: column; gap: 14px; }
.modal-actions { display: flex; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--border); justify-content: flex-start; }

/* ============= CONFIRM ============= */
.confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1001;
  animation: fadeIn 0.15s ease;
}
.confirm-overlay.hidden { display: none; }

.confirm-box {
  background: white;
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  width: 380px;
  direction: rtl;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.2s cubic-bezier(0.4,0,0.2,1);
}
.confirm-icon { font-size: 48px; margin-bottom: 14px; }
.confirm-title { font-size: 17px; font-weight: 700; margin-bottom: 8px; color: var(--text-dark); }
.confirm-msg { font-size: 13px; color: var(--text-gray); margin-bottom: 24px; line-height: 1.6; }
.confirm-actions { display: flex; gap: 12px; justify-content: center; }

/* ============= LOGIN PAGE ============= */
.login-page { display: flex; min-height: 100vh; direction: rtl; }

.login-left {
  flex: 1;
  background: linear-gradient(145deg, #0f0d09 0%, #1c1710 45%, #0f0d09 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.login-deco-circle {
  position: absolute;
  border-radius: 50%;
  opacity: 0.07;
}
.login-deco-1 { width: 500px; height: 500px; background: #b49a6f; top: -150px; left: -150px; }
.login-deco-2 { width: 350px; height: 350px; background: #b49a6f; bottom: -100px; right: -50px; opacity: 0.04; }
.login-deco-3 { width: 200px; height: 200px; background: #b49a6f; bottom: 100px; left: 50px; opacity: 0.08; }

.login-brand {
  position: relative;
  z-index: 1;
  text-align: center;
  color: white;
}
.login-brand-logo {
  width: 90px;
  height: 90px;
  background: var(--orange);
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 44px;
  font-weight: 900;
  color: white;
  margin: 0 auto 20px;
  box-shadow: 0 8px 24px rgba(180,154,111,0.5);
}
.login-brand-logo-img { max-height: 110px; width: auto; margin: 0 auto 20px; display: block; filter: drop-shadow(0 6px 20px rgba(180,154,111,0.7)); }
.login-brand-name { font-size: 28px; font-weight: 900; margin-bottom: 6px; }
.login-brand-en   { font-size: 14px; opacity: 0.65; letter-spacing: 1px; }

.login-right {
  width: 420px;
  background: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 50px 44px;
}

.login-welcome { font-size: 22px; font-weight: 900; color: var(--text-dark); margin-bottom: 6px; }
.login-sub     { font-size: 13px; color: var(--text-gray); margin-bottom: 32px; }

.login-form { width: 100%; display: flex; flex-direction: column; gap: 14px; }

.login-input-wrap {
  position: relative;
}
.login-input-wrap i {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-gray);
  font-size: 15px;
}
.login-form input {
  width: 100%;
  padding: 13px 42px 13px 15px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  text-align: right;
  direction: rtl;
  font-family: 'Cairo', inherit;
  background: var(--card-alt);
  color: var(--text-dark);
  transition: var(--transition);
}
.login-form input:focus {
  outline: none;
  border-color: #b49a6f;
  background: white;
  box-shadow: 0 0 0 3px rgba(180,154,111,0.15);
}

.login-btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #b49a6f, #d4b87a);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  font-family: 'Cairo', inherit;
  transition: var(--transition);
  box-shadow: 0 4px 12px rgba(180,154,111,0.4);
}
.login-btn:hover { opacity: 0.92; transform: translateY(-1px); box-shadow: 0 6px 16px rgba(180,154,111,0.5); }
.login-btn:active { transform: translateY(0); }

.login-error {
  color: var(--red);
  font-size: 12.5px;
  text-align: center;
  min-height: 18px;
  background: var(--red-light);
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid #fed7d7;
  display: none;
}
.login-error.show { display: block; }

/* ============= TOAST ============= */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
  white-space: nowrap;
  box-shadow: var(--shadow-lg);
}
.toast.show { opacity: 1; }
.toast.success { background: var(--green); color: white; }
.toast.error   { background: var(--red); color: white; }
.toast.info    { background: var(--blue); color: white; }

/* ============= EMPTY STATE ============= */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-gray);
  grid-column: 1 / -1;
}
.empty-state-icon {
  width: 72px;
  height: 72px;
  background: var(--card-alt);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  color: var(--text-gray);
  margin: 0 auto 16px;
}
.empty-state p { font-size: 14px; color: var(--text-gray); margin-bottom: 16px; }

/* ============= ACCOUNTS PAGE ============= */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(4,1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.summary-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: var(--transition);
}
.summary-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }

.summary-card-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.summary-card-icon.orange { background: var(--orange-light); color: var(--orange); }
.summary-card-icon.green  { background: var(--green-light);  color: var(--green); }
.summary-card-icon.yellow { background: var(--yellow-light); color: var(--yellow); }
.summary-card-icon.red    { background: var(--red-light);    color: var(--red); }

.summary-card-info { flex: 1; text-align: right; }
.summary-card-label { font-size: 12px; color: var(--text-gray); font-weight: 600; }
.summary-card-value { font-size: 22px; font-weight: 900; color: var(--text-dark); line-height: 1.2; }
.summary-card-sub   { font-size: 11.5px; color: var(--text-gray); }

/* Filter bar */
.filter-bar {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.filter-bar select,
.filter-bar input {
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: 'Cairo', inherit;
  color: var(--text-dark);
  background: var(--card-bg);
  direction: rtl;
  min-width: 140px;
  transition: var(--transition);
}
.filter-bar select:focus,
.filter-bar input:focus { outline: none; border-color: var(--orange); }

/* ============= LOADING SKELETON ============= */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 6px;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ============= RESPONSIVE ============= */
@media (max-width: 1100px) {
  .stats-row.cols-6 { grid-template-columns: repeat(3,1fr); }
  .summary-cards    { grid-template-columns: repeat(2,1fr); }
}

@media (max-width: 900px) {
  :root { --sidebar-width: 68px; }
  .sidebar-header { padding: 16px 8px; }
  .sidebar-name, .sidebar-role { display: none; }
  .nav-list li a span, .nav-link span { display: none; }
  .nav-list li a, .nav-link { justify-content: center; padding: 12px; }
  .cards-grid { grid-template-columns: repeat(2,1fr); }
  .stats-row.cols-4, .stats-row.cols-6 { grid-template-columns: repeat(2,1fr); }
  .form-grid { grid-template-columns: repeat(2,1fr); }
  .summary-cards { grid-template-columns: repeat(2,1fr); }
}

@media (max-width: 600px) {
  .main { padding: 16px; }
  .cards-grid { grid-template-columns: 1fr 1fr; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .summary-cards { grid-template-columns: 1fr; }
  .login-left { display: none; }
  .login-right { width: 100%; padding: 30px 24px; }
}

/* ============= UTILITY ============= */
.hidden { display: none !important; }
.mt-16  { margin-top: 16px; }
.mt-20  { margin-top: 20px; }
.text-center { text-align: center; }
.text-orange { color: var(--orange); }
.text-green  { color: var(--green); }
.text-red    { color: var(--red); }
.fw-900 { font-weight: 900; }
.currency::after { content: ' ﷼'; font-size: 11px; opacity: 0.7; }

/* Back link */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-gray);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: var(--transition);
  margin-bottom: 4px;
}
.back-link:hover { color: var(--orange); }

/* ============= UI/UX IMPROVEMENTS ============= */

/* Better button active feedback */
.btn:active { transform: scale(0.97) !important; box-shadow: none !important; }

/* Zebra table rows */
.data-table tbody tr:nth-child(even) { background: rgba(0,0,0,0.015); }
[data-theme="dark"] .data-table tbody tr:nth-child(even) { background: rgba(255,255,255,0.025); }

/* Stat card gradient accent per type */
.stat-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }

/* Better empty state in table */
.data-table .empty-row td { padding: 48px 20px; }

/* Smooth page entrance */
.main { animation: pageFadeIn 0.25s ease; }
@keyframes pageFadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Card will-change for smooth hover */
.entity-card, .stat-card, .summary-card { will-change: transform; }

/* Better skeleton for dark mode */
[data-theme="dark"] .skeleton {
  background: linear-gradient(90deg, #1e2235 25%, #252840 50%, #1e2235 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}

/* Scrollbar for dark mode */
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #3a3f5c; }

/* Sidebar footer dark mode toggle button glow */
[data-theme="dark"] #darkModeToggle .nav-icon { color: #f6c05c; }

/* Better focus ring on all inputs globally */
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(180,154,111,0.2);
}

/* Table header sticky */
.data-table thead { position: sticky; top: 0; z-index: 2; }

/* Toolbar styled card */
.toolbar {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 12px 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}

/* Better section card shadow on hover */
.section-card:focus-within { box-shadow: var(--shadow); border-color: rgba(180,154,111,0.2); }

/* Badge animation on hover */
.badge { transition: var(--transition); }
.badge:hover { transform: scale(1.05); }

/* Tab pane enter animation improvement */
.tab-pane.active { animation: tabFadeIn 0.18s cubic-bezier(0.4,0,0.2,1); }
@keyframes tabFadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Tab active indicator line */
.tab-btn.active { position: relative; }

/* Better page header */
.page-header {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

/* Search/filter inputs */
.filter-bar input:focus, .filter-bar select:focus {
  box-shadow: 0 0 0 3px rgba(180,154,111,0.12);
}
