/* Jaghori House - Modern Green Theme */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Arabic:wght@400;500;600;700;800&display=swap');

:root {
  --gold: #16A34A;
  --gold-light: #16A34A;
  --gold-dark: #0F7A39;
  --gold-gradient: linear-gradient(135deg, #0F7A39 0%, #16A34A 48%, #22C55E 100%);
  --gold-shine: linear-gradient(135deg, #DCFCE7 0%, #22C55E 45%, #0F7A39 100%);
  --icon-bg: linear-gradient(135deg, #FFFCF3 0%, #F6EAD1 100%);
  --icon-border: #EADDBF;
  --icon-shadow: 0 10px 24px rgba(188,148,72,0.16);
  --white: #FFFFFF;
  --off-white: #FAFAF8;
  --light-bg: #F4F8F1;
  --card-bg: #FFFFFF;
  --text-dark: #1A1A1A;
  --text-medium: #4A4A4A;
  --text-light: #888888;
  --border: #DDE8D7;
  --shadow-sm: 0 2px 8px rgba(22,163,74,0.10);
  --shadow-md: 0 4px 20px rgba(22,163,74,0.16);
  --shadow-lg: 0 8px 40px rgba(22,163,74,0.18);
  --shadow-gold: 0 8px 24px rgba(22,163,74,0.28);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 24px;
  --font-fa: 'Noto Sans Arabic', Arial, Tahoma, sans-serif;
  --font-brand: 'Noto Sans Arabic', Arial, Tahoma, sans-serif;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-fa);
  background: var(--light-bg);
  color: var(--text-dark);
  direction: rtl;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Hide in-page translation widgets/extensions that inject DOM into the app. */
.goog-te-banner-frame,
.goog-te-balloon-frame,
#goog-gt-tt,
#goog-gt-vt,
.goog-tooltip,
.goog-tooltip:hover,
.goog-text-highlight,
.skiptranslate,
body > .skiptranslate {
  display: none !important;
  visibility: hidden !important;
}

html.translated-ltr,
html.translated-rtl,
body {
  top: 0 !important;
}

.notranslate {
  unicode-bidi: inherit;
}

/* ====== NAVBAR ====== */
.navbar {
  background: rgba(255,255,255,0.92);
  border-bottom: 1px solid rgba(22,163,74,0.16);
  padding: 0 20px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 10px 32px rgba(15,122,57,0.10);
  backdrop-filter: blur(14px);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  min-width: 0;
}

.navbar-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.navbar-logo {
  width: 40px;
  height: 40px;
  background: var(--icon-bg);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  box-shadow: var(--icon-shadow);
  border: 1px solid var(--icon-border);
  color: var(--gold-dark);
  position: relative;
  overflow: hidden;
}

.navbar-logo::after,
.sidebar-link .icon::after,
.nav-icon-btn::after {
  content: '';
  position: absolute;
  inset: 1px;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(255,255,255,0.35), transparent 48%);
  pointer-events: none;
}

.navbar-title {
  font-family: var(--font-brand);
  font-size: 1.08rem;
  font-weight: 900;
  color: var(--gold-dark);
  letter-spacing: 0;
  white-space: nowrap;
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-icon-btn {
  width: 38px;
  height: 38px;
  border: 1px solid var(--icon-border);
  background: var(--icon-bg);
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-medium);
  position: relative;
  text-decoration: none;
  box-shadow: var(--icon-shadow);
  overflow: hidden;
}

.nav-icon-btn:hover {
  background: linear-gradient(135deg, #FFF7E6 0%, #F1DFC1 100%);
  color: var(--gold-dark);
  box-shadow: 0 12px 28px rgba(188,148,72,0.20);
  transform: translateY(-1px);
}

.notification-link {
  overflow: visible !important;
  isolation: isolate;
}

.nav-user-menu {
  position: relative;
}

.nav-user-btn {
  width: auto;
  min-width: 42px;
  padding: 0 10px;
  gap: 7px;
  font-weight: 800;
}

.nav-user-name {
  max-width: 96px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.78rem;
  line-height: 1;
}

.nav-user-avatar,
.nav-user-fallback {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  flex-shrink: 0;
}

.nav-user-avatar {
  display: block;
  object-fit: cover;
  object-position: center top;
  background: #fff;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(234,221,191,0.9);
}

.nav-user-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.user-dropdown {
  display: none;
  position: absolute;
  top: 48px;
  left: 0;
  min-width: 172px;
  overflow: hidden;
  z-index: 1300;
  background: white;
  border: 1px solid rgba(22,163,74,0.14);
  border-radius: 14px;
  box-shadow: 0 18px 45px rgba(15,122,57,0.16);
}

.user-dropdown.show {
  display: block;
  animation: dropdownPop 0.16s ease both;
}

.user-dropdown-link {
  display: block;
  padding: 12px 16px;
  color: var(--text-dark);
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  transition: background 0.16s ease, color 0.16s ease;
}

.user-dropdown-link:hover {
  background: rgba(22,163,74,0.08);
  color: var(--gold-dark);
}

.user-dropdown-link.logout {
  border-bottom: 0;
  color: #E53E3E;
}

@keyframes dropdownPop {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.notification-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  background: #E53E3E;
  border: 2px solid white;
  border-radius: 999px;
  font-size: 9px;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  line-height: 1;
  direction: ltr;
  z-index: 4;
  box-shadow: 0 4px 12px rgba(229,62,62,0.32);
}

/* Install PWA button */
.install-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: linear-gradient(135deg, #0F7A39, #16A34A);
  color: white;
  border: none;
  border-radius: 13px;
  font-family: var(--font-fa);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(22,163,74,0.24), 0 3px 0 #0F7A39;
  transition: all 0.2s;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.install-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(22,163,74,0.28), 0 3px 0 #0F7A39;
}

.install-btn.is-hidden { display: none !important; }

.install-help-modal {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(0,0,0,0.45);
}

.install-help-modal.show { display: flex; }

.install-help-card {
  width: min(380px, 100%);
  background: white;
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: 0 24px 80px rgba(0,0,0,0.22);
  padding: 22px;
  position: relative;
  text-align: center;
}

.install-help-close {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: var(--light-bg);
  color: var(--text-medium);
  font-size: 22px;
  cursor: pointer;
}

.install-help-card h2 {
  font-size: 1.15rem;
  margin-bottom: 6px;
  color: var(--text-dark);
}

.install-help-icon {
  width: 54px;
  height: 54px;
  margin: 4px auto 12px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: var(--gold-gradient);
  color: white;
  font-size: 1.45rem;
  box-shadow: var(--shadow-gold);
}

.install-help-subtitle {
  color: var(--text-light);
  font-size: 0.8rem;
  line-height: 1.8;
  margin-bottom: 12px;
}

.install-help-steps {
  background: var(--light-bg);
  border-radius: 10px;
  padding: 10px;
  color: var(--text-medium);
  font-size: 0.84rem;
  margin-top: 10px;
  text-align: right;
}

.install-step {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 8px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.install-step:last-child {
  border-bottom: 0;
}

.install-step span {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: white;
  color: var(--gold-dark);
  font-weight: 900;
  direction: ltr;
}

.install-step strong,
.install-step small {
  display: block;
  line-height: 1.6;
}

.install-step small {
  color: var(--text-light);
  font-size: 0.72rem;
}

.install-help-done {
  margin-top: 14px;
}

/* Native notification permission prompt */
.notification-prompt-modal {
  position: fixed;
  inset: 0;
  z-index: 5200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(0,0,0,0.45);
}

.notification-prompt-modal.show {
  display: flex;
}

.notification-prompt-card {
  width: min(390px, 100%);
  background: white;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px;
  position: relative;
  text-align: center;
  box-shadow: 0 24px 80px rgba(0,0,0,0.24);
}

.notification-prompt-close {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  background: var(--light-bg);
  color: var(--text-dark);
  font-size: 22px;
  cursor: pointer;
}

.notification-prompt-icon {
  width: 58px;
  height: 58px;
  margin: 0 auto 12px;
  border-radius: 18px;
  background: linear-gradient(135deg, #F8F3E7, #FFFFFF);
  border: 1px solid var(--icon-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  box-shadow: var(--icon-shadow);
}

.notification-prompt-card h2 {
  font-family: var(--font-fa);
  font-size: 1.2rem;
  color: var(--text-dark);
  margin: 0 0 8px;
}

.notification-prompt-card p {
  margin: 0 0 18px;
  color: var(--text-medium);
  font-size: 0.9rem;
  line-height: 1.8;
}

.notification-later-btn {
  margin-top: 10px;
  background: white;
  color: var(--gold-dark);
  border: 2px solid var(--gold);
}

/* ====== SIDEBAR ====== */
.layout {
  display: flex;
  min-height: calc(100vh - 64px);
}

.sidebar {
  width: 240px;
  background: var(--white);
  border-left: 1px solid var(--border);
  padding: 20px 0;
  position: fixed;
  right: 0;
  top: 64px;
  height: calc(100vh - 64px);
  overflow-y: auto;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-section {
  padding: 8px 16px 4px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-light);
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 18px;
  text-decoration: none;
  color: var(--text-medium);
  font-size: 0.9rem;
  font-weight: 700;
  transition: all 0.2s;
  border-right: 4px solid transparent;
  margin: 3px 10px;
  border-radius: 14px;
}

.sidebar-link:hover, .sidebar-link.active {
  background: linear-gradient(to left, rgba(22,163,74,0.10), rgba(22,163,74,0.06));
  border-right-color: var(--gold);
  color: var(--gold-dark);
}

.sidebar-link .icon {
  width: 38px;
  height: 38px;
  border-radius: 13px;
  background: var(--icon-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: var(--icon-shadow);
  border: 1px solid var(--icon-border);
  color: var(--gold-dark);
}

.sidebar-link:hover .icon, .sidebar-link.active .icon {
  background: linear-gradient(135deg, #FFF7E6 0%, #F1DFC1 100%);
  color: var(--gold-dark);
  box-shadow: 0 12px 28px rgba(188,148,72,0.20);
  transform: translateY(-1px);
}

/* ====== MAIN CONTENT ====== */
.main-content {
  flex: 1;
  margin-right: 240px;
  padding: 24px 20px;
  min-height: calc(100vh - 64px);
}

/* ====== CARDS ====== */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.card-title {
  font-family: var(--font-fa);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-dark);
}

.card-body { padding: 20px 24px; }

/* ====== STAT CARDS ====== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: all 0.3s;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 4px;
  height: 100%;
  background: var(--gold-gradient);
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--icon-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-bottom: 12px;
  box-shadow: var(--icon-shadow);
  border: 1px solid var(--icon-border);
  color: var(--gold-dark);
}

.afn-icon {
  font-family: var(--font-fa);
  font-weight: 900;
  line-height: 1;
}

.sidebar-link .icon.afn-icon,
.stat-icon.afn-icon {
  font-size: 1.45rem;
}

.empty-money-icon.afn-icon {
  display: inline-flex;
  width: 54px;
  height: 54px;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  background: var(--icon-bg);
  color: var(--gold-dark);
  border: 1px solid var(--icon-border);
  box-shadow: var(--icon-shadow);
  font-size: 2rem;
}

.profile-main-avatar,
.sidebar-user-avatar {
  flex-shrink: 0;
  object-fit: cover;
  border: 1px solid var(--icon-border);
  box-shadow: var(--icon-shadow);
  background: var(--icon-bg);
}

.profile-main-avatar {
  width: 64px;
  height: 64px;
  border-radius: 18px;
}

.profile-main-avatar.fallback,
.sidebar-user-avatar.fallback {
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-main-avatar.fallback {
  font-size: 28px;
}

.profile-page-header {
  align-items: flex-start;
}

.profile-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.82fr);
  gap: 20px;
  align-items: start;
  width: 100%;
  max-width: 100%;
}

.profile-layout > * {
  min-width: 0;
}

.profile-summary {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  min-width: 0;
}

.profile-summary-info {
  min-width: 0;
}

.profile-summary-info h2 {
  font-family: var(--font-fa);
  font-size: 1.2rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.profile-username {
  color: var(--gold-dark);
  font-size: 0.85rem;
  direction: ltr;
  text-align: right;
  overflow-wrap: anywhere;
}

.profile-detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  table-layout: fixed;
}

.profile-detail-table td {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  overflow-wrap: anywhere;
}

.profile-detail-table tr:last-child td {
  border-bottom: 0;
}

.profile-detail-table td:first-child {
  width: 38%;
  color: var(--text-light);
}

.profile-detail-table td:last-child {
  font-weight: 700;
  color: var(--text-dark);
}

.sidebar-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 12px;
}

.sidebar-user-avatar.fallback {
  font-size: 16px;
}

.profile-photo-uploader {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--light-bg);
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease;
  min-width: 0;
}

.profile-photo-uploader:hover {
  border-color: var(--gold);
  background: rgba(22,163,74,0.06);
}

.profile-photo-uploader input[type="file"],
.profile-photo-uploader input[hidden] {
  display: none !important;
}

.profile-photo-preview-wrap {
  width: 86px;
  height: 86px;
  border-radius: 50%;
  background: white;
  border: 1px solid var(--icon-border);
  box-shadow: var(--icon-shadow);
  overflow: hidden;
  flex-shrink: 0;
}

.profile-photo-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-photo-preview.fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  background: var(--icon-bg);
}

.profile-photo-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--text-medium);
  font-size: 0.82rem;
  line-height: 1.7;
  min-width: 0;
}

.profile-photo-copy strong {
  color: var(--gold-dark);
  font-size: 0.92rem;
}

.profile-photo-copy span {
  overflow-wrap: anywhere;
}

.profile-photo-save {
  margin-top: 14px;
  white-space: normal;
  min-height: 46px;
}

.profile-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.profile-stat-item {
  background: var(--light-bg);
  border-radius: 12px;
  padding: 14px 10px;
  text-align: center;
  min-width: 0;
}

.profile-stat-item.warning {
  background: rgba(237,137,54,0.12);
}

.profile-stat-value {
  font-family: var(--font-fa);
  color: var(--text-dark);
  font-size: 1.3rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.profile-stat-value.green {
  color: var(--gold-dark);
}

.profile-stat-value.success {
  color: #276749;
}

.profile-stat-value.warning {
  color: #C05621;
}

.profile-stat-label {
  color: var(--text-light);
  font-size: 0.75rem;
  line-height: 1.6;
}

.stat-value {
  font-family: var(--font-fa);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 0.82rem;
  color: var(--text-light);
  font-weight: 500;
}

.stat-change {
  font-size: 0.75rem;
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.change-up { color: #38A169; }
.change-down { color: #E53E3E; }

/* ====== BUTTONS - 3D Style ====== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-fa);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  position: relative;
  white-space: nowrap;
  user-select: none;
}

.btn-gold {
  background: var(--gold-gradient);
  color: white;
  box-shadow: 0 4px 0 var(--gold-dark), 0 6px 15px rgba(22,163,74,0.28);
}

.btn-gold:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 var(--gold-dark), 0 8px 20px rgba(22,163,74,0.32);
}

.btn-gold:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 var(--gold-dark), 0 3px 10px rgba(22,163,74,0.20);
}

.btn-outline {
  background: white;
  color: var(--gold-dark);
  border: 2px solid var(--gold);
  box-shadow: 0 4px 0 var(--border), 0 4px 10px rgba(0,0,0,0.08);
}

.btn-outline:hover {
  background: rgba(22,163,74,0.06);
  transform: translateY(-2px);
  box-shadow: 0 6px 0 var(--border), 0 6px 15px rgba(0,0,0,0.1);
}

.btn-outline:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 var(--border);
}

.btn-danger {
  background: linear-gradient(135deg, #FC5454, #E53E3E);
  color: white;
  box-shadow: 0 4px 0 #C53030, 0 6px 15px rgba(229,62,62,0.3);
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 #C53030, 0 8px 20px rgba(229,62,62,0.4);
}

.btn-danger:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #C53030;
}

.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-full { width: 100%; }

/* ====== FORMS ====== */
.form-group { margin-bottom: 18px; }

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-medium);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 11px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-fa);
  font-size: 0.9rem;
  color: var(--text-dark);
  background: var(--white);
  transition: all 0.2s;
  outline: none;
  direction: rtl;
}

.form-control:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(22,163,74,0.12);
}

.form-control::placeholder { color: var(--text-light); }

textarea.form-control { min-height: 100px; resize: vertical; }

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

.numeric-input {
  direction: ltr;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.numeric-input:disabled,
.form-control:disabled {
  background: var(--light-bg);
  color: var(--text-light);
  cursor: not-allowed;
  opacity: 1;
}

.jalali-date-input {
  direction: ltr;
  text-align: center;
  font-variant-numeric: tabular-nums;
  padding-left: 82px;
  caret-color: transparent;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
}

.jalali-date-input[readonly] {
  background: white;
}

.date-hint {
  display: block;
  margin-top: 5px;
  color: var(--text-light);
  font-size: 0.72rem;
}

.jalali-date-wrap {
  position: relative;
  cursor: pointer;
  touch-action: manipulation;
}

.jalali-today-btn {
  position: absolute;
  left: 6px;
  top: 6px;
  height: calc(100% - 12px);
  border: 0;
  border-radius: 8px;
  padding: 0 10px;
  background: var(--light-bg);
  color: var(--gold-dark);
  font-family: var(--font-fa);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

.jalali-picker {
  position: absolute;
  z-index: 4000;
  width: 326px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 16px 45px rgba(0,0,0,0.16);
  padding: 14px;
  direction: rtl;
}

.jalali-picker-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.jalali-picker-caption {
  color: var(--text-medium);
  font-size: 0.82rem;
  font-weight: 800;
}

.jalali-picker-close {
  width: 32px;
  height: 32px;
  border: 1px solid var(--icon-border);
  border-radius: 9px;
  background: var(--icon-bg);
  color: var(--text-dark);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--icon-shadow);
}

.jalali-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.jalali-picker-title {
  font-weight: 800;
  color: var(--text-dark);
  font-size: 0.92rem;
  text-align: center;
  flex: 1;
}

.jalali-picker-nav,
.jalali-picker-today,
.jalali-picker-close-btn {
  border: 0;
  border-radius: 8px;
  background: var(--light-bg);
  color: var(--text-medium);
  font-family: var(--font-fa);
  font-weight: 700;
  cursor: pointer;
  height: 32px;
  padding: 0 10px;
}

.jalali-picker-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.jalali-picker-today,
.jalali-picker-close-btn {
  flex: 1;
}

.jalali-picker-today {
  background: rgba(22,163,74,0.12);
  color: var(--gold-dark);
}

.jalali-picker-close-btn {
  background: var(--icon-bg);
  color: var(--text-dark);
  border: 1px solid var(--icon-border);
}

.jalali-picker-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.jalali-weekday {
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  font-size: 0.72rem;
  font-weight: 800;
}

.jalali-empty {
  height: 34px;
}

.jalali-day {
  border: 0;
  border-radius: 8px;
  height: 34px;
  background: var(--light-bg);
  color: var(--text-dark);
  font-family: var(--font-fa);
  cursor: pointer;
  font-weight: 600;
}

.jalali-day:hover,
.jalali-day.selected {
  background: var(--gold-gradient);
  color: white;
}

.jalali-day.today {
  outline: 2px solid rgba(22,163,74,0.34);
}

.jalali-day.friday {
  color: #C53030;
}

.jalali-day.friday.selected {
  color: white;
}

/* ====== TABLE ====== */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

thead tr {
  background: linear-gradient(135deg, #F8F5EE, #FFF9F0);
  border-bottom: 2px solid var(--gold-light);
}

th {
  padding: 13px 16px;
  text-align: right;
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gold-dark);
  white-space: nowrap;
}

td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-medium);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }

tbody tr:hover { background: rgba(22,163,74,0.04); }

.report-bill-sheet {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
  overflow: hidden;
}

.report-bill-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(22,163,74,0.08), rgba(255,255,255,0.94));
}

