/**
 * MSP Command Centre — restrained colour and depth (MSP-friendly blues / slate / teal).
 * Scoped so it only affects pages that use body.msp-cc-page.
 */

body.msp-cc-page {
  background: linear-gradient(168deg, #dce4ee 0%, #e8e6e2 42%, #ddd8d2 100%);
  color: #1c1917;
}

main#msp-main {
  isolation: isolate;
}

.msp-cc-shell {
  position: relative;
  background: linear-gradient(175deg, #ffffff 0%, #fafafa 55%, #f4f4f5 100%);
  border-color: #c8d4e4 !important;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.75) inset,
    0 18px 48px -14px rgba(15, 23, 42, 0.11),
    0 8px 20px -8px rgba(15, 23, 42, 0.06);
  overflow: hidden;
}

/* Thin brand accent rail — reads as product chrome, not loud */
.msp-cc-shell::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  background: linear-gradient(90deg, #2563eb 0%, #0d9488 48%, #4f46e5 100%);
  opacity: 0.92;
  pointer-events: none;
}

header.msp-cc-hero {
  border-bottom-color: rgba(148, 163, 184, 0.45) !important;
  padding-bottom: 1.15rem;
}

/* MSP identity chip — dark slate with cool highlight (SOC / NOC familiarity) */
.msp-cc-hero .msp-cc-brand-pill {
  border: 1px solid rgba(51, 65, 85, 0.35);
  background: linear-gradient(135deg, #1e3a5f 0%, #1e293b 55%, #0f172a 100%);
  color: #f1f5f9;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.12);
}

.msp-cc-hero .msp-cc-brand-pill i {
  color: #7dd3fc !important;
}

.msp-cc-hero h1 {
  letter-spacing: -0.02em;
  color: #0f172a;
}

/* Toolbar cluster next to Refresh */
.msp-cc-header-actions > .msp-cc-dashboard-cluster {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid rgba(148, 163, 184, 0.45);
  border-radius: 0.65rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

#msp-main .msp-cc-header-actions button#msp-refresh-btn {
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

#msp-main .msp-cc-header-actions button#msp-refresh-btn:hover:not(:disabled) {
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.3);
}

#msp-selected-client-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  background: rgba(241, 245, 249, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.35);
  color: #475569 !important;
  font-weight: 500;
}

/* Status strips */
#msp-connection-alert.msp-cc-banner--warn {
  border-color: rgba(245, 158, 11, 0.45);
  box-shadow: 0 6px 20px rgba(217, 119, 6, 0.08);
}

#msp-connection-ok-banner.msp-cc-banner--ok {
  border-color: rgba(16, 185, 129, 0.4);
  background: linear-gradient(95deg, #ecfdf5 0%, #f0fdf4 100%);
  box-shadow: 0 4px 16px rgba(5, 150, 105, 0.08);
}

#panel-brand-kit details summary {
  list-style: none;
}
#panel-brand-kit details summary::-webkit-details-marker {
  display: none;
}

/* Panel header + Brand Kit polish (MSP page) */
#panel-brand-kit .msp-bk-panel-head {
  background: linear-gradient(115deg, #f8fafc 0%, #eef2ff 45%, #faf5ff 100%);
  border-bottom: 1px solid rgba(199, 210, 254, 0.75);
}

#panel-brand-kit .msp-bk-panel-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.6rem;
  background: linear-gradient(145deg, #eef2ff 0%, #e0e7ff 100%);
  border: 1px solid rgba(129, 140, 248, 0.45);
  color: #4338ca;
  font-size: 14px;
}

/* Indigo save — Tailwind v2 CDN build often omits `violet-*`, so anchor primary action here */
#panel-brand-kit .msp-bk-save-btn {
  background: linear-gradient(180deg, #4f46e5 0%, #4338ca 100%);
  border-color: rgba(67, 56, 202, 0.85);
}
#panel-brand-kit .msp-bk-save-btn:hover:not(:disabled) {
  background: linear-gradient(180deg, #6366f1 0%, #4f46e5 100%);
}
#panel-brand-kit .msp-bk-save-btn:disabled {
  background: #c7d2fe !important;
  color: #312e81 !important;
  border-color: #a5b4fc !important;
  opacity: 1 !important;
  cursor: wait;
}

#panel-brand-kit .msp-bk-settings-card {
  position: relative;
  border-color: rgba(203, 213, 225, 0.95);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 8px 24px rgba(15, 23, 42, 0.05);
}
#panel-brand-kit .msp-bk-settings-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  border-radius: 0.65rem 0 0 0.65rem;
  background: linear-gradient(180deg, #6366f1 0%, #4f46e5 52%, #0d9488 100%);
  pointer-events: none;
}

#panel-brand-kit .msp-bk-logo-dropzone {
  border: 2px dashed rgba(148, 163, 184, 0.75);
  background: linear-gradient(160deg, #ffffff 0%, #f8fafc 100%);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
#panel-brand-kit .msp-bk-settings-card:focus-within .msp-bk-logo-dropzone {
  border-color: rgba(99, 102, 241, 0.55);
}

