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

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Tahoma, Arial, sans-serif;
  background: #f1f5f9;
  color: #0f172a;
  font-size: 14.5px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ================== ساختار اصلی صفحه ================== */
.layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: calc(100vh - 76px);
}

aside {
  background: #111e33;
  color: #e2e8f0;
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-left: 1px solid rgba(255, 255, 255, 0.06);
}

.nav-kicker {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #64748b;
  padding: 0 12px 10px;
  font-weight: 700;
}

nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

nav button {
  background: transparent;
  color: #94a3b8;
  border: none;
  padding: 12px 14px;
  text-align: right;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.2s ease;
}

nav button svg {
  width: 19px;
  height: 19px;
  flex-shrink: 0;
  opacity: 0.75;
  transition: opacity 0.2s;
}

nav button:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #f8fafc;
}

nav button:hover svg {
  opacity: 1;
}

nav button.active {
  background: linear-gradient(90deg, rgba(201, 164, 74, 0.18) 0%, rgba(201, 164, 74, 0.04) 100%);
  color: #f1d78a;
  font-weight: 700;
  border-right: 3px solid #c9a44a;
}

nav button.active svg {
  color: #c9a44a;
  opacity: 1;
}

.aside-bottom {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 12px;
  font-size: 12px;
  color: #94a3b8;
}

.aside-bottom .db-info-title {
  color: #e2e8f0;
  font-weight: 600;
  margin-bottom: 2px;
}

.aside-bottom .db-info-sub {
  font-size: 11px;
  color: #64748b;
}

.aside-bottom .db-install-link {
  display: inline-block;
  margin-top: 8px;
  color: #c9a44a;
  text-decoration: none;
  font-size: 11px;
}

.aside-bottom .db-install-link:hover {
  text-decoration: underline;
}

main {
  padding: 24px 28px;
  overflow-y: auto;
}

.page {
  display: none;
}

.page.active {
  display: block;
}

