:root {
  --cw-bg-app: #0f172a;
  --cw-bg-shell: #f8fafc;
  --cw-bg-hero-start: #1c1a2f;
  --cw-bg-hero-end: #2d1b36;
  --cw-bg-card: #ffffff;
  --cw-text-main: #0f172a;
  --cw-text-muted: #64748b;
  --cw-text-inverse: #ffffff;
  --cw-border: #e2e8f0;
  --cw-primary: #2563eb;
  --cw-primary-hover: #1d4ed8;
  --cw-accent: #ff4d6d;
  --cw-accent-hover: #e03a58;
  --cw-status-fail: #ef4444;
  --cw-status-pass: #22c55e;
  --cw-status-manual: #f59e0b;
  --cw-radius-lg: 16px;
  --cw-radius-md: 12px;
  --cw-radius-sm: 8px;
  --cw-transition-fast: 0.18s ease-out;
  --cw-shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.2);
  --cw-shadow-md: 0 8px 18px -6px rgba(0, 0, 0, 0.2);
  --cw-shadow-soft: 0 4px 12px rgba(0, 0, 0, 0.15);
  --cw-tab-bg: rgba(15, 23, 42, 0.9);
  --cw-tab-border: rgba(148, 163, 184, 0.5);
}



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

html, body {
  font-family: "Poppins", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.cwAppBg {
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 20px 12px;
}

.cwShell {
  width: 100%;
  max-width: 1200px;
  background: var(--cw-bg-shell);
  border-radius: var(--cw-radius-lg);
  border: 1px solid var(--cw-border);
  box-shadow: var(--cw-shadow-lg);
  padding: 16px;
  position: relative;
  overflow: hidden;
}

/* ---------------------------------------------------
   Hero
   --------------------------------------------------- */
.cwHero {
  position: relative;
  border-radius: var(--cw-radius-md);
  padding: 24px 24px 22px;
  margin-bottom: 24px;
  color: var(--cw-text-inverse);
  background: linear-gradient(135deg, var(--cw-bg-hero-start), #1f2937 40%, var(--cw-bg-hero-end) 100%);
  box-shadow: var(--cw-shadow-md);
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow: hidden;
}

.cwHeroPattern {
  position: absolute;
  top: -45%;
  right: -10%;
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.12) 0%, rgba(0, 0, 0, 0) 70%);
  border-radius: 50%;
  pointer-events: none;
}

.cwHeroTop {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  z-index: 1;
}

.cwHeroLeft {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cwHeroRight {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.cwHeroBottom {
  position: relative;
  text-align: center;
  z-index: 1;
}

.cwHeroTitle {
  font-size: 32px !important;
  font-weight: 900 !important;
  color: #ffffff !important;
  text-shadow: 0 2px 14px rgba(0,0,0,0.55) !important;
  margin: 0 0 8px;
}

.cwHeroSubtitle {
  color: #e2e8f0 !important;
  margin: 0;
}

.cwHeroCta {
  position: relative;
  margin-top: 10px;
  padding: 16px 18px;
  border-radius: var(--cw-radius-md);
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  backdrop-filter: blur(6px);
  z-index: 1;
}

.cwHeroCtaText {
  font-size: 0.95rem;
  line-height: 1.5;
  color: #f9fafb;
  max-width: 640px;
}

.cwHeroBadge {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.14);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ---------------------------------------------------
   Buttons
   --------------------------------------------------- */
.cwBtnPrimary,
.cwBtnSecondary,
.cwBtnAccent,
.cwBtnGhost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--cw-radius-sm);
  border: 1px solid transparent;
  font-size: 0.83rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--cw-transition-fast), color var(--cw-transition-fast),
    box-shadow var(--cw-transition-fast), transform var(--cw-transition-fast), border-color var(--cw-transition-fast);
  white-space: nowrap;
}

.cwBtnPrimary {
  background-color: #ffffff;
  color: #091a56;
  box-shadow: var(--cw-shadow-soft);
}
.cwBtnPrimary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.2);
}

.cwBtnSecondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--cw-text-inverse);
  border-color: rgba(255, 255, 255, 0.25);
}
.cwBtnSecondary:hover {
  background: rgba(255, 255, 255, 0.16);
}

