/* ============================================================
   سامانه مدیریت ضمانت و مدارک وام پرسنلی
   استایل اصلی - RTL + Dark Mode + انیمیشن
   ============================================================ */

/* Font: Vazirmatn */
@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazirmatn-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazirmatn-Medium.ttf') format('truetype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazirmatn-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ============================================
   CSS Variables - Light (default)
   ============================================ */
:root {
  --primary: #1A73E8;
  --primary-dark: #1557B0;
  --primary-light: #E8F0FE;
  --success: #0F9D58;
  --success-light: #E6F4EA;
  --danger: #DB4437;
  --danger-light: #FCE8E6;
  --warning: #F4B400;
  --warning-light: #FEF7E0;
  --info: #4285F4;
  --info-light: #E8F0FE;

  --bg: #F5F7FA;
  --bg-secondary: #FFFFFF;
  --card: #FFFFFF;
  --card-hover: #F8F9FA;
  --text: #202124;
  --text-secondary: #5F6368;
  --text-muted: #9AA0A6;
  --border: #E0E0E0;
  --border-light: #F0F0F0;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-hover: 0 4px 20px rgba(0,0,0,0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --nav-height: 64px;
  --bottom-nav-height: 60px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Mode */
[data-theme="dark"] {
  --primary: #8AB4F8;
  --primary-dark: #669DF6;
  --primary-light: #1E3A5F;
  --success: #81C995;
  --success-light: #1E3520;
  --danger: #F28B82;
  --danger-light: #3C1F1E;
  --warning: #FDD663;
  --warning-light: #3A3010;
  --info: #8AB4F8;

  --bg: #1C1C1C;
  --bg-secondary: #242424;
  --card: #242424;
  --card-hover: #2E2E2E;
  --text: #E8E8E8;
  --text-secondary: #B0B0B0;
  --text-muted: #888888;
  --border: #3A3A3A;
  --border-light: #2E2E2E;
  --shadow: 0 2px 12px rgba(0,0,0,0.3);
  --shadow-hover: 0 4px 20px rgba(0,0,0,0.4);
}

/* ============================================
   Reset & Base
   ============================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
  overflow-y: scroll;
}

body {
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  direction: rtl;
  text-align: right;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background var(--transition), color var(--transition);
  padding-bottom: calc(var(--bottom-nav-height) + 20px);
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover { color: var(--primary-dark); }

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

/* ============================================
   Page Container (محدود کردن عرض در دسکتاپ)
   ============================================ */
.user-page {
  position: relative;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  padding-bottom: calc(var(--bottom-nav-height) + 20px);
}
.user-page .top-bar + * {
  padding-top: 20px !important;
}
@media (min-width: 992px) {
  .user-page {
    max-width: 720px;
    margin: 0 auto;
    box-shadow: 0 0 30px rgba(0,0,0,0.06);
    min-height: 100vh;
    position: relative;
  }
  .user-page .bottom-nav {
    left: 50% !important;
    right: auto !important;
    width: 720px;
    transform: translateX(-50%) !important;
  }
  .admin-body {
    max-width: 960px !important;
  }
}

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

/* ============================================
   Typography
   ============================================ */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.4;
  color: var(--text);
}

/* ============================================
   Utility Classes
   ============================================ */
.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 16px;
}

.page-title {
  font-size: 1.25rem;
  font-weight: 700;
  padding: 16px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-title svg {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-secondary); }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.p-1 { padding: 8px; }
.p-2 { padding: 16px; }
.p-3 { padding: 24px; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.flex-wrap { flex-wrap: wrap; }

/* ============================================
   Header / Top Bar
   ============================================ */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--nav-height);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.top-bar-title {
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

/* ============================================
   Cards
   ============================================ */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 12px;
  transition: all var(--transition);
  border: 1px solid var(--border-light);
  position: relative;
  overflow: hidden;
}

.card:hover {
  box-shadow: var(--shadow-hover);
}

.card:active {
  transform: scale(0.99);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
}

.card-body {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.card-footer {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Stat Cards */
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 0 16px;
  margin-bottom: 16px;
}

.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  text-align: center;
  border: 1px solid var(--border-light);
  transition: all var(--transition);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.stat-card:active {
  transform: scale(0.96);
}

.stat-card .stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 8px;
  font-size: 1.25rem;
}

.stat-card .stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  direction: ltr;
}

.stat-card .stat-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.stat-card .stat-icon.blue { background: var(--primary-light); color: var(--primary); }
.stat-card .stat-icon.green { background: var(--success-light); color: var(--success); }
.stat-card .stat-icon.red { background: var(--danger-light); color: var(--danger); }
.stat-card .stat-icon.yellow { background: var(--warning-light); color: var(--warning); }