.report-bill-kicker {
  color: var(--gold-dark);
  font-size: 0.76rem;
  font-weight: 900;
  margin-bottom: 6px;
}

.report-bill-header h2 {
  font-size: 1.32rem;
  font-weight: 900;
  line-height: 1.5;
}

.report-bill-header p {
  color: var(--text-light);
  font-size: 0.84rem;
  margin-top: 3px;
}

.report-bill-meta {
  min-width: 180px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 12px;
  align-content: center;
  background: white;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
}

.report-bill-meta span {
  color: var(--text-light);
  font-size: 0.76rem;
}

.report-bill-meta strong {
  color: var(--text-dark);
  font-size: 0.86rem;
  text-align: left;
}

.report-total-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
}

.report-total-item {
  padding: 18px 20px;
  border-left: 1px solid var(--border);
}

.report-total-item:last-child {
  border-left: 0;
}

.report-total-item span,
.report-total-item small {
  display: block;
  color: var(--text-light);
  font-size: 0.75rem;
  font-weight: 700;
}

.report-total-item strong {
  display: block;
  color: var(--text-dark);
  font-size: 1.28rem;
  font-weight: 900;
  line-height: 1.5;
  direction: ltr;
  text-align: right;
}

.report-total-item.primary strong {
  color: var(--gold-dark);
}