.cwBtnAccent {
  background: var(--cw-accent);
  color: var(--cw-text-inverse);
  border: none;
  box-shadow: 0 4px 12px rgba(255, 77, 109, 0.5);
}
.cwBtnAccent:hover {
  background: var(--cw-accent-hover);
  box-shadow: 0 6px 16px rgba(255, 77, 109, 0.65);
  transform: translateY(-1px);
}

.cwBtnGhost {
  background: #ffffff;
  color: var(--cw-text-muted);
  border-color: var(--cw-border);
}
.cwBtnGhost:hover {
  background: #f1f5f9;
}

.cwBtnIcon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.cwBtnIcon svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2.4;
  fill: none;
}

/* ---------------------------------------------------
   Tabs & Views
   --------------------------------------------------- */
.cwTabs {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.cwTab {
  min-width: 120px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--cw-tab-border);
  background: var(--cw-tab-bg);
  color: #cbd5f5;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color var(--cw-transition-fast), color var(--cw-transition-fast),
    border-color var(--cw-transition-fast), transform var(--cw-transition-fast);
}

.cwTab:hover {
  border-color: #e5e7eb;
  color: #ffffff;
}

/* Active tab: color depends on which tab it is */
#tabSummary.cwTabActive {
  background-color: #1d4ed8; /* keep existing blue */
  color: #ffffff;
}

#tabOverview.cwTabActive {
  background-color: #8C2929; /* Security tab */
  color: #ffffff;
}

#tabCompliance.cwTabActive {
  background-color: #086449; /* Compliance tab */
  color: #ffffff;
}

.cwView {
  margin-top: 10px;
}

.cwView.cwViewHidden {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  overflow: hidden !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
}

/* ---------------------------------------------------
   Modal
   --------------------------------------------------- */
.cwModal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}

.cwModalDialog {
  width: 100%;
  max-width: 440px;
  background: #ffffff;
  border-radius: 16px;
  padding: 26px 26px 24px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
}

.cwModalIcon {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: #eff6ff;
  color: #3b82f6;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}
.cwModalIcon svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.cwModalTitle {
  margin: 0 0 8px;
  font-size: 1.1rem;
  font-weight: 900;
  color: #0f172a;
  text-align: center;
}

.cwModalText {
  margin: 0 0 10px;
  font-size: 0.94rem;
  color: #475569;
  line-height: 1.55;
  text-align: center;
}

.cwModalActions {
  margin-top: 18px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

/* ---------------------------------------------------
   Summary View Elements
   --------------------------------------------------- */
.cwSummaryHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.cwSummaryHeader-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cwSummaryHeader-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--cw-text-main);
}
.cwSummaryHeader-sub {
  font-size: 0.85rem;
  color: var(--cw-text-muted);
  max-width: 600px;
}
.cwSummaryHeader-pill {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  background: linear-gradient(135deg, #0f172a, #1d4ed8);
  color: #ffffff;
  white-space: nowrap;
}

.cwSummaryGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 8px;
}

.cwSummaryCard {
  background-color: var(--cw-bg-card);
  border-radius: 10px;
  border: 1px solid var(--cw-border);
  padding: 12px 14px;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.06);
}

