/* ============ Layout shells ============ */
.app-shell { min-height: 100vh; display: flex; }

.glass {
  background: var(--surface-glass);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid var(--border);
}

.sidebar {
  width: 264px;
  flex-shrink: 0;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-left: 1px solid var(--border);
  background: var(--bg-elevated);
}

.main-area { flex: 1; min-width: 0; padding: 28px 36px 60px; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 28px; gap: 16px; flex-wrap: wrap;
}

/* ============ Brand ============ */
.brand { display: flex; align-items: center; gap: 12px; padding: 8px 10px 22px; }
.brand img { width: 38px; height: 38px; border-radius: 10px; object-fit: contain; }
.brand-name { font-weight: 700; font-size: 14.5px; line-height: 1.35; }
.brand-sub { font-size: 11.5px; color: var(--text-muted); }

/* ============ Nav ============ */
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: var(--radius-sm);
  color: var(--text-secondary); font-size: 14px; font-weight: 500;
  cursor: pointer; transition: background 0.2s var(--ease-out), color 0.2s var(--ease-out);
}
.nav-item:hover { background: var(--accent-soft); color: var(--text-primary); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-strong); font-weight: 700; }

/* ============ Cards ============ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.25s var(--ease-out), transform 0.25s var(--ease-out);
}
.card:hover { box-shadow: var(--shadow-md); }

.stat-card {
  padding: 20px 22px;
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
}
.stat-card .stat-label { font-size: 12.5px; color: var(--text-secondary); font-weight: 600; margin-bottom: 10px; }
.stat-card .stat-value { font-size: 25px; font-weight: 800; letter-spacing: -0.02em; }
.stat-card .stat-icon {
  position: absolute; top: 16px; left: 16px; width: 34px; height: 34px;
  border-radius: 10px; display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent-strong);
}

/* ============ Buttons ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-body); font-size: 14px; font-weight: 600;
  padding: 10px 18px; border-radius: var(--radius-full); border: 1px solid transparent;
  cursor: pointer; transition: transform 0.15s var(--ease-out), box-shadow 0.2s var(--ease-out), background 0.2s var(--ease-out);
  user-select: none;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: linear-gradient(180deg, var(--color-turquoise-500), var(--color-turquoise-600));
  color: #fff; box-shadow: 0 6px 18px rgba(15, 139, 141, 0.32);
}
.btn-primary:hover { box-shadow: 0 8px 22px rgba(15, 139, 141, 0.42); }
.btn-secondary { background: var(--surface); border-color: var(--border-strong); color: var(--text-primary); }
.btn-secondary:hover { background: var(--accent-soft); }
.btn-danger { background: rgba(216, 72, 63, 0.1); color: var(--color-danger); }
.btn-danger:hover { background: rgba(216, 72, 63, 0.18); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--border); color: var(--text-primary); }
.btn-icon { width: 38px; height: 38px; padding: 0; border-radius: var(--radius-full); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.fab {
  position: fixed; bottom: 32px; left: 32px; z-index: 40;
  width: 58px; height: 58px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, var(--color-turquoise-500), var(--color-turquoise-700));
  color: #fff; box-shadow: 0 12px 30px rgba(15, 139, 141, 0.4);
  border: none; cursor: pointer; transition: transform 0.25s var(--ease-spring);
}
.fab:hover { transform: translateY(-3px) scale(1.04); }

/* ============ Inputs ============ */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--text-secondary); }
.input, .select-trigger {
  width: 100%; padding: 11px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--bg-elevated);
  color: var(--text-primary); font-family: var(--font-body); font-size: 14px;
  transition: border-color 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out);
}
.input:focus, .select-trigger:focus {
  border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); outline: none;
}
.input-amount-wrap { position: relative; }
.input-amount-wrap .rial-suffix {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  font-size: 12.5px; color: var(--text-muted); pointer-events: none;
}
.input-amount-wrap input { padding-left: 46px; text-align: left; direction: ltr; }

