/* ================================================================
   Smart Digital — Shared Mini Dashboard
   Used by every paid app (PatraLekhak, BizWrite, ShopWrite,
   LipiAntar, Resume Builder, etc.) — opens from clicking the
   user avatar in the header. Self-contained; doesn't rely on
   per-app CSS variables.
   ================================================================ */

.sd-dashboard-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.4); z-index: 9000;
  backdrop-filter: blur(2px);
}
.sd-dashboard-overlay.open { display: block; }

.sd-dashboard {
  position: fixed; top: 0; right: -440px; width: 380px; height: 100vh;
  max-width: 100vw;
  background: #fff; color: #0f172a; z-index: 9100;
  box-shadow: -4px 0 30px rgba(0, 0, 0, 0.15);
  display: flex; flex-direction: column;
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  font-family: inherit;
}
.sd-dashboard.open { right: 0; }

.sd-md-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 20px 16px; border-bottom: 1px solid #e2e8f0;
  position: sticky; top: 0; background: #fff; z-index: 1;
}
.sd-md-title { font-size: 1.05rem; font-weight: 800; color: #0f172a; margin: 0; }
.sd-md-close {
  background: #f1f5f9; border: none; width: 30px; height: 30px;
  border-radius: 50%; cursor: pointer; font-size: 0.85rem; color: #64748b;
}
.sd-md-close:hover { background: #e2e8f0; }

.sd-md-user-row {
  display: flex; align-items: center; gap: 12px; padding: 16px 20px;
  border-bottom: 1px solid #f1f5f9;
}
.sd-md-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  object-fit: cover; border: 2px solid #e2e8f0;
  background: #2563eb; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1.1rem; overflow: hidden;
  flex-shrink: 0;
}
.sd-md-user-name { font-weight: 700; font-size: 0.95rem; color: #0f172a; }
.sd-md-user-email { font-size: 0.78rem; color: #64748b; word-break: break-all; }

.sd-md-plan-card {
  margin: 16px; padding: 16px; border-radius: 12px;
  background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
  border: 1px solid #bae6fd;
}
.sd-md-plan-top {
  display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
}
.sd-md-plan-icon { font-size: 1.6rem; }
.sd-md-plan-name { font-weight: 800; font-size: 0.95rem; color: #0f172a; }
.sd-md-plan-sub { font-size: 0.75rem; color: #475569; margin-top: 1px; }
.sd-md-plan-badge {
  margin-left: auto; padding: 3px 10px; border-radius: 20px;
  font-size: 0.72rem; font-weight: 800; color: #fff; background: #f59e0b;
  letter-spacing: 0.5px;
}

.sd-md-usage-bar-wrap { display: flex; align-items: center; gap: 10px; }
.sd-md-usage-bar-track {
  flex: 1; height: 7px; background: rgba(0, 0, 0, 0.08);
  border-radius: 10px; overflow: hidden;
}
.sd-md-usage-bar-fill {
  height: 100%; border-radius: 10px;
  transition: width 0.6s ease; background: #2563eb;
}
.sd-md-usage-bar-label {
  font-size: 0.75rem; font-weight: 600; color: #475569; white-space: nowrap;
}

.sd-md-stats-row {
  display: flex; gap: 0; margin: 0 16px 16px;
  border: 1px solid #e2e8f0; border-radius: 10px; overflow: hidden;
}
.sd-md-stat-box {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  padding: 14px 8px; gap: 3px; border-right: 1px solid #e2e8f0;
}
.sd-md-stat-box:last-child { border-right: none; }
.sd-md-stat-val { font-size: 1.4rem; font-weight: 800; color: #0f172a; }
.sd-md-stat-lbl {
  font-size: 0.72rem; color: #94a3b8; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px;
}

.sd-md-history-section { padding: 0 16px 16px; flex: 1; }
.sd-md-section-title {
  font-size: 0.8rem; font-weight: 700; color: #94a3b8;
  text-transform: uppercase; letter-spacing: 0.6px; margin-bottom: 10px;
}
.sd-md-history-list { display: flex; flex-direction: column; gap: 8px; }
.sd-md-history-empty {
  font-size: 0.85rem; color: #94a3b8; text-align: center; padding: 20px 0;
}
.sd-md-history-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; background: #f8fafc; border-radius: 8px;
  border: 1px solid #f1f5f9;
}
.sd-md-hi-dot {
  width: 8px; height: 8px; border-radius: 50%; background: #2563eb;
  flex-shrink: 0;
}
.sd-md-hi-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sd-md-hi-title {
  font-size: 0.85rem; font-weight: 600; color: #1e293b;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sd-md-hi-meta { font-size: 0.75rem; color: #94a3b8; }

.sd-md-cta-btn {
  margin: 0 16px 20px; padding: 12px; border-radius: 10px; border: none;
  background: #2563eb; color: #fff; font-weight: 700; font-size: 0.9rem;
  cursor: pointer; transition: opacity 0.2s;
}
.sd-md-cta-btn:hover { opacity: 0.88; }

.sd-md-signout {
  margin: 0 16px 24px; padding: 10px; border-radius: 10px;
  background: transparent; border: 1px solid #e2e8f0;
  color: #64748b; font-weight: 600; font-size: 0.85rem; cursor: pointer;
}
.sd-md-signout:hover { background: #f8fafc; color: #dc2626; border-color: #fecaca; }

@media (max-width: 600px) {
  .sd-dashboard { width: 100%; right: -100%; }
  .sd-md-user-row { flex-wrap: wrap; }
}