#panel-brand-kit .msp-bk-input:focus {
  border-color: rgba(129, 140, 248, 0.65);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
  outline: none;
}

#panel-brand-kit #brand-kit-client-select:focus {
  border-color: rgba(129, 140, 248, 0.65);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
  outline: none;
}

#brand-kit-preview-chip {
  background-color: #eef2ff;
  border: 1px solid #c7d2fe;
  color: #312e81;
}

#panel-brand-kit #brand-kit-client-access-intro {
  border-color: rgba(165, 180, 252, 0.8) !important;
  box-shadow: 0 4px 16px rgba(67, 56, 202, 0.07);
}

#panel-brand-kit .msp-bk-intro-callout {
  box-shadow: 0 2px 8px rgba(30, 27, 75, 0.05);
}

#panel-brand-kit .msp-bk-preview-wrap {
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.92) inset,
    0 6px 20px rgba(15, 23, 42, 0.04);
}

#panel-brand-kit .msp-bk-preview-logo-shell {
  box-shadow: inset 0 1px 3px rgba(15, 23, 42, 0.05);
}

#panel-brand-kit details.msp-bk-checklist[open] summary span.ml-auto {
  opacity: 0.7;
}

/* Section chrome — panel outer + live preview card */
#panel-brand-kit #brand-kit-preview-card {
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.85) inset,
    0 10px 28px rgba(15, 23, 42, 0.06);
  border-color: rgba(148, 163, 184, 0.25);
}

#panel-team > div:first-of-type {
  background: linear-gradient(110deg, #f8fafc 0%, #ecfdf5 40%, #f0fdfa 100%);
  border-bottom: 1px solid rgba(153, 246, 228, 0.85);
}

#panel-brand-kit.rounded-xl,
#panel-team.rounded-xl {
  border-color: rgba(148, 163, 184, 0.35);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.85) inset,
    0 12px 32px rgba(15, 23, 42, 0.07);
}


#panel-brand-kit .rounded-xl.border.border-blue-200,
#panel-team .rounded-xl.border.border-blue-200 {
  border-color: rgba(96, 165, 250, 0.5) !important;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.06);
}

#panel-brand-kit .rounded-xl.border.border-stone-200.bg-stone-50,
#panel-team .rounded-xl.border.border-stone-200.bg-stone-50 {
  background: rgba(248, 250, 252, 0.9) !important;
  border-color: rgba(203, 213, 225, 0.7) !important;
}

/*
 * Inline “More detail / How it works” triggers openMetricsHelp (deferred when Halo/matrix tutorials are off).
 * Hides them so tiles stay clean; expands when flag is removed in JS.
 */
body.msp-cc-page.msp-cc-hide-metric-tutorials button[data-metrics-help] {
  display: none !important;
}

/* Collapsible help blocks — visible “Expand” cue (matches Brand Kit checklist). */
body.msp-cc-page .msp-details-summary,
body.msp-cc-page .ccp-details-summary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  list-style: none;
  cursor: pointer;
}

body.msp-cc-page .msp-details-summary::-webkit-details-marker,
body.msp-cc-page .ccp-details-summary::-webkit-details-marker {
  display: none;
}

body.msp-cc-page .msp-details-expand,
body.msp-cc-page .ccp-details-expand {
  margin-left: auto;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  opacity: 0.88;
  flex-shrink: 0;
}

/* ── MSP portfolio / risk watchlist — restrained, readable ─────────────── */
body.msp-cc-page #msp-main .msp-watchlist-thead {
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset;
}

body.msp-cc-page #msp-main tr.msp-watchlist-row {
  border-bottom: 1px solid #f1f5f9;
}

body.msp-cc-page #msp-main tr.msp-watchlist-row:nth-child(even) {
  background-color: #fafafa;
}

body.msp-cc-page #msp-main tr.msp-watchlist-row:hover {
  background-color: #f1f5f9;
}

body.msp-cc-page #msp-main tr.msp-watchlist-row--selected {
  background-color: #eff6ff;
  box-shadow: inset 2px 0 0 #1d4ed8;
}

body.msp-cc-page #msp-main .mspWl-client {
  font-weight: 600;
  color: #0f172a;
  letter-spacing: -0.01em;
}

/* Billing / tier — bordered chips, solid contrast on white rows */
body.msp-cc-page #msp-main .mspWl-badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.25;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid transparent;
}

body.msp-cc-page #msp-main .mspWl-badge--paid {
  color: #064e3b;
  background: #d1fae5;
  border-color: #34d399;
}

body.msp-cc-page #msp-main .mspWl-badge--trial {
  color: #334155;
  background: #f1f5f9;
  border-color: #cbd5e1;
}

body.msp-cc-page #msp-main .mspWl-tier {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.25;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid transparent;
}