.report-total-item.danger strong {
  color: #C53030;
}

.report-detail-card {
  border-color: rgba(22,163,74,0.18);
}

.report-detail-card .card-header {
  background: white;
  padding: 12px 16px;
}

.report-detail-card .table-wrapper {
  border-radius: 0;
}

.report-clean-table {
  min-width: 860px;
  font-size: 0.76rem;
  border: 1px solid var(--border);
}

.report-clean-table thead tr {
  background: #EEF8EF;
  border-bottom: 1px solid #BFD8C1;
}

.report-clean-table th {
  color: var(--text-medium);
  font-size: 0.68rem;
  letter-spacing: 0;
  padding: 7px 8px;
  border-left: 1px solid #D4E5D2;
  border-bottom: 1px solid #BFD8C1;
  line-height: 1.35;
}

.report-clean-table td {
  padding: 6px 8px;
  vertical-align: top;
  border-left: 1px solid #E2EAE0;
  border-bottom: 1px solid #E2EAE0;
  line-height: 1.45;
}

.report-clean-table tbody tr:nth-child(even) {
  background: #FAFCF8;
}

.report-clean-table tbody tr:hover {
  background: #F0FDF4;
}

.report-main-text {
  color: var(--text-dark);
  font-weight: 700;
  line-height: 1.35;
}