.cwSummaryLabel {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--cw-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.cwSummaryValue {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--cw-text-main);
}
.cwSummaryValue-critical { color: var(--cw-status-fail); }
.cwSummaryValue-high { color: #ea580c; }

.cwSummarySub {
  font-size: 0.75rem;
  color: var(--cw-text-muted);
  margin-top: 2px;
}

.cwSummaryList {
  margin: 6px 0 0;
  padding-left: 18px;
  font-size: 0.8rem;
  color: var(--cw-text-main);
}

.cwSummaryBody {
  font-size: 0.85rem;
  color: var(--cw-text-main);
  line-height: 1.5;
}

.cwSummaryEmphasis {
  font-weight: 800;
  color: var(--cw-status-fail);
}

.cwSummaryUpgradeHint {
  margin-top: 8px;
  font-size: 0.78rem;
  color: var(--cw-text-muted);
}

/* ---------------------------------------------------
   Compliance Frameworks Grid (Light Theme)
   --------------------------------------------------- */
.cwSummaryGrid-fw {
  display: grid;
  /* Changed from auto-fit to auto-fill */
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
  margin-top: 8px;
  min-height: 300px; 
}

@media (min-width: 1280px) {
  .cwSummaryGrid-fw {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

.cwSummaryCard-fw {
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  padding: 14px;
  color: #0f172a;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.cwSummaryCardHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.cwSummaryCardTitle {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.3;
}

.cwSummaryPill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.cwSummaryPill-good { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.cwSummaryPill-fair { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.cwSummaryPill-warn { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

.cwSummaryCardBarWrap {
  margin-top: 4px;
}

.cwSummaryCardBarLabel {
  display: block;
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 600;
  color: #475569;
}

.cwSummaryCardBarTrack {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}
.cwSummaryCardBarFill {
  height: 100%;
  border-radius: 999px;
}
.cwSummaryCardBarFill-good { background: #22c55e; }
.cwSummaryCardBarFill-fair { background: #f59e0b; }
.cwSummaryCardBarFill-bad  { background: #ef4444; }

.cwSummaryCardMetrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 12px;
}
.cwSummaryMetricLabel {
  display: block;
  font-size: 10px;
  color: #64748b;
  text-transform: uppercase;
  font-weight: 600;
}
.cwSummaryMetricValue {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
}

.cwSummaryCardFoot {
  margin: 10px 0 0;
  font-size: 11px;
  color: #64748b;
  line-height: 1.4;
}

.cwSummaryCardLink {
  margin-top: 12px;
  align-self: flex-start;
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #334155;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.cwSummaryCardLink:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}

/* ---------------------------------------------------
   Responsive overrides
   --------------------------------------------------- */
@media (max-width: 768px) {
  .cwShell { padding: 12px; }
  .cwHero { padding: 18px 16px 18px; }
  .cwHeroTitle { font-size: 1.55rem !important; }
  .cwHeroSubtitle { font-size: 0.9rem !important; }
  .cwHeroCta { flex-direction: column; align-items: flex-start; }
  .cwHeroCtaText { max-width: 100%; }
}

/* ---------------------------------------------------
   Framework Filter Dropdown
   --------------------------------------------------- */
.cwFwFilterWrap {
  position: relative;
  display: inline-block;
}

.cwFwFilterBtn {
  background: var(--cw-bg-alt);
  border: 1px solid var(--cw-border-dark);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--cw-text-main);
  cursor: pointer;
}

.cwFwFilterDropdown {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 4px;
  background: #ffffff;
  border: 1px solid var(--cw-border);
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.1);
  width: 280px;
  z-index: 100;
  max-height: 350px;
  overflow-y: auto;
}

.cwFwFilterHeader {
  display: flex;
  justify-content: space-between;
  padding: 8px 12px;
  background: #f8fafc;
  border-bottom: 1px solid var(--cw-border);
  position: sticky;
  top: 0;
}

.cwFwFilterList {
  padding: 8px 0;
}

.cwFwCheckbox {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  color: var(--cw-text-main);
  transition: background 0.1s;
}

.cwFwCheckbox:hover {
  background: #f1f5f9;
}

.cwFwCheckbox input {
  cursor: pointer;
}

.cwSummaryCard-critical {
  display:flex;
  flex-direction:column;
  background:#b91c1c;
  border-color:#fecdd3;
  color:#ffffff;
}

.cwSummaryCard-critical .cwSummaryLabel,
.cwSummaryCard-critical .cwSummarySub,
.cwSummaryCard-critical .cwSummaryBody {
  color:#fffbeb;
}

.cwSummaryCard-critical .cwSummaryValue-critical {
  color:#ffffff;
}

.cwSummaryCard-critical .cwCriticalList {
  margin:8px 0 0 0;
  padding-left:1.1rem;
  font-size:0.8rem;
  list-style-type:disc;
  list-style-position:inside;
  color:#ffffff;
}

.cwSummaryCard-critical .cwCriticalList li {
  margin-bottom:3px;
  color:#ffffff;
}

.cwSummaryCard button {
  cursor: pointer !important;
}

.cwScanStatus {
  margin: 8px 0 4px;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.cwScanStatus-idle {
  background: rgba(148, 163, 184, 0.16);
  color: #e5e7eb;
}

.cwScanStatus-running {
  background: rgba(234, 179, 8, 0.16);
  color: #facc15;
}

.cwScanStatus-complete {
  background: rgba(34, 197, 94, 0.16);
  color: #4ade80;
}

.cwScanStatus-failed {
  background: rgba(248, 113, 113, 0.16);
  color: #fca5a5;
}