/* The dashboard page renders as a fully standalone HTML document (see
   maybe_render_standalone_dashboard) so no theme header/footer/stylesheet/admin
   bar is ever loaded on it in the first place. These rules are just a light,
   defensive fallback in case [crm_dashboard] is ever embedded inside a themed
   page instead — low-specificity element resets that won't fight Tailwind's
   own utility classes (which decide margin/padding/font-size/text-align etc.
   on individual elements via Preflight + utilities, always after this file). */
#crm-ms-app, #crm-ms-app * { box-sizing: border-box; }
#crm-ms-app ul, #crm-ms-app ol { list-style: none; }
#crm-ms-app a { text-decoration: none; cursor: pointer; }
#crm-ms-app table { border-collapse: collapse; }
#crm-ms-app img { max-width: 100%; }
#crm-ms-app button, #crm-ms-app input, #crm-ms-app select, #crm-ms-app textarea {
	font-family: inherit;
	color: inherit;
	background: #fff;
	border: 1px solid #cbd5e1;
	border-radius: 8px;
}

/* Mobile-safe page shell — this does NOT depend on the Tailwind CDN script
   actually loading (some hosts/networks block third-party script domains,
   which would otherwise leave the whole layout unstyled/unresponsive). These
   rules alone guarantee the sidebar stacks above the content on narrow
   screens, nothing overflows the viewport width, and touch targets stay
   usable — Tailwind's own utility classes layer on top when it does load. */
html, body { max-width: 100%; overflow-x: hidden; }
.crm-page-wrap { max-width: 1400px; margin: 0 auto; padding: 20px; box-sizing: border-box; }
#crm-ms-app img, #crm-ms-app svg { max-width: 100%; height: auto; }
#crm-ms-app .crm-shell { display: flex; flex-direction: column; gap: 1rem; width: 100%; }
#crm-ms-app .crm-sidebar { width: 100%; box-sizing: border-box; }
#crm-ms-app .crm-main { width: 100%; min-width: 0; }
@media (min-width: 1024px) {
	#crm-ms-app .crm-shell { flex-direction: row; align-items: flex-start; }
	#crm-ms-app .crm-sidebar { width: 16rem; flex-shrink: 0; position: sticky; top: 1rem; }
	#crm-ms-app .crm-main { flex: 1; }
}
#crm-ms-app table { width: 100%; }
#crm-ms-app .crm-card.overflow-x-auto,
#crm-ms-app div[class*="overflow-x-auto"] { overflow-x: auto; -webkit-overflow-scrolling: touch; }
#crm-ms-app button, #crm-ms-app input, #crm-ms-app select, #crm-ms-app textarea { max-width: 100%; }
@media (max-width: 480px) {
	.crm-page-wrap { padding: 12px; }
	#crm-ms-app .crm-stat-card { padding: 12px; }
	#crm-ms-app .crm-modal { padding: 12px 8px; }
}

.crm-ms-scope { font-family: -apple-system, "Segoe UI", Roboto, sans-serif; color: #1e293b; }
.crm-ms-scope .crm-nav-btn { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 9px 12px; border-radius: 10px; font-weight: 500; color: #475569; background: transparent; border: none; cursor: pointer; }
.crm-ms-scope .crm-nav-btn:hover { background: #f1f5f9; }
.crm-ms-scope .crm-nav-btn.active { background: #dbeafe; color: #1d4ed8; }
.crm-ms-scope .crm-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 16px; }
.crm-ms-scope .crm-table { width: 100%; font-size: 13px; border-collapse: collapse; }
.crm-ms-scope .crm-table th { text-align: left; padding: 10px 14px; background: #f8fafc; color: #64748b; font-weight: 600; border-bottom: 1px solid #e2e8f0; white-space: nowrap; }
.crm-ms-scope .crm-table td { padding: 10px 14px; border-bottom: 1px solid #f1f5f9; }
.crm-ms-scope .crm-table tr:hover td { background: #fafcff; }
.crm-ms-scope .crm-input { border: 1px solid #cbd5e1; border-radius: 8px; padding: 8px 10px; font-size: 13px; width: 100%; }
.crm-ms-scope .crm-input:focus { outline: none; border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,.15); }
.crm-ms-scope .crm-label { display: block; font-size: 12px; font-weight: 600; color: #475569; margin-bottom: 4px; }
.crm-ms-scope .crm-btn-primary { background: #2563eb; color: #fff; padding: 8px 16px; border-radius: 8px; font-size: 13px; font-weight: 600; border: none; cursor: pointer; }
.crm-ms-scope .crm-btn-primary:hover { background: #1d4ed8; }
.crm-ms-scope .crm-btn-secondary { background: #f1f5f9; color: #334155; padding: 8px 16px; border-radius: 8px; font-size: 13px; font-weight: 600; border: 1px solid #e2e8f0; cursor: pointer; }
.crm-ms-scope .crm-btn-secondary:hover { background: #e2e8f0; }
.crm-ms-scope .crm-icon-btn { color: #64748b; padding: 6px; border-radius: 6px; }
.crm-ms-scope .crm-icon-btn:hover { background: #f1f5f9; }
.crm-ms-scope .crm-badge { padding: 2px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.crm-ms-scope .crm-badge-green { background: #dcfce7; color: #166534; }
.crm-ms-scope .crm-badge-gray { background: #f1f5f9; color: #64748b; }
.crm-ms-scope .crm-badge-blue { background: #dbeafe; color: #1d4ed8; }
.crm-ms-scope .crm-badge-red { background: #fee2e2; color: #b91c1c; }
.crm-ms-scope .crm-badge-amber { background: #fef3c7; color: #92400e; }
.crm-ms-scope .crm-stat-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 16px; padding: 16px; }
.crm-ms-scope .crm-stat-value { font-size: 22px; font-weight: 800; color: #0f172a; }
.crm-ms-scope .crm-stat-label { font-size: 12px; color: #64748b; margin-top: 2px; }
.crm-ms-scope .crm-modal { position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 9999; display: flex; align-items: flex-start; justify-content: center; padding: 24px 16px; overflow-y: auto; }
.crm-ms-scope .crm-modal.hidden { display: none; }
.crm-ms-scope .crm-modal-box { background: #fff; border-radius: 16px; width: 100%; max-width: 560px; margin-top: 24px; }
.crm-ms-scope .crm-modal-wide { max-width: 820px; }
.crm-ms-scope .crm-modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid #e2e8f0; font-weight: 700; }
.crm-ms-scope .crm-modal-close { font-size: 22px; line-height: 1; color: #94a3b8; background: none; border: none; cursor: pointer; }
.crm-ms-scope .crm-modal-body { padding: 18px 20px; }
.crm-ms-scope .crm-history-item { border-left: 3px solid #3b82f6; padding: 6px 10px; background: #f8fafc; border-radius: 0 8px 8px 0; }