/* ============================================
   Buttons
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
  user-select: none;
  -webkit-user-select: none;
  text-decoration: none;
}

.btn:active {
  transform: scale(0.96);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); }

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-warning {
  background: var(--warning);
  color: #fff;
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text);
}
.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.75rem;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 1rem;
}

.btn-block {
  width: 100%;
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all var(--transition);
}
.btn-icon:hover {
  background: var(--card-hover);
  color: var(--text);
}

/* Ripple Effect */
.ripple {
  position: relative;
  overflow: hidden;
}

.ripple::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
  width: 100px;
  height: 100px;
  transform: scale(0);
  animation: rippleAnim 0.6s ease-out;
  pointer-events: none;
}

@keyframes rippleAnim {
  to { transform: scale(4); opacity: 0; }
}

/* ============================================
   Forms
   ============================================ */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--text);
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  font-size: 0.875rem;
  transition: all var(--transition);
  outline: none;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.form-input::placeholder {
  color: var(--text-muted);
}

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

.form-error {
  color: var(--danger);
  font-size: 0.75rem;
  margin-top: 4px;
}

/* Search Input */
.search-box {
  position: relative;
}

.search-box .form-input {
  padding-right: 40px;
}

.search-box .search-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

/* OTP Input */
.otp-container {
  display: flex;
  gap: 8px;
  justify-content: center;
  direction: ltr;
}

.otp-input {
  width: 48px;
  height: 56px;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--text);
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  outline: none;
  transition: all var(--transition);
}

.otp-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* ============================================
   Bottom Navigation
   ============================================ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;
  background: var(--card);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  height: var(--bottom-nav-height);
  padding: 4px 0;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 4px 12px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.625rem;
  transition: all var(--transition);
  position: relative;
  border: none;
  background: none;
  cursor: pointer;
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  min-width: 56px;
}

.nav-item svg {
  width: 24px;
  height: 24px;
  transition: all var(--transition);
}

.nav-item.active {
  color: var(--primary);
}

.nav-item.active svg {
  color: var(--primary);
}

.nav-item .badge {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  background: var(--danger);
  color: #fff;
  font-size: 0.625rem;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* Center FAB button */
.nav-item.fab {
  margin-top: -20px;
}

.nav-item.fab .fab-circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(26, 115, 232, 0.4);
  transition: all var(--transition);
}

.nav-item.fab .fab-circle svg {
  color: #fff;
  width: 24px;
  height: 24px;
}

.nav-item.fab:active .fab-circle {
  transform: scale(0.92);
}

.fab-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fab-popup {
  position: absolute;
  bottom: 64px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--card);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.12);
  padding: 6px;
  display: none;
  z-index: 200;
  white-space: nowrap;
}

.fab-popup.show {
  display: block;
  animation: fabPopIn 0.2s ease;
}

@keyframes fabPopIn {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.fab-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.875rem;
  transition: background var(--transition);
}

.fab-option:hover {
  background: var(--border-light);
}

.fab-option svg {
  flex-shrink: 0;
}

/* ============================================
   Loan Tile / Card Status Colors
   ============================================ */
.loan-tile {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  background: var(--card);
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
  transition: all var(--transition);
  cursor: pointer;
}

.loan-tile:active { transform: scale(0.98); }

/* رنگ نوار کناری بر اساس وضعیت */
.loan-tile::before {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: 0 4px 4px 0;
}

.loan-tile.status-pending::before { background: var(--warning); }
.loan-tile.status-active::before { background: var(--primary); }
.loan-tile.status-closed::before { background: var(--success); }
.loan-tile.status-rejected::before { background: var(--danger); }
.loan-tile.status-expired::before { background: var(--text-muted); }

/* پس‌زمینه هدر کارت بر اساس وضعیت */
.loan-tile .loan-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.loan-tile .loan-title {
  font-weight: 600;
  font-size: 0.9375rem;
}

.loan-tile .loan-amount {
  font-size: 1.125rem;
  font-weight: 700;
  direction: ltr;
  display: inline-block;
}

.loan-tile .loan-amount.text-success { color: var(--success); }
.loan-tile .loan-amount.text-primary { color: var(--primary); }
.loan-tile .loan-amount.text-danger { color: var(--danger); }
.loan-tile .loan-amount.text-warning { color: var(--warning); }
.loan-tile .loan-amount.text-muted { color: var(--text-muted); }