/* ============ Custom searchable dropdown (no <select>) ============ */
.combo { position: relative; }
.combo-list {
  position: absolute; top: calc(100% + 8px); right: 0; left: 0; z-index: 50;
  max-height: 320px; overflow-y: auto; padding: 6px;
  border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
  background: var(--surface-glass); backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--border); opacity: 0; transform: translateY(-6px) scale(0.98);
  pointer-events: none; transition: all 0.18s var(--ease-out);
}
.combo-list.open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.combo-option {
  padding: 10px 12px; border-radius: 10px; cursor: pointer; font-size: 14px;
  display: flex; justify-content: space-between; align-items: center;
  transition: background 0.15s;
}
.combo-option:hover, .combo-option.active { background: var(--accent-soft); }
.combo-empty { padding: 18px; text-align: center; color: var(--text-muted); font-size: 13px; }

/* ============ Modal ============ */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(9, 16, 15, 0.45);
  backdrop-filter: blur(4px); z-index: 100; display: flex;
  align-items: center; justify-content: center; padding: 20px;
  opacity: 0; pointer-events: none; transition: opacity 0.25s var(--ease-out);
}
.modal-backdrop.open { opacity: 1; pointer-events: auto; }
.modal {
  width: 100%; max-width: 480px; background: var(--surface);
  border-radius: var(--radius-lg); border: 1px solid var(--border);
  box-shadow: var(--shadow-lg); padding: 26px; transform: translateY(16px) scale(0.97);
  opacity: 0; transition: all 0.3s var(--ease-spring); max-height: 88vh; overflow-y: auto;
}
.modal-backdrop.open .modal { transform: translateY(0) scale(1); opacity: 1; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-title { font-size: 17px; font-weight: 800; }

/* ============ Toasts ============ */
.toast-stack {
  position: fixed; top: 22px; left: 50%; transform: translateX(-50%);
  z-index: 200; display: flex; flex-direction: column; gap: 10px; width: min(92vw, 380px);
}
.toast {
  padding: 13px 16px; border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
  background: var(--surface); border: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px; font-size: 13.5px; font-weight: 600;
  animation: toast-in 0.35s var(--ease-spring);
}
.toast.success { border-color: rgba(31,157,99,0.3); color: var(--color-success); }
.toast.error { border-color: rgba(216,72,63,0.3); color: var(--color-danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-14px) scale(0.96); } to { opacity: 1; transform: translateY(0) scale(1); } }

/* ============ Table ============ */
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.data-table thead th {
  text-align: right; padding: 12px 14px; font-size: 12px; font-weight: 700;
  color: var(--text-secondary); border-bottom: 1px solid var(--border); cursor: pointer;
  white-space: nowrap; user-select: none;
}
.data-table thead th:hover { color: var(--text-primary); }
.data-table tbody td { padding: 13px 14px; border-bottom: 1px solid var(--border); }
.data-table tbody tr { transition: background 0.15s; }
.data-table tbody tr:hover { background: var(--accent-soft); }
.data-table tbody tr:last-child td { border-bottom: none; }

.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px;
  border-radius: var(--radius-full); font-size: 11.5px; font-weight: 700;
}
.badge-main { background: var(--accent-soft); color: var(--accent-strong); }
.badge-misc { background: rgba(185, 141, 75, 0.15); color: var(--color-brass-600); }

/* ============ Skeletons ============ */
.skeleton {
  background: linear-gradient(100deg, var(--border) 30%, var(--border-strong) 50%, var(--border) 70%);
  background-size: 200% 100%; animation: shimmer 1.4s infinite;
  border-radius: 10px;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ============ Misc ============ */
.divider { height: 1px; background: var(--border); border: none; margin: 0; }
.chip { padding: 4px 10px; border-radius: var(--radius-full); background: var(--border); font-size: 12px; font-weight: 600; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.pagination { display: flex; align-items: center; gap: 8px; justify-content: center; padding: 18px 0; }
.page-btn {
  min-width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); font-size: 13px; cursor: pointer; font-weight: 600;
}
.page-btn.active { background: var(--accent); color: #fff; border-color: transparent; }

@media (max-width: 900px) {
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 60; transform: translateX(100%); transition: transform 0.3s var(--ease-out); }
  .sidebar.open { transform: translateX(0); }
  .main-area { padding: 20px 16px 60px; }
}