.report-sub-text {
  color: var(--text-light);
  font-size: 0.65rem;
  line-height: 1.35;
}

.report-balance {
  color: var(--text-light);
  font-weight: 900;
  direction: ltr;
  text-align: right;
}

.report-balance.has-balance {
  color: #C53030;
}

.report-receipt-link {
  margin-top: 3px;
  min-height: 26px;
  padding: 4px 8px;
}

.report-empty-row {
  text-align: center;
  padding: 30px;
  color: var(--text-light);
}

.report-clean-table tfoot tr {
  background: #F0FDF4;
  color: var(--gold-dark);
  font-weight: 900;
}

.report-clean-table tfoot td {
  border-top: 2px solid rgba(22,163,74,0.28);
  padding: 8px;
}

.report-clean-table .badge {
  padding: 3px 7px;
  border-radius: 7px;
  font-size: 0.64rem;
}

.report-print-header {
  text-align: center;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 3px solid var(--gold);
}

.report-print-header h1 {
  font-family: var(--font-fa);
  font-size: 22px;
  color: var(--text-dark);
}

.report-print-header h2 {
  font-size: 16px;
  color: var(--text-medium);
  margin: 6px 0;
}

.report-print-header p {
  font-size: 12px;
  color: var(--text-light);
}

.report-print-project {
  color: var(--gold-dark) !important;
  font-weight: 900;
  margin-top: 4px;
}

.mobile-expense-list {
  display: none;
}

.mobile-expense-card {
  padding: 14px;
  border-bottom: 1px solid var(--border);
  background: white;
}

.mobile-expense-card:last-child {
  border-bottom: none;
}

.mobile-expense-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.mobile-expense-date {
  color: var(--text-light);
  font-size: 0.78rem;
  margin-bottom: 4px;
}

.mobile-expense-project {
  color: var(--text-dark);
  font-weight: 800;
  line-height: 1.5;
}

.mobile-expense-amount {
  color: var(--gold-dark);
  font-weight: 900;
  text-align: left;
  white-space: nowrap;
  font-size: 0.95rem;
}

.mobile-expense-amount small {
  display: block;
  font-size: 0.65rem;
  color: var(--text-light);
  margin-top: 2px;
}

.mobile-expense-desc {
  margin-top: 10px;
  color: var(--text-medium);
  font-size: 0.86rem;
  line-height: 1.8;
}