.loan-tile .loan-detail {
  display: flex;
  justify-content: space-between;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  padding: 4px 0;
  border-bottom: 1px solid var(--border-light);
}

.loan-tile .loan-detail:last-child { border-bottom: none; }

.loan-tile .loan-detail .label { color: var(--text-muted); }
.loan-tile .loan-detail .value { font-weight: 500; }

/* وضعیت مدارک */
.doc-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
}

.doc-status.complete { color: var(--success); }
.doc-status.incomplete { color: var(--danger); }
.doc-status.pending-review { color: var(--warning); }
.doc-status.expired { color: var(--text-muted); }

/* ============================================
   Status Badges
   ============================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.6875rem;
  font-weight: 500;
  white-space: nowrap;
}

.badge-success { background: var(--success-light); color: var(--success); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-info { background: var(--primary-light); color: var(--primary); }
.badge-muted { background: var(--border); color: var(--text-muted); }
.badge-purple { background: #F3E8FF; color: #9334E6; }
[data-theme="dark"] .badge-purple { background: #2D1B3A; color: #C084FC; }
[data-theme="dark"] .badge-success { background: #1A2E1E; color: #A8E6B8; }
[data-theme="dark"] .badge-danger { background: #2E1818; color: #F8A8A0; }
[data-theme="dark"] .badge-warning { background: #2E2610; color: #FFE080; }
[data-theme="dark"] .badge-info { background: #1A2A3E; color: #A8C8F8; }
[data-theme="dark"] .badge-muted { background: #2A2A2A; color: #A0A0A0; }
[data-theme="dark"] .form-input, [data-theme="dark"] .form-select, [data-theme="dark"] .form-textarea {
  background: #1A1A1A;
  color: #E8E8E8;
  border-color: #3A3A3A;
}
[data-theme="dark"] .form-input:focus, [data-theme="dark"] .form-select:focus, [data-theme="dark"] .form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(138,180,248,0.15);
}
[data-theme="dark"] .drop-zone {
  border-color: #3A3A3A;
  background: #1A1A1A;
}

/* ============================================
   Progress Bar
   ============================================ */
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin: 8px 0;
}

.progress-bar .progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
}

.progress-bar .progress-fill.bg-success { background: var(--success); }
.progress-bar .progress-fill.bg-primary { background: var(--primary); }
.progress-bar .progress-fill.bg-warning { background: var(--warning); }
.progress-bar .progress-fill.bg-danger { background: var(--danger); }

/* ============================================
   Notification Dot
   ============================================ */
.notif-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.notif-dot.unread { background: var(--primary); }
.notif-dot.read { background: var(--border); }

/* ============================================
   Guarantor Avatar List
   ============================================ */
.guarantor-list {
  display: flex;
  align-items: center;
  gap: -4px;
}

.guarantor-list .avatar {
  border: 2px solid var(--card);
  margin-left: -8px;
  position: relative;
}

.guarantor-list .avatar:last-child { margin-left: 0; }

.guarantor-list .guarantor-count {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6875rem;
  color: var(--text-secondary);
  border: 2px solid var(--card);
  margin-left: -8px;
}

/* ============================================
   Drop Zone (D&D Upload)
   ============================================ */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--card);
}

.drop-zone.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
  border-style: solid;
}