/* ================== کارت‌های آمار و خلاصه ================== */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.card {
  background: #ffffff;
  padding: 20px 22px;
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(15, 23, 42, 0.03);
  border: 1px solid #e2e8f0;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.07);
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 4px;
  background: linear-gradient(90deg, #17345f, #2b558f);
}

.card.green::before {
  background: linear-gradient(90deg, #0d7a5f, #10b981);
}

.card.gold::before {
  background: linear-gradient(90deg, #b8860b, #eab308);
}

.card.purple::before {
  background: linear-gradient(90deg, #6d28d9, #8b5cf6);
}

.card .label {
  font-size: 13px;
  color: #64748b;
  font-weight: 500;
  margin-bottom: 8px;
}

.card .num {
  font-size: 23px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.5px;
}

/* ================== گریدها و پنل‌ها ================== */
.grid3 {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1.1fr;
  gap: 18px;
  margin-bottom: 22px;
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 22px;
}

.panel {
  background: #ffffff;
  padding: 22px;
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(15, 23, 42, 0.03);
  border: 1px solid #e2e8f0;
  margin-bottom: 20px;
}

.panel h2 {
  margin: 0 0 16px;
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel h3 {
  margin: 16px 0 10px;
  font-size: 14.5px;
  font-weight: 700;
  color: #17345f;
}

/* ================== جدول‌ها ================== */
.table-wrap {
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

th, td {
  padding: 12px 14px;
  text-align: right;
  border-bottom: 1px solid #f1f5f9;
}

th {
  background: #f8fafc;
  color: #475569;
  font-weight: 600;
  font-size: 12.5px;
  white-space: nowrap;
}

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

tbody tr:hover {
  background: #f8fafc;
}

/* ================== نشان‌ها (Badges) ================== */
.badge-ok, .badge-warn, .badge-no {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.badge-ok {
  background: #e6f7f2;
  color: #0d7a5f;
}

.badge-warn {
  background: #fff7ed;
  color: #c2410c;
}

.badge-no {
  background: #fef2f2;
  color: #b91c1c;
}

/* ================== دکمه‌ها ================== */
.actions {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.btn {
  background: #17345f;
  color: #ffffff;
  border: none;
  padding: 9px 18px;
  border-radius: 9px;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
  text-decoration: none;
}

.btn:hover {
  background: #23487f;
  box-shadow: 0 4px 12px rgba(23, 52, 95, 0.25);
}

.btn.gold {
  background: linear-gradient(135deg, #c9a44a 0%, #b38e36 100%);
  color: #0f172a;
  font-weight: 700;
}

.btn.gold:hover {
  background: linear-gradient(135deg, #d6b35d 0%, #c49c3e 100%);
  box-shadow: 0 4px 14px rgba(201, 164, 74, 0.35);
}

.btn.green {
  background: #0d7a5f;
  color: #ffffff;
}

.btn.green:hover {
  background: #109473;
}

.btn.light {
  background: #ffffff;
  color: #334155;
  border: 1px solid #cbd5e1;
}

.btn.light:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

.btn.danger {
  background: #b91c1c;
  color: #fff;
}

.btn.danger:hover {
  background: #dc2626;
}

/* ================== فرم‌ها و اینپوت‌ها ================== */
.form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 6px;
  color: #334155;
}

.form input, .form select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: #ffffff;
  color: #0f172a;
  box-sizing: border-box;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form input:focus, .form select:focus {
  outline: none;
  border-color: #17345f;
  box-shadow: 0 0 0 3px rgba(23, 52, 95, 0.12);
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 13px;
  color: #334155;
}

.checkbox-row input[type="checkbox"] {
  width: auto;
  accent-color: #17345f;
  cursor: pointer;
}

.notice {
  background: #f8fafc;
  border-right: 3px solid #17345f;
  padding: 12px 14px;
  border-radius: 6px;
  font-size: 12.5px;
  color: #475569;
  line-height: 1.7;
}

.notice b {
  color: #0f172a;
}

/* ================== تقویم داخل پنل ================== */
.calendar {
  padding: 4px;
}

.cal-today-bar {
  font-size: 12px;
  color: #1e3a68;
  background: #eef4fc;
  padding: 6px 10px;
  border-radius: 6px;
  margin-bottom: 10px;
  text-align: center;
}

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

.cal-head .title {
  font-weight: 700;
  font-size: 14px;
  color: #0f172a;
}

.cal-head .nav-btn {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.cal-head .nav-btn:hover {
  background: #e2e8f0;
}

.cal-today-badge {
  font-size: 11px;
  background: #c9a44a;
  color: #0f172a;
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 700;
  border: none;
  cursor: pointer;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  text-align: center;
}

.cal-grid .dow {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  padding: 4px 0;
}

.cal-grid .dow.holiday {
  color: #ef4444;
}

.cal-grid .day {
  padding: 7px 0;
  font-size: 12px;
  border-radius: 6px;
  color: #1e293b;
  font-weight: 500;
}

.cal-grid .day.today {
  background: #17345f;
  color: #ffffff;
  font-weight: 700;
}

.cal-grid .day.holiday {
  color: #dc2626;
}

.cal-grid .day.empty {
  visibility: hidden;
}

/* ================== گرید و کارت‌های سرمایه‌گذاران (Investor Boxes) ================== */
.investor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 20px;
  margin-top: 14px;
}

.investor-box {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 20px 16px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.investor-box:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.1);
  border-color: #cbd5e1;
}

.investor-box.is-settled {
  opacity: 0.85;
  background: #fcfdfd;
  border-color: #a7f3d0;
}

.investor-avatar-wrap {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  margin-bottom: 12px;
  padding: 3px;
  background: linear-gradient(135deg, #17345f, #c9a44a);
  box-shadow: 0 4px 12px rgba(23, 52, 95, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.investor-avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background: #ffffff;
  border: 2px solid #ffffff;
  display: block;
}

.investor-avatar-placeholder {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
  color: #17345f;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 800;
  border: 2px solid #ffffff;
}

.investor-card-name {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 6px;
  line-height: 1.4;
  word-break: break-word;
}

.investor-card-sub {
  font-size: 12px;
  color: #64748b;
  margin-bottom: 10px;
}

.investor-card-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px dashed #f1f5f9;
}

.inv-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  background: #f1f5f9;
  color: #475569;
}

.inv-pill.idle {
  background: #fef3c7;
  color: #92400e;
}

.inv-pill.current {
  background: #e0f2fe;
  color: #0369a1;
}

.inv-pill.receipt {
  background: #dcfce7;
  color: #15803d;
}

/* ================== بخش‌های فرمی و کارت‌های فرعی در مدال ================== */
.form-section-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 16px;
  margin: 12px 0;
}

.form-section-card h4 {
  margin: 0 0 10px;
  font-size: 13.5px;
  color: #17345f;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.inv-row-counter {
  background: #17345f;
  color: #ffffff;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}

.clean-table th {
  background: transparent;
  color: #64748b;
  font-size: 12px;
  border-bottom: 1px solid #e2e8f0;
  padding: 8px 10px;
}

.clean-table td {
  padding: 10px;
  border-bottom: 1px solid #f1f5f9;
}

.acc-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  background: #f1f5f9;
  font-size: 11.5px;
  color: #334155;
  font-weight: 500;
}

/* ================== ریسپانسیو ================== */
@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }
  aside {
    border-left: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }
  .grid3, .grid2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  main {
    padding: 16px;
  }
  .investor-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px;
  }
}

/* ================== نشان‌های تیکت و ناوبری ================== */
.nav-badge {
  margin-right: auto;
  background: #ef4444;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 12px;
  min-width: 18px;
  text-align: center;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
}

.ticket-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.ticket-badge.open {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}

.ticket-badge.in_progress {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

.ticket-badge.answered {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.ticket-badge.closed {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #cbd5e1;
}

.ticket-type-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 5px;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}

.ticket-type-tag.capital_withdrawal {
  background: #ede9fe;
  color: #6d28d9;
  border: 1px solid #ddd6fe;
}

.ticket-type-tag.profit_withdrawal {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.ticket-type-tag.settlement {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

.ticket-type-tag.general {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}

/* بخش چت و تاریخچه تیکت */
.ticket-thread-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  max-height: 380px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 16px;
}

.chat-bubble {
  max-width: 82%;
  padding: 12px 16px;
  border-radius: 14px;
  position: relative;
  font-size: 13.5px;
  line-height: 1.7;
}

.chat-bubble.investor {
  align-self: flex-start;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-bottom-right-radius: 3px;
  color: #0f172a;
  box-shadow: 0 2px 6px rgba(0,0,0,0.03);
}

.chat-bubble.admin {
  align-self: flex-end;
  background: linear-gradient(135deg, #17345f, #1b3d6f);
  color: #ffffff;
  border-bottom-left-radius: 3px;
  box-shadow: 0 4px 12px rgba(23, 52, 95, 0.2);
}

.chat-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 11px;
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}

.chat-bubble.admin .chat-meta {
  border-bottom-color: rgba(255,255,255,0.15);
  color: #f1d78a;
}

.chat-bubble.investor .chat-meta {
  color: #64748b;
}

.quick-reply-btn {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #334155;
  font-size: 11.5px;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.quick-reply-btn:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
}