.mobile-expense-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.mobile-expense-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.mobile-expense-actions .btn {
  flex: 1 1 auto;
}

.mobile-empty-state {
  padding: 38px 18px;
  text-align: center;
  color: var(--text-light);
}

/* ====== BADGES ====== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.badge-gold { background: rgba(22,163,74,0.12); color: var(--gold-dark); }
.badge-green { background: rgba(56,161,105,0.12); color: #276749; }
.badge-red { background: rgba(229,62,62,0.12); color: #C53030; }
.badge-blue { background: rgba(66,153,225,0.12); color: #2B6CB0; }
.badge-gray { background: rgba(128,128,128,0.12); color: #4A5568; }

/* ====== LOGIN PAGE ====== */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #FAF7F0 0%, #F5EDD5 50%, #FFF9F0 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: fixed;
  top: -50%;
  right: -20%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(22,163,74,0.12) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.login-page::after {
  content: '';
  position: fixed;
  bottom: -30%;
  left: -10%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(22,163,74,0.10) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.login-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.12), 0 0 0 1px var(--border);
  position: relative;
  z-index: 1;
}

.login-logo {
  text-align: center;
  margin-bottom: 30px;
}

.login-logo-image {
  width: min(220px, 72vw);
  height: auto;
  display: block;
  margin: 0 auto 12px;
  object-fit: contain;
  filter: drop-shadow(0 12px 26px rgba(0,0,0,0.14));
}

.login-logo-icon {
  width: 70px;
  height: 70px;
  background: var(--icon-bg);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  margin: 0 auto 14px;
  box-shadow: var(--icon-shadow);
  border: 1px solid var(--icon-border);
  color: var(--gold-dark);
}

.login-logo h1 {
  font-family: var(--font-brand);
  font-size: 1.5rem;
  font-weight: 700;
  background: var(--gold-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-logo p {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-top: 4px;
}

/* ====== PAGE HEADER ====== */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-title {
  font-family: var(--font-fa);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-dark);
}

.page-subtitle {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-top: 4px;
}

/* ====== MODAL ====== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: white;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 80px rgba(0,0,0,0.2);
  transform: scale(0.95) translateY(20px);
  transition: transform 0.3s;
}

.modal-overlay.open .modal { transform: scale(1) translateY(0); }

.modal-header {
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: white;
  z-index: 1;
}

.modal-title {
  font-family: var(--font-fa);
  font-size: 1.15rem;
  font-weight: 600;
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--light-bg);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--text-medium);
  transition: all 0.2s;
}

.modal-close:hover { background: #FEE2E2; color: #E53E3E; }

.modal-body { padding: 22px 24px; }
.modal-footer {
  padding: 16px 24px 22px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  border-top: 1px solid var(--border);
}

.user-modal {
  max-width: 620px;
}

.user-modal-form {
  min-width: 0;
}

.user-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.password-hint {
  color: var(--text-light);
  font-weight: 400;
  font-size: 0.8rem;
}

.user-modal-warning {
  font-size: 0.82rem;
  line-height: 1.9;
}

/* ====== ALERT ====== */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 0.88rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

.alert-success { background: rgba(56,161,105,0.1); color: #276749; border: 1px solid rgba(56,161,105,0.2); }
.alert-error { background: rgba(229,62,62,0.1); color: #C53030; border: 1px solid rgba(229,62,62,0.2); }
.alert-warning { background: rgba(237,137,54,0.1); color: #C05621; border: 1px solid rgba(237,137,54,0.2); }

/* ====== IMAGE UPLOAD ====== */
.img-upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  background: var(--light-bg);
}

.img-upload-area:hover, .img-upload-area.dragover {
  border-color: var(--gold);
  background: rgba(22,163,74,0.06);
}

.img-upload-area input[type="file"] {
  display: none;
}

.img-upload-icon { font-size: 32px; margin-bottom: 8px; }
.img-upload-text { font-size: 0.85rem; color: var(--text-light); }
.img-upload-text strong { color: var(--gold-dark); }

.img-preview {
  max-width: 100%;
  max-height: 200px;
  border-radius: 8px;
  display: none;
  margin: 10px auto 0;
  object-fit: contain;
  box-shadow: var(--shadow-sm);
}

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

/* ====== RECEIPT GALLERY ====== */
.receipt-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.receipt-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.receipt-thumb-link {
  display: block;
  background: var(--light-bg);
  aspect-ratio: 4 / 3;
}

.receipt-thumb {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.receipt-card-body {
  padding: 14px;
}

.receipt-card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--text-dark);
  margin-bottom: 10px;
}

.receipt-meta {
  font-size: 0.78rem;
  color: var(--text-medium);
  line-height: 1.9;
}

.receipt-desc {
  min-height: 34px;
  margin-top: 8px;
  color: var(--text-light);
  font-size: 0.78rem;
  line-height: 1.7;
}

.receipt-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.receipt-actions form {
  margin: 0;
}

/* ====== AMOUNT DISPLAY ====== */
.amount-display {
  font-family: var(--font-fa);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gold-dark);
}

.expense-detail-layout {
  gap: 20px;
  margin-bottom: 20px;
}

.expense-detail-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.expense-detail-card,
.expense-detail-card * {
  min-width: 0;
}

.expense-detail-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.88rem;
}

.expense-detail-table td {
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  overflow-wrap: anywhere;
}

.expense-detail-table tr:last-child td {
  border-bottom: 0;
}

.expense-detail-table td:first-child {
  width: 34%;
  color: var(--text-light);
  font-weight: 700;
  padding-left: 10px;
}

.expense-detail-table td:last-child {
  color: var(--text-dark);
  font-weight: 700;
  text-align: right;
  overflow: hidden;
}

.expense-detail-table .badge {
  margin: 2px;
  max-width: 100%;
  white-space: normal;
  line-height: 1.6;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.expense-detail-amount {
  font-family: var(--font-fa);
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--gold-dark);
  overflow-wrap: anywhere;
}

.expense-description-box {
  margin-top: 16px;
  padding: 14px;
  background: var(--light-bg);
  border-radius: 10px;
}

.expense-description-box div {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--text-medium);
  margin-bottom: 6px;
}

.expense-description-box p {
  font-size: 0.88rem;
  line-height: 1.7;
  color: var(--text-dark);
  overflow-wrap: anywhere;
}