.drop-zone .drop-icon {
  font-size: 3rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.drop-zone .drop-text {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.drop-zone .drop-hint {
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-top: 8px;
}

/* ============================================
   Toast / Snackbar
   ============================================ */
.toast-container {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: calc(100% - 32px);
  max-width: 400px;
  pointer-events: none;
}

.toast {
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideDown 0.3s ease;
  pointer-events: auto;
  border: 1px solid var(--border-light);
  direction: rtl;
}

.toast.toast-success { border-right: 4px solid var(--success); }
.toast.toast-error { border-right: 4px solid var(--danger); }
.toast.toast-info { border-right: 4px solid var(--primary); }
.toast.toast-warning { border-right: 4px solid var(--warning); }

.toast .toast-icon { font-size: 1.25rem; flex-shrink: 0; }
.toast .toast-message { font-size: 0.8125rem; color: var(--text); flex: 1; }
.toast .toast-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 1.25rem;
  padding: 4px;
}

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

/* ============================================
   Modal / Bottom Sheet
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 300;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.modal-overlay.top-center {
  align-items: center;
}

.modal-content {
  background: var(--card);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%;
  max-width: 480px;
  max-height: 80vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease;
  padding: 20px;
}

.modal-content.top-center {
  border-radius: var(--radius-lg);
  max-height: 90vh;
  margin: 16px;
}

.modal-handle {
  width: 40px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 0 auto 16px;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* ============================================
   Skeleton Loading
   ============================================ */
.skeleton {
  background: linear-gradient(90deg, var(--border-light) 25%, var(--card-hover) 50%, var(--border-light) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

.skeleton-text {
  height: 14px;
  margin-bottom: 8px;
  width: 80%;
}

.skeleton-text:last-child { width: 60%; }

.skeleton-card {
  height: 80px;
  margin-bottom: 12px;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ============================================
   Timeline (قسط‌ها)
   ============================================ */
.timeline {
  position: relative;
  padding-right: 24px;
}

.timeline::before {
  content: '';
  position: absolute;
  right: 8px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  padding-bottom: 16px;
}

.timeline-item::before {
  content: '';
  position: absolute;
  right: -18px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--border);
  border: 2px solid var(--bg);
}

.timeline-item.paid::before {
  background: var(--success);
}

.timeline-item.current::before {
  background: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-light);
}

.timeline-item.overdue::before {
  background: var(--danger);
}

/* ============================================
   Guarantee Card with Swipe
   ============================================ */
.swipe-card {
  position: relative;
  overflow: hidden;
  user-select: none;
  touch-action: pan-y;
}

.swipe-card .swipe-inner {
  transition: transform 0.2s ease;
  position: relative;
  z-index: 1;
}

.swipe-card .swipe-actions {
  position: absolute;
  top: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 0;
  opacity: 0;
  transition: opacity 0.2s;
}

.swipe-card .swipe-actions.left {
  left: 0;
  flex-direction: row;
}

.swipe-card .swipe-actions.right {
  right: 0;
  flex-direction: row-reverse;
}

.swipe-card .swipe-action-btn {
  width: 60px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.5rem;
}

.swipe-card .swipe-action-btn.accept { background: var(--success); }
.swipe-card .swipe-action-btn.reject { background: var(--danger); }

/* ============================================
   Document List
   ============================================ */
.doc-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--card);
  border: 1px solid var(--border-light);
  margin-bottom: 8px;
  transition: all var(--transition);
}

.doc-item:active {
  transform: scale(0.98);
}

.doc-item .doc-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--primary-light);
  color: var(--primary);
}

.doc-item .doc-info {
  flex: 1;
  min-width: 0;
}

.doc-item .doc-name {
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.doc-item .doc-meta {
  font-size: 0.6875rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ============================================
   Empty State
   ============================================ */
.empty-state {
  text-align: center;
  padding: 48px 16px;
}

.empty-state .empty-icon {
  font-size: 4rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.empty-state .empty-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.empty-state .empty-desc {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

/* ============================================
   Avatar
   ============================================ */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
}

.avatar.blue { background: var(--primary-light); color: var(--primary); }
.avatar.green { background: var(--success-light); color: var(--success); }
.avatar.red { background: var(--danger-light); color: var(--danger); }
.avatar.yellow { background: var(--warning-light); color: var(--warning); }

.avatar-sm { width: 32px; height: 32px; font-size: 0.75rem; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.5rem; }

/* ============================================
   Dark Mode Toggle
   ============================================ */
.theme-toggle {
  position: relative;
  width: 48px;
  height: 26px;
  background: var(--border);
  border-radius: 13px;
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  padding: 0;
}

.theme-toggle .toggle-thumb {
  position: absolute;
  top: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--card);
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
}

[data-theme="dark"] .theme-toggle { background: var(--primary); }
[data-theme="dark"] .toggle-thumb { right: 24px; }

/* ============================================
   Login Page
   ============================================ */
.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.login-page .login-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
  animation: fadeInUp 0.5s ease;
}

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

.login-page .login-logo .logo-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  font-size: 2rem;
}

.login-page .login-logo h1 {
  font-size: 1.125rem;
  color: var(--text);
}

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

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

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 360px) {
  html { font-size: 14px; }
  .stat-grid { gap: 8px; }
  .stat-card { padding: 12px; }
}

@media (min-width: 768px) {
  body {
    padding-bottom: calc(var(--bottom-nav-height) + 10px);
  }

  .container {
    max-width: 768px;
  }

  .stat-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .bottom-nav {
    display: flex;
    left: 50% !important;
    right: auto !important;
    width: 720px;
    transform: translateX(-50%) !important;
  }

  .desktop-sidebar {
    display: flex;
  }
}

/* ============================================
   Print
   ============================================ */
@media print {
  body { padding: 0; background: #fff; }
  .top-bar, .bottom-nav, .no-print { display: none !important; }
}
