/* =============================================
   نظام إدارة الشركاء - التصميم الكامل
   ============================================= */
:root {
  --primary: #1e3a5f;
  --primary-light: #2d5a8e;
  --primary-bg: #eaf1fb;
  --accent: #c8a96e;
  --success: #059669;
  --success-bg: #ecfdf5;
  --warning: #d97706;
  --warning-bg: #fffbeb;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --info: #1e40af;
  --info-bg: #eff6ff;

  --slate-50: #f8fafc;
  --slate-100: #eef2f6;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;

  --radius: 14px;
  --shadow: 0 1px 3px rgba(0,0,0,.07), 0 4px 14px rgba(0,0,0,.05);
  --shadow-md: 0 6px 20px rgba(0,0,0,.10);
  --sidebar-w: 250px;
}

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

body {
  font-family: 'Noto Sans Arabic', 'Segoe UI', sans-serif;
  background: var(--slate-50);
  color: var(--slate-800);
  direction: rtl;
  min-height: 100vh;
}

a { text-decoration: none; color: inherit; }

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

.sidebar {
  position: fixed;
  top: 0; right: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--primary);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform .3s ease;
  overflow-y: auto;
}

.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 99;
}
.sidebar-overlay.active { display: block; }

.sidebar-logo {
  padding: 22px 20px;
  border-bottom: 1px solid rgba(255,255,255,.1);
  display: flex;
  align-items: center;
  gap: 10px;
  color: white;
  font-weight: 700;
  font-size: 15px;
}
.logo-icon { font-size: 22px; }

.sidebar-nav { flex: 1; padding: 14px 10px; }

.sidebar-section-title {
  color: rgba(255,255,255,.4);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  padding: 14px 10px 6px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  border-radius: 9px;
  color: rgba(255,255,255,.75);
  font-size: 13.5px;
  margin-bottom: 2px;
  transition: all .15s;
  position: relative;
}
.nav-link:hover { background: rgba(255,255,255,.08); color: white; }
.nav-link.active { background: var(--accent); color: var(--primary); font-weight: 700; }
.nav-icon { font-size: 16px; }
.nav-badge {
  margin-right: auto;
  background: var(--danger);
  color: white;
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 20px;
}

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

.main-content { margin-right: var(--sidebar-w); flex: 1; min-width: 0; }

.top-bar {
  position: sticky;
  top: 0;
  height: 58px;
  background: white;
  border-bottom: 1px solid var(--slate-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  z-index: 50;
}
.top-bar-title { font-size: 14.5px; font-weight: 700; color: var(--slate-800); }
.top-bar-right { display: flex; align-items: center; gap: 12px; }

.hamburger {
  display: none;
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--slate-700);
}

.notif-btn {
  position: relative;
  width: 36px; height: 36px;
  border-radius: 9px;
  border: 1px solid var(--slate-200);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  background: white;
}
.notif-badge {
  position: absolute;
  top: -5px; left: -5px;
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 700;
  width: 17px; height: 17px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid white;
}

.page-content { padding: 24px; max-width: 1400px; }

/* ============ STAT CARDS ============ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--slate-200);
  box-shadow: var(--shadow);
  padding: 18px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.stat-icon {
  width: 46px; height: 46px;
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font-size: 21px;
  flex-shrink: 0;
}
.stat-body { flex: 1; }
.stat-label { font-size: 12px; color: var(--slate-500); margin-bottom: 4px; }
.stat-value { font-size: 22px; font-weight: 800; line-height: 1.15; }
.stat-sub { font-size: 11px; color: var(--slate-400); margin-top: 3px; }

/* ============ CARDS ============ */
.card {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--slate-200);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--slate-200);
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.card-body { padding: 20px; }

/* ============ TABLES ============ */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead tr { background: var(--slate-50); }
thead th {
  padding: 11px 16px;
  text-align: right;
  font-weight: 700;
  font-size: 11px;
  color: var(--slate-500);
  text-transform: uppercase;
  letter-spacing: .03em;
  border-bottom: 1px solid var(--slate-200);
  white-space: nowrap;
}
tbody tr { border-bottom: 1px solid var(--slate-100); }
tbody tr:hover { background: var(--slate-50); }
tbody td { padding: 12px 16px; vertical-align: middle; }