/* ====== PROJECT CARD ====== */
.project-card {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: all 0.3s;
  box-shadow: var(--shadow-sm);
}

.project-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.project-card-header {
  padding: 18px 20px 14px;
  background: linear-gradient(135deg, #FBF8F1, #FFF9F0);
  border-bottom: 1px solid var(--border);
}

.project-card-name {
  font-family: var(--font-fa);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 6px;
}

.project-card-body { padding: 16px 20px; }

.project-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.project-meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  color: var(--text-light);
}

/* ====== PROGRESS BAR ====== */
.progress-bar-wrap {
  background: var(--border);
  border-radius: 8px;
  height: 8px;
  overflow: hidden;
  margin: 8px 0;
}

.progress-bar-fill {
  height: 100%;
  background: var(--gold-gradient);
  border-radius: 8px;
  transition: width 0.6s ease;
}

/* ====== MOBILE MENU ====== */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
}

.menu-toggle {
  display: none;
  width: 40px;
  height: 40px;
  background: rgba(255,255,255,0.82);
  border: 1px solid rgba(22,163,74,0.12);
  border-radius: 13px;
  font-size: 21px;
  cursor: pointer;
  color: var(--gold-dark);
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 22px rgba(15,122,57,0.08);
}

/* ====== EXPENSE DETAIL ====== */
.expense-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.expense-item:last-child { border-bottom: none; }

.expense-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(22,163,74,0.12), rgba(22,163,74,0.06));
  border: 1px solid rgba(22,163,74,0.20);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.expense-info { flex: 1; }

.expense-desc {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-dark);
  margin-bottom: 4px;
  line-height: 1.4;
}

.expense-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.expense-date {
  font-size: 0.75rem;
  color: var(--text-light);
}

.expense-amount {
  font-family: var(--font-fa);
  font-size: 1rem;
  font-weight: 700;
  color: var(--gold-dark);
  text-align: left;
  white-space: nowrap;
}

/* ====== PDF BUTTON ====== */
.pdf-btn {
  background: linear-gradient(135deg, #E53E3E, #C53030);
  color: white;
  box-shadow: 0 4px 0 #9B2C2C, 0 6px 15px rgba(229,62,62,0.3);
}

.pdf-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 #9B2C2C, 0 8px 20px rgba(229,62,62,0.4);
}

/* ====== SEARCH ====== */
.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--light-bg);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  transition: all 0.2s;
}

.search-box:focus-within {
  border-color: var(--gold);
  background: white;
  box-shadow: 0 0 0 3px rgba(22,163,74,0.10);
}

.search-box input {
  border: none;
  background: none;
  font-family: var(--font-fa);
  font-size: 0.88rem;
  color: var(--text-dark);
  outline: none;
  flex: 1;
  direction: rtl;
}

.search-box .icon { color: var(--text-light); font-size: 16px; }

/* ====== AUDIT LOG ====== */
.audit-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.83rem;
}

.audit-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gold);
  margin-top: 5px;
  flex-shrink: 0;
}

/* ====== TOAST NOTIFICATIONS ====== */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: white;
  border-radius: 12px;
  padding: 12px 20px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  font-weight: 500;
  min-width: 250px;
  border-right: 4px solid var(--gold);
  animation: slideUp 0.3s ease, fadeOut 0.3s ease 2.7s forwards;
  pointer-events: all;
}

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

@keyframes fadeOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-10px); }
}