body.msp-cc-page #msp-main .mspWl-tier--high {
  color: #7f1d1d;
  background: #fee2e2;
  border-color: #fca5a5;
}

body.msp-cc-page #msp-main .mspWl-tier--medium {
  color: #92400e;
  background: #fef3c7;
  border-color: #fcd34d;
}

body.msp-cc-page #msp-main .mspWl-tier--low {
  color: #14532d;
  background: #dcfce7;
  border-color: #86efac;
}

/* Posture score — typography-led, no “pill armour” */
body.msp-cc-page #msp-main .mspWl-score {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 0.9375rem;
  color: #0f172a;
}

body.msp-cc-page #msp-main .mspWl-score--strong {
  color: #047857;
}

body.msp-cc-page #msp-main .mspWl-score--mid {
  color: #a16207;
}

body.msp-cc-page #msp-main .mspWl-score--weak {
  color: #b91c1c;
}

/* Workplace column — dot + sentence case label */
body.msp-cc-page #msp-main .mspWl-ws {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 11px;
  font-weight: 600;
  color: #0f172a;
}

body.msp-cc-page #msp-main .mspWl-dot {
  width: 6px;
  height: 6px;
  border-radius: 9999px;
  flex-shrink: 0;
  background: #94a3b8;
}

body.msp-cc-page #msp-main .mspWl-ws--ok .mspWl-dot {
  background: #059669;
  box-shadow: 0 0 0 2px rgba(5, 150, 105, 0.2);
}

body.msp-cc-page #msp-main .mspWl-ws--need .mspWl-dot {
  background: #d97706;
  box-shadow: 0 0 0 2px rgba(217, 119, 6, 0.2);
}

body.msp-cc-page #msp-main .mspWl-ws--need {
  color: #92400e;
}

/* Narrative cue under status column */
body.msp-cc-page #msp-main .mspWl-note {
  display: inline-block;
  font-size: 11px;
  line-height: 1.35;
  font-weight: 500;
  color: #475569;
  max-width: 14rem;
}

body.msp-cc-page #msp-main .mspWl-note--risk {
  color: #7f1d1d;
}

body.msp-cc-page #msp-main .mspWl-note--watch {
  color: #92400e;
}

body.msp-cc-page #msp-main .mspWl-note--ok {
  color: #166534;
}

/* Row buttons — flat primary, ghost secondary */
body.msp-cc-page #msp-main .mspWl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.65rem;
  font-size: 11px;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid transparent;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

body.msp-cc-page #msp-main .mspWl-btn--primary {
  background: #2563eb;
  color: #fff;
  border-color: #1d4ed8;
}

body.msp-cc-page #msp-main .mspWl-btn--primary:hover {
  background: #1d4ed8;
}

body.msp-cc-page #msp-main .mspWl-btn--ghost {
  background: #fff;
  color: #1e293b;
  border-color: #e2e8f0;
}

body.msp-cc-page #msp-main .mspWl-btn--ghost:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
}

body.msp-cc-page #msp-main .mspWl-btn-upgrade {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.65rem;
  font-size: 11px;
  font-weight: 600;
  border-radius: 6px;
  background: #fff;
  color: #047857;
  border: 1px solid #6ee7b7;
}

body.msp-cc-page #msp-main .msp-brand-mirror-card {
  position: relative;
  border-color: rgb(226 232 240) !important;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.92) inset,
    0 4px 18px rgba(15, 23, 42, 0.05);
}

body.msp-cc-page #msp-main .msp-brand-mirror-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  border-radius: 0.65rem 0 0 0.65rem;
  background: linear-gradient(180deg, #6366f1 0%, #4f46e5 52%, #0d9488 100%);
  pointer-events: none;
}

body.msp-cc-page #msp-main .msp-brand-mirror-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.5rem;
  background: linear-gradient(145deg, #eef2ff 0%, #e0e7ff 100%);
  border: 1px solid rgba(129, 140, 248, 0.45);
  color: #4338ca;
  font-size: 13px;
}

body.msp-cc-page #msp-main .msp-brand-mirror-field {
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

body.msp-cc-page #msp-main .msp-brand-mirror-card:hover .msp-brand-mirror-field {
  border-color: rgba(148, 163, 184, 0.55);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

body.msp-cc-page #msp-main .msp-brand-mirror-dd--empty {
  font-style: italic;
  font-weight: 500 !important;
  color: #64748b !important;
}

body.msp-cc-page #msp-main .msp-brand-mirror-dd:not(.msp-brand-mirror-dd--empty) {
  color: #0f172a;
}

body.msp-cc-page #msp-main a.msp-brand-mirror-link {
  color: #2563eb;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

body.msp-cc-page #msp-main a.msp-brand-mirror-link:hover {
  color: #1d4ed8;
}

body.msp-cc-page #msp-main .msp-brand-mirror-cta {
  transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
}

body.msp-cc-page #msp-main .msp-brand-mirror-cta:hover {
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.25);
}