/* ============ FORMS ============ */
.form-group { margin-bottom: 14px; display: flex; flex-direction: column; gap: 5px; }
.form-label { font-size: 12px; font-weight: 700; color: var(--slate-600); }
.form-control {
  padding: 10px 14px;
  border: 1.5px solid var(--slate-200);
  border-radius: 9px;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--slate-800);
  background: white;
  width: 100%;
  transition: border-color .15s;
}
.form-control:focus { outline: none; border-color: var(--primary); }
textarea.form-control { min-height: 80px; resize: vertical; }
.form-grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
.form-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  border: none;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-light); }
.btn-secondary { background: var(--slate-100); color: var(--slate-700); }
.btn-secondary:hover { background: var(--slate-200); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #047857; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #b91c1c; }
.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover { background: #b45309; }
.btn-outline { background: transparent; border: 1.5px solid var(--slate-300); color: var(--slate-600); }
.btn-outline:hover { background: var(--slate-50); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 20px; font-size: 15px; }
.btn-block { width: 100%; justify-content: center; }

/* ============ BADGES ============ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-info    { background: var(--info-bg);    color: var(--info); }
.badge-gray    { background: var(--slate-100);  color: var(--slate-500); }

/* ============ ALERTS ============ */
.alert {
  padding: 13px 16px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 16px;
}
.alert-success { background: var(--success-bg); border: 1px solid #a7f3d0; color: #065f46; }
.alert-danger  { background: var(--danger-bg);  border: 1px solid #fecaca; color: #991b1b; }
.alert-warning { background: var(--warning-bg); border: 1px solid #fde68a; color: #92400e; }
.alert-info    { background: var(--info-bg);    border: 1px solid #bfdbfe; color: #1e40af; }

/* ============ TABS ============ */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--slate-200); margin-bottom: 20px; flex-wrap: wrap; }
.tab-btn {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  border: none;
  background: none;
  color: var(--slate-500);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}
.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 700; }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ============ MODAL ============ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  transition: all .2s;
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal {
  background: white;
  border-radius: var(--radius);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--slate-200);
  font-weight: 700;
  font-size: 14.5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-close {
  width: 28px; height: 28px;
  border-radius: 7px;
  border: none;
  background: var(--slate-100);
  cursor: pointer;
  font-size: 14px;
}
.modal-body { padding: 20px; }

/* ============ PARTNERS GRID ============ */
.partners-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.partner-card {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--slate-200);
  box-shadow: var(--shadow);
  padding: 18px;
  cursor: pointer;
  transition: all .15s;
}
.partner-card:hover { box-shadow: var(--shadow-md); border-color: var(--accent); }
.partner-card-top { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.partner-avatar {
  width: 46px; height: 46px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  font-size: 17px;
  flex-shrink: 0;
}
.partner-card-info h3 { font-size: 14.5px; font-weight: 700; margin-bottom: 2px; }
.partner-card-info p { font-size: 12px; color: var(--slate-500); line-height: 1.5; }
.partner-card-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
  padding: 12px;
  background: var(--slate-50);
  border-radius: 10px;
}
.mini-stat-label { font-size: 10.5px; color: var(--slate-400); margin-bottom: 2px; }
.mini-stat-value { font-size: 13px; font-weight: 700; color: var(--slate-800); }
.partner-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

/* ============ CHAT ============ */
.chat-wrap { display: flex; gap: 14px; height: calc(100vh - 200px); }
.chat-list-col {
  width: 360px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  padding-left: 4px;
}
.chat-list-item {
  display: block;
  background: white;
  border: 1px solid var(--slate-100);
  border-radius: 12px;
  padding: 12px 14px;
  transition: all .15s;
}
.chat-list-item.active { background: var(--primary-bg); border-color: var(--primary); }
.chat-list-item-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.chat-list-item-title {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--slate-800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-list-item-meta { font-size: 0.72rem; color: var(--slate-400); display: flex; align-items: center; gap: 6px; }
.chat-list-arrow { display: none; color: var(--slate-300); font-size: 1.1rem; }
.chat-title-main {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--slate-800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-panel-col { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.chat-back-btn { display: none; }

.chat-box {
  height: 400px;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--slate-50);
}
.chat-msg { display: flex; flex-direction: column; max-width: 72%; }
.chat-msg.admin { align-self: flex-end; align-items: flex-end; }
.chat-msg.partner { align-self: flex-start; align-items: flex-start; }
.chat-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.5;
}
.chat-msg.admin .chat-bubble { background: var(--primary); color: white; border-bottom-left-radius: 4px; }
.chat-msg.partner .chat-bubble { background: white; border: 1px solid var(--slate-200); border-bottom-right-radius: 4px; }
.chat-time { font-size: 10px; color: var(--slate-400); margin-top: 3px; }

/* Mobile: full-page single-panel chat (list OR conversation, never both) */
@media (max-width: 900px) {
  .chat-wrap { display: block; height: auto; }
  .chat-list-col { display: none; width: 100%; }
  .chat-panel-col { display: none; }
  .chat-wrap.show-list .chat-list-col { display: flex; }
  .chat-wrap.show-chat .chat-panel-col {
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0;
    z-index: 300;
    background: white;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    overflow: hidden;
    border-radius: 0;
    border: none;
    box-shadow: none;
  }
  .chat-wrap.show-chat .chat-panel-col .chat-box { flex: 1; height: auto; min-height: 0; }
  .chat-wrap.show-chat .chat-panel-col .pchat-body { flex: 1; min-height: 0; }
  .chat-wrap.show-chat .chat-panel-col .pchat-header,
  .chat-wrap.show-chat .chat-panel-col .pchat-topic,
  .chat-wrap.show-chat .chat-panel-col .pchat-input-bar,
  .chat-wrap.show-chat .chat-panel-col .pchat-closed-notice {
    flex-shrink: 0;
  }
  .chat-list-item { padding: 14px 16px; }
  .chat-list-arrow { display: inline; }
  .chat-back-btn { display: inline-flex; }
}

/* ============ LOGIN ============ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary) 0%, #0f2240 100%);
  padding: 20px;
}
.login-box {
  background: white;
  border-radius: 20px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.logo-circle {
  width: 60px; height: 60px;
  border-radius: 50%;
  background: var(--primary-bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  margin: 0 auto 12px;
}

/* ============ PARTNER DASHBOARD (Material-style) ============ */
.db-greeting h2 { font-size: 1.25rem; font-weight: 800; color: var(--slate-800); display: flex; align-items: center; gap: 6px; }
.db-greeting p { color: var(--slate-500); font-size: 0.85rem; margin-top: 2px; }

.db-stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 18px 0 22px; }

.stat-hero {
  grid-column: span 2;
  border-radius: 18px;
  padding: 22px;
  color: white;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 108px;
  box-shadow: var(--shadow);
}
@media (min-width: 640px) { .stat-hero { grid-column: span 1; } }
.stat-hero-primary { background: var(--primary); }
.stat-hero-amber { background: #8a5100; }
.stat-hero-label { font-size: 0.8rem; opacity: .9; }
.stat-hero-value { font-size: 1.6rem; font-weight: 800; display: flex; align-items: baseline; gap: 6px; margin-top: 10px; }
.stat-hero-value span { font-size: 0.85rem; font-weight: 500; opacity: .85; }

.stat-mini {
  background: white;
  border: 1px solid var(--slate-100);
  border-radius: 18px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.stat-mini-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 10px; }
.stat-mini-top > span:first-child { font-size: 0.8rem; color: var(--slate-500); }
.stat-mini-due { font-size: 0.72rem; color: var(--slate-400); white-space: nowrap; }
.stat-mini-tag { font-size: 0.72rem; color: var(--primary); font-weight: 600; }
.stat-mini-value { font-size: 1.35rem; font-weight: 800; color: var(--slate-800); display: flex; align-items: baseline; gap: 5px; }
.stat-mini-value span { font-size: 0.78rem; font-weight: 500; color: var(--slate-400); }

.bento-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 24px; }
@media (min-width: 640px) { .bento-grid { grid-template-columns: repeat(4, 1fr); } }
.bento-item {
  background: white;
  border: 1px solid var(--slate-100);
  border-radius: 16px;
  padding: 18px 12px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  position: relative;
  text-align: center;
  transition: all .15s;
}
.bento-item:active { transform: scale(.96); }
.bento-icon-circle {
  width: 48px; height: 48px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
}
.bento-blue { background: #eff6ff; }
.bento-purple { background: #f5f3ff; }
.bento-green { background: #ecfdf5; }
.bento-amber { background: #fffbeb; }
.bento-label { font-size: 0.78rem; font-weight: 600; color: var(--slate-700); }
.bento-badge {
  position: absolute;
  top: 10px; left: 10px;
  width: 19px; height: 19px;
  background: var(--danger);
  color: white;
  border-radius: 50%;
  font-size: 0.68rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid white;
}

.recent-card-header { display: flex; align-items: center; justify-content: space-between; }
.recent-empty { padding: 40px 20px; display: flex; flex-direction: column; align-items: center; gap: 12px; color: var(--slate-400); }
.recent-empty-icon {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--slate-50);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem;
  opacity: .5;
}

/* بطاقات الإيداعات */
.deposits-list { display: flex; flex-direction: column; gap: 12px; padding: 16px; }
.deposit-card {
  background: var(--slate-50);
  border: 1px solid var(--slate-100);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.deposit-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.deposit-row.bottom { align-items: flex-end; }
.deposit-label { font-size: 0.68rem; color: var(--slate-400); display: block; margin-bottom: 3px; }
.deposit-desc { font-weight: 700; font-size: 0.88rem; color: var(--slate-800); }
.deposit-date { font-size: 0.82rem; color: var(--slate-600); }
.deposit-amount-wrap { text-align: left; }
.deposit-amount { font-size: 1.1rem; font-weight: 800; color: var(--primary); }
.deposit-amount-cur { font-size: 0.7rem; font-weight: 600; color: var(--primary); }
.deposit-chip { font-size: 0.68rem; font-weight: 700; padding: 4px 9px; border-radius: 7px; white-space: nowrap; }
.deposit-chip.paid { background: #ecfdf5; color: #059669; }
.deposit-chip.pending { background: #fffbeb; color: #d97706; }

/* بطاقات المحادثات */
.chat-hero-btn {
  width: 100%;
  background: var(--primary);
  color: white;
  padding: 16px;
  border-radius: 14px;
  font-weight: 800;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 10px 25px -8px rgba(30,58,95,.4);
}
.chat-active-notice {
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: 14px;
  padding: 18px;
  text-align: center;
}
.chat-active-notice-icon { font-size: 1.7rem; margin-bottom: 8px; }
.chat-active-notice p { font-size: 0.82rem; color: var(--slate-600); line-height: 1.7; }

.chat-history-title { font-size: 1rem; font-weight: 800; color: var(--slate-800); margin: 24px 0 14px; }

.chat-item-card {
  background: white;
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
  box-shadow: 0 4px 14px rgba(0,0,0,.04);
  border: 1px solid var(--slate-100);
  text-decoration: none;
  color: inherit;
  transition: all .15s;
}
.chat-item-card:active { transform: scale(.98); }
.chat-item-card.is-open { border-right: 4px solid #8a5100; }
.chat-item-card.is-closed { background: var(--slate-50); opacity: .85; }
.chat-item-card.active { box-shadow: 0 0 0 2px var(--primary) inset; }
.chat-item-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.chat-item-title { font-weight: 700; font-size: 0.92rem; color: var(--slate-800); }
.chat-item-meta { font-size: 0.76rem; color: var(--slate-400); margin-top: 2px; }
.chat-item-preview {
  font-size: 0.82rem;
  color: var(--slate-500);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-item-card.is-closed .chat-item-preview { font-style: italic; }

.chip-open {
  background: #fc9d24;
  color: #673b00;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.chip-open .dot { width: 6px; height: 6px; border-radius: 50%; background: #673b00; }
.chip-closed {
  background: var(--slate-100);
  color: var(--slate-500);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  white-space: nowrap;
}

.chat-history-empty { text-align: center; padding: 36px 20px; opacity: .35; }
.chat-history-empty-icon { font-size: 2.6rem; margin-bottom: 10px; }

/* ============ محادثة الشريك التفصيلية (تصميم دعم فني) ============ */
.pchat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--slate-100);
  background: white;
}
.pchat-avatar {
  position: relative;
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--primary-bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.pchat-status-dot {
  position: absolute;
  bottom: 0; left: 0;
  width: 11px; height: 11px;
  border-radius: 50%;
  border: 2px solid white;
}
.pchat-status-dot.online { background: #22c55e; }
.pchat-status-dot.offline { background: var(--slate-300); }
.pchat-header-info { flex: 1; min-width: 0; }
.pchat-header-title { font-weight: 800; font-size: 0.95rem; color: var(--slate-800); }
.pchat-header-sub { font-size: 0.74rem; color: var(--slate-400); }
.pchat-header-sub.online { color: #16a34a; font-weight: 600; }
.pchat-topic {
  font-size: 0.78rem;
  color: var(--slate-500);
  background: var(--slate-50);
  padding: 8px 16px;
  border-bottom: 1px solid var(--slate-100);
}

.pchat-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--slate-50);
}
.pchat-date-divider { display: flex; justify-content: center; margin: 14px 0 10px; }
.pchat-date-divider span {
  background: var(--slate-200);
  color: var(--slate-600);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 14px;
  border-radius: 20px;
}

.pchat-msg { display: flex; flex-direction: column; max-width: 82%; margin-bottom: 12px; }
.pchat-msg.me { align-self: flex-end; align-items: flex-end; }
.pchat-msg.them { align-self: flex-start; align-items: flex-start; }
.pchat-bubble {
  padding: 12px 15px;
  border-radius: 16px;
  font-size: 0.88rem;
  line-height: 1.6;
  word-break: break-word;
}
.pchat-msg.me .pchat-bubble { background: var(--primary); color: white; border-bottom-left-radius: 4px; box-shadow: 0 4px 10px rgba(30,58,95,.15); }
.pchat-msg.them .pchat-bubble { background: white; color: var(--slate-800); border-bottom-right-radius: 4px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.pchat-meta { font-size: 0.68rem; color: var(--slate-400); margin-top: 4px; padding: 0 4px; display: flex; align-items: center; gap: 4px; }
.pchat-check { color: var(--primary); font-size: 0.78rem; }

.pchat-input-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: white;
  border-top: 1px solid var(--slate-100);
}
.pchat-input {
  flex: 1;
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: 24px;
  padding: 11px 18px;
  font-size: 0.88rem;
  font-family: inherit;
  color: var(--slate-800);
}
.pchat-input:focus { outline: none; border-color: var(--primary); }
.pchat-send-btn {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  border: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(30,58,95,.25);
}
.pchat-send-btn:active { transform: scale(.9); }
.pchat-closed-notice {
  text-align: center;
  padding: 14px;
  color: var(--slate-400);
  font-size: 0.82rem;
  background: white;
  border-top: 1px solid var(--slate-100);
}

.partner-avatar-circle {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--primary-bg);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
/* ============ PARTNER PORTAL ============ */
.partner-layout { min-height: 100vh; padding-bottom: 70px; }
.partner-topbar {
  background: white;
  border-bottom: 1px solid var(--slate-200);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}
.partner-topbar h1 { font-size: 1.15rem; font-weight: 800; color: var(--primary); }
.partner-content { padding: 16px; max-width: 900px; margin: 0 auto; }

.partner-bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: white;
  border-top: 1px solid var(--slate-200);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 8px 4px;
  z-index: 100;
}
.bottom-nav-item {
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  color: var(--slate-400);
  padding: 6px 2px;
  cursor: pointer;
  font-family: inherit;
}
.bottom-nav-item.active { color: var(--primary); font-weight: 700; }
.nav-ico { font-size: 20px; }

/* ============ PROFILE DATA CARDS (Bank Accounts / Documents) ============ */
.profile-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
@media (min-width: 640px) { .profile-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .profile-grid.docs-grid { grid-template-columns: repeat(4, 1fr); } }

.profile-hint {
  font-size: 0.82rem;
  color: var(--slate-600);
  background: var(--warning-bg);
  border: 1px solid #fde68a;
  border-radius: 16px;
  padding: 16px 18px;
  margin-bottom: 22px;
  line-height: 1.8;
  text-align: center;
}

/* تبويبات بعرض متساوٍ (خاصة بصفحة بياناتي) */
.tabs-split { display: flex; border-bottom: 1px solid var(--slate-200); margin-bottom: 26px; }
.tabs-split .tab-btn {
  flex: 1;
  justify-content: center;
  padding: 13px 8px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.section-count { font-size: 0.72rem; background: rgba(255,255,255,.25); color: inherit; padding: 1px 9px; border-radius: 20px; font-weight: 700; }
.tab-btn.active .section-count { background: var(--primary-bg); color: var(--primary); }
.tab-btn:not(.active) .section-count { background: var(--slate-100); color: var(--slate-500); }

.profile-section-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--primary);
  font-weight: 800;
  font-size: 0.95rem;
  margin-bottom: 16px;
}
.profile-add-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #6366f1;
  font-weight: 800;
  font-size: 0.95rem;
  margin-bottom: 22px;
}

.bank-card {
  position: relative;
  background: white;
  border: 1px solid var(--slate-100);
  border-radius: 20px;
  padding: 26px 20px;
  box-shadow: var(--shadow);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.bank-card-icon-top { font-size: 1.7rem; opacity: .55; margin-bottom: 4px; }
.bank-card-name { font-weight: 800; font-size: 1.05rem; color: var(--slate-800); }
.bank-card-sub { font-size: 0.85rem; color: var(--slate-500); margin-bottom: 2px; }
.bank-card-status-pill { margin-bottom: 6px; }
.bank-card-iban { font-family: 'Courier New', monospace; color: var(--slate-600); font-size: 0.92rem; direction: ltr; }
.bank-card-accnum { font-size: 0.85rem; color: var(--slate-500); }
.bank-card-note {
  font-size: 0.78rem;
  color: var(--danger);
  background: var(--danger-bg);
  padding: 9px 12px;
  border-radius: 10px;
  margin-top: 8px;
  line-height: 1.6;
  width: 100%;
}
.bank-card-actions { margin-top: 8px; width: 100%; }

.doc-card {
  background: white;
  border: 1px solid var(--slate-100);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--shadow);
  position: relative;
  text-align: center;
}
.doc-card-icon {
  width: 100%;
  aspect-ratio: 4/3;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.1rem;
}
.doc-card-body { padding: 14px 12px 16px; }
.doc-card-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--slate-800);
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.doc-card-status { position: absolute; top: 10px; left: 10px; }
.doc-card-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }

.add-card-form { margin-bottom: 28px; }
.add-card-form .form-group { margin-bottom: 18px; }
.add-card-form .form-label { text-align: center; display: block; font-size: 0.85rem; font-weight: 600; color: var(--slate-700); margin-bottom: 8px; }
.add-card-form .form-control {
  padding: 14px 16px;
  border-radius: 12px;
  border-color: var(--slate-200);
  font-size: 0.9rem;
}
.add-card-form .form-control::placeholder { color: var(--slate-300); }
.add-card-form .btn-primary {
  padding: 15px 18px;
  border-radius: 12px;
  font-size: 0.95rem;
  margin-top: 8px;
}
/* ============ RESPONSIVE ============ */
@media (max-width: 900px) {
  .sidebar { transform: translateX(100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-right: 0; }
  .hamburger { display: block; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .partners-grid { grid-template-columns: 1fr; }
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
  .page-content { padding: 14px; }
}