@keyframes mobileFadeUp {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes mobileSoftPop {
  0% { transform: scale(0.96); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes mobileIconFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}

@keyframes mobileGlowSweep {
  0% { transform: translateX(120%); opacity: 0; }
  35% { opacity: 0.55; }
  100% { transform: translateX(-120%); opacity: 0; }
}

/* ====== RESPONSIVE ====== */
@media (max-width: 768px) {
  html { font-size: 15px; }

  body {
    -webkit-text-size-adjust: 100%;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .navbar {
    height: 58px;
    padding: 0 12px;
    padding-top: env(safe-area-inset-top);
  }

  .navbar-actions { gap: 8px; }

  .navbar-logo {
    width: 36px;
    height: 36px;
    font-size: 18px;
  }

  .nav-icon-btn {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
  }

  .nav-user-btn {
    min-width: 40px;
    padding: 0 5px;
  }

  .nav-user-avatar,
  .nav-user-fallback {
    width: 32px;
    height: 32px;
  }

  .nav-user-name {
    max-width: 70px;
  }

  .user-dropdown {
    top: 44px;
    left: 0;
  }

  .install-btn {
    padding: 8px 10px;
    font-size: 0.74rem;
    max-width: 118px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .sidebar {
    transform: translateX(100%);
    top: 58px;
    right: 0;
    left: auto;
    width: min(84vw, 360px);
    max-width: calc(100vw - 56px);
    height: calc(100vh - 58px);
    border-left: 1px solid var(--border);
    border-radius: 0 0 0 18px;
    z-index: 1200;
    padding: 10px 0 calc(22px + env(safe-area-inset-bottom));
    box-shadow: -16px 0 45px rgba(0,0,0,0.16);
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    transition: transform 0.34s cubic-bezier(.2,.8,.2,1);
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  .sidebar-overlay {
    inset: 58px 0 0 0;
    z-index: 1100;
    background: rgba(0,0,0,0.28);
    backdrop-filter: blur(1px);
  }

  .sidebar-section {
    padding-top: 4px;
  }

  .sidebar-overlay.show { display: block; }

  body.menu-open {
    overflow: hidden;
  }

  .sidebar-link {
    padding: 13px 18px;
    font-size: 0.96rem;
    transition: transform 0.18s ease, background 0.22s ease, color 0.22s ease;
  }

  .sidebar.open .sidebar-link {
    animation: mobileFadeUp 0.34s ease both;
  }

  .sidebar.open .sidebar-link:nth-of-type(1) { animation-delay: 0.03s; }
  .sidebar.open .sidebar-link:nth-of-type(2) { animation-delay: 0.06s; }
  .sidebar.open .sidebar-link:nth-of-type(3) { animation-delay: 0.09s; }
  .sidebar.open .sidebar-link:nth-of-type(4) { animation-delay: 0.12s; }
  .sidebar.open .sidebar-link:nth-of-type(5) { animation-delay: 0.15s; }
  .sidebar.open .sidebar-link:nth-of-type(6) { animation-delay: 0.18s; }
  .sidebar.open .sidebar-link:nth-of-type(7) { animation-delay: 0.21s; }
  .sidebar.open .sidebar-link:nth-of-type(8) { animation-delay: 0.24s; }

  .sidebar-link:active {
    transform: scale(0.98);
  }

  .sidebar-link .icon {
    width: 38px;
    height: 38px;
  }

  .sidebar-link.active .icon {
    animation: mobileIconFloat 2.4s ease-in-out infinite;
  }

  .sidebar > div[style*="position:absolute"][style*="bottom:20px"] {
    position: static !important;
    padding: 18px !important;
    margin-top: 20px;
  }
  
  .main-content {
    margin-right: 0;
    padding: 14px;
    min-height: calc(100vh - 58px);
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    animation: mobileFadeUp 0.26s ease both;
  }
  
  .menu-toggle {
    display: flex;
    transition: transform 0.18s ease, background 0.18s ease;
  }

  .menu-toggle:active {
    transform: scale(0.92);
    background: rgba(22,163,74,0.08);
  }

  .nav-icon-btn,
  .install-btn,
  .navbar-logo {
    transition: transform 0.18s ease, box-shadow 0.18s ease;
  }

  .nav-icon-btn:active,
  .install-btn:active,
  .navbar-logo:active {
    transform: scale(0.94);
  }
  
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  
  .grid-2, .grid-3 { grid-template-columns: 1fr; }

  .profile-layout {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .main-content > div[style*="grid-template-columns"],
  .card-body form[style*="grid-template-columns"],
  div[style*="grid-template-columns:repeat(auto-fill"],
  div[style*="grid-template-columns:repeat(auto-fit"] {
    grid-template-columns: 1fr !important;
  }
  
  .page-header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 16px;
  }

  .expense-detail-header {
    gap: 12px;
  }

  .expense-detail-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .expense-detail-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .expense-detail-layout {
    gap: 16px;
  }

  .expense-detail-card .card-body {
    padding: 14px 16px;
  }

  .expense-detail-table {
    font-size: 0.82rem;
    display: block;
  }

  .expense-detail-table tbody,
  .expense-detail-table tr {
    display: block;
    width: 100%;
  }

  .expense-detail-table tr {
    display: grid;
    grid-template-columns: minmax(92px, 38%) minmax(0, 1fr);
    align-items: start;
    border-bottom: 1px solid var(--border);
    gap: 8px;
  }

  .expense-detail-table tr:last-child {
    border-bottom: 0;
  }

  .expense-detail-table td {
    display: block;
    padding: 10px 0;
    border-bottom: 0;
  }

  .expense-detail-table td:first-child {
    width: auto;
    padding-left: 8px;
  }

  .expense-detail-table td:last-child {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center;
    justify-content: flex-start;
  }

  .expense-detail-amount {
    font-size: 1rem;
  }

  .profile-page-header {
    margin-bottom: 16px;
  }

  .page-title {
    font-size: 1.22rem;
    line-height: 1.45;
  }

  .page-subtitle { font-size: 0.78rem; }
  
  .modal {
    margin: 0;
    border-radius: var(--radius);
    max-height: calc(100vh - 28px);
  }

  .user-modal-overlay {
    align-items: flex-start;
    justify-content: center;
    padding: 6px;
    padding-top: max(6px, env(safe-area-inset-top));
    padding-bottom: max(6px, env(safe-area-inset-bottom));
  }

  .user-modal {
    width: min(100%, 580px);
    max-height: calc(100dvh - 12px);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .user-modal-form {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
  }

  .user-modal .modal-header {
    padding: 12px 14px;
    flex-shrink: 0;
  }

  .user-modal .modal-title {
    font-size: 1.02rem;
  }

  .user-modal .modal-close {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
  }

  .user-modal-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 12px clamp(12px, 3vw, 18px);
  }

  .user-form-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .user-modal .form-group {
    margin-bottom: 11px;
  }

  .user-modal .form-label {
    font-size: 0.8rem;
    margin-bottom: 5px;
  }

  .user-modal .form-control {
    min-height: 44px;
    padding: 9px 12px;
    border-width: 2px;
    border-radius: 11px;
  }

  .user-modal-warning {
    margin-bottom: 0;
    padding: 10px 12px;
    font-size: 0.78rem;
    line-height: 1.85;
  }

  .user-modal-footer {
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
    gap: 10px;
    flex-shrink: 0;
  }
  
  .card-header { padding: 16px; }
  .card-body { padding: 16px; }

  .profile-photo-uploader {
    padding: 14px;
    align-items: flex-start;
  }

  .card,
  .project-card,
  .stat-card,
  .receipt-card,
  .mobile-expense-card {
    animation: mobileSoftPop 0.32s ease both;
  }

  .card:nth-of-type(2),
  .project-card:nth-of-type(2),
  .stat-card:nth-of-type(2),
  .receipt-card:nth-of-type(2),
  .mobile-expense-card:nth-of-type(2) {
    animation-delay: 0.04s;
  }

  .card:nth-of-type(3),
  .project-card:nth-of-type(3),
  .stat-card:nth-of-type(3),
  .receipt-card:nth-of-type(3),
  .mobile-expense-card:nth-of-type(3) {
    animation-delay: 0.08s;
  }

  .btn-gold,
  .install-btn {
    overflow: hidden;
  }

  .btn-gold::after,
  .install-btn::after {
    content: '';
    position: absolute;
    right: 0;
    top: -40%;
    bottom: -40%;
    width: 38px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.42), transparent);
    transform: translateX(120%);
    animation: mobileGlowSweep 3.4s ease-in-out infinite;
    pointer-events: none;
  }

  .navbar-title { display: none; }
  
  .stat-value { font-size: 1.3rem; }
  
  .table-wrapper {
    margin: 0 -1px;
    border-radius: 0 0 var(--radius) var(--radius);
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table {
    min-width: 720px;
  }

  .report-bill-header {
    flex-direction: column;
    padding: 16px;
    gap: 12px;
  }

  .report-bill-header h2 {
    font-size: 1.1rem;
  }

  .report-bill-meta {
    min-width: 0;
    width: 100%;
  }

  .report-total-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .report-total-item {
    padding: 14px;
    border-bottom: 1px solid var(--border);
  }

  .report-total-item:nth-child(2n) {
    border-left: 0;
  }

  .report-total-item:nth-last-child(-n+2) {
    border-bottom: 0;
  }

  .report-total-item strong {
    font-size: 1.05rem;
  }

  th, td {
    padding: 10px 12px;
    font-size: 0.8rem;
  }
  
  .btn-lg { padding: 12px 20px; }

  .btn {
    min-height: 40px;
    white-space: normal;
    line-height: 1.4;
  }

  .btn-sm {
    min-height: 34px;
    padding: 7px 11px;
  }

  .form-control {
    min-height: 44px;
    font-size: 16px;
  }

  .search-box {
    width: 100% !important;
  }

  img,
  video,
  canvas {
    max-width: 100%;
    height: auto;
  }

  .page-header > div[style*="display:flex"],
  .card-header > div[style*="display:flex"],
  div[style*="display:flex;gap"] {
    max-width: 100%;
  }

  .project-card,
  .stat-card,
  .card {
    border-radius: 12px;
  }

  .profile-photo-uploader {
    align-items: flex-start;
  }

  .project-card:hover,
  .stat-card:hover {
    transform: none;
  }

  .expense-item {
    gap: 10px;
  }

  .expense-amount {
    font-size: 0.88rem;
    white-space: normal;
    max-width: 90px;
  }

  .jalali-picker {
    position: fixed;
    left: 12px !important;
    right: 12px;
    top: auto !important;
    bottom: calc(12px + env(safe-area-inset-bottom));
    width: auto;
    max-height: 82vh;
    overflow-y: auto;
  }

  .toast-container {
    left: 12px;
    right: 12px;
    bottom: calc(14px + env(safe-area-inset-bottom));
    transform: none;
  }

  .toast {
    min-width: 0;
    width: 100%;
  }

  #expensesTable {
    display: none;
  }

  .mobile-card-list-table .table-wrapper,
  .expenses-list-card .table-wrapper,
  .card:has(#expensesTable) .table-wrapper {
    display: none;
  }

  .mobile-expense-list {
    display: block;
  }

  .report-detail-card .table-wrapper {
    display: block;
  }

  .report-detail-card .mobile-expense-list {
    display: none;
  }

  .report-clean-table {
    min-width: 760px;
  }
}

@media (max-width: 420px) {
  .stats-grid { grid-template-columns: 1fr; }
  .login-page { padding: 12px; align-items: flex-start; }
  .login-card {
    padding: 28px 20px;
    border-radius: 18px;
    margin-top: 20px;
  }

  .login-logo-icon {
    width: 58px;
    height: 58px;
    font-size: 26px;
  }

  .login-logo-image {
    width: min(190px, 78vw);
  }

  .login-logo h1 { font-size: 1.28rem; }

  .install-btn {
    max-width: 102px;
    padding: 8px;
  }

  .nav-icon-btn span:not(.notification-badge) {
    display: none;
  }

  .nav-user-btn {
    width: 42px;
    padding: 0;
  }

  .nav-user-avatar,
  .nav-user-fallback {
    width: 34px;
    height: 34px;
  }

  .modal-overlay {
    padding: 10px;
  }

  .modal-header,
  .modal-body,
  .modal-footer {
    padding-left: 14px;
    padding-right: 14px;
  }

  .modal-footer {
    flex-direction: column;
  }

  .modal-footer .btn {
    width: 100%;
  }

  .user-modal-overlay {
    padding: 4px;
    padding-top: max(4px, env(safe-area-inset-top));
    padding-bottom: max(4px, env(safe-area-inset-bottom));
  }

  .user-modal {
    width: calc(100vw - 8px);
    max-height: calc(100dvh - 8px);
    border-radius: 14px;
  }

  .user-modal .modal-header {
    padding: 11px 12px;
  }

  .user-modal-body {
    padding: 10px 12px;
  }

  .user-modal .form-group {
    margin-bottom: 10px;
  }

  .user-modal .form-label {
    font-size: 0.78rem;
  }

  .user-modal-warning {
    padding: 9px 11px;
    font-size: 0.74rem;
  }

  .user-modal-footer {
    flex-direction: row;
    padding: 9px 12px calc(9px + env(safe-area-inset-bottom));
  }

  .user-modal-footer .btn {
    flex: 1;
    min-width: 0;
    width: auto;
    padding-left: 10px;
    padding-right: 10px;
  }

  .profile-photo-uploader {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .profile-summary {
    align-items: flex-start;
    gap: 12px;
  }

  .profile-main-avatar {
    width: 56px;
    height: 56px;
    border-radius: 16px;
  }

  .profile-summary-info h2 {
    font-size: 1.05rem;
  }

  .profile-detail-table {
    font-size: 0.82rem;
  }

  .profile-detail-table td:first-child {
    width: 34%;
  }

  .expense-detail-actions {
    grid-template-columns: 1fr;
  }

  .expense-detail-card .card-header {
    padding: 14px;
  }

  .expense-detail-card .card-body {
    padding: 12px 14px;
  }

  .expense-detail-table {
    font-size: 0.78rem;
  }

  .expense-detail-table tr {
    grid-template-columns: minmax(86px, 36%) minmax(0, 1fr);
    gap: 6px;
  }

  .expense-detail-table td:first-child {
    width: auto;
  }

  .expense-description-box {
    padding: 12px;
  }

  .profile-stats-grid {
    grid-template-columns: 1fr;
  }

  .profile-stat-item {
    padding: 16px 10px;
  }
}

@media (max-width: 360px), (max-height: 700px) and (max-width: 768px) {
  .user-modal .modal-header {
    padding-top: 9px;
    padding-bottom: 9px;
  }

  .user-modal-body {
    padding-top: 9px;
    padding-bottom: 9px;
  }

  .user-modal .form-control {
    min-height: 42px;
  }

  .user-modal-warning {
    line-height: 1.75;
  }

  .user-modal-footer {
    padding-top: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}

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

/* ====== SELECT2 STYLE ====== */
select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23888' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 14px center;
  padding-left: 36px;
}

/* ====== PRINT STYLES ====== */
@media print {
  .sidebar, .navbar, .btn, .no-print { display: none !important; }
  .main-content { margin: 0; padding: 0; }
  body { background: white; }
}
