@scope (#original-content) {

/* ===== RESET & SCOPE ===== */
#pm-page *, #pm-page *::before, #pm-page *::after { box-sizing: border-box; margin: 0; padding: 0; }
#pm-page {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: #ffffff;
  color: #1a1a2e;
  line-height: 1.75;
  max-width: 980px;
  margin: 0 auto;
  padding: 0 16px 56px;
}

/* ===== HEADER ===== */
#pm-page .pm-header {
  text-align: center;
  padding: 40px 20px 32px;
  border-bottom: 3px solid #16a34a;
  margin-bottom: 28px;
}
#pm-page .pm-header h1 {
  font-size: clamp(1.7rem, 4vw, 2.5rem);
  font-weight: 900;
  color: #166534;
  letter-spacing: -0.5px;
  line-height: 1.2;
  margin-bottom: 10px;
}
#pm-page .pm-header p.subtitle {
  font-size: 1.05rem;
  color: #374151;
  font-weight: 600;
  max-width: 700px;
  margin: 0 auto 16px;
}
#pm-page .badge-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
#pm-page .badge {
  background: #f0fdf4;
  border: 1.5px solid #16a34a;
  color: #15803d;
  font-size: 0.77rem;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ===== TOC ===== */
#pm-page .pm-toc {
  background: #f8fafc;
  border-left: 4px solid #16a34a;
  border-radius: 0 8px 8px 0;
  padding: 18px 22px;
  margin-bottom: 30px;
}
#pm-page .pm-toc h2 { font-size: 0.88rem; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; color: #166534; margin-bottom: 10px; }
#pm-page .pm-toc ol { padding-left: 20px; font-weight: 600; }
#pm-page .pm-toc li { margin-bottom: 5px; font-size: 0.92rem; }
#pm-page .pm-toc a { color: #16a34a; text-decoration: none; }
#pm-page .pm-toc a:hover { text-decoration: underline; color: #15803d; }

/* ===== SECTION FORMATTING ===== */
#pm-page .pm-section {
  background: #fff;
  border: 1.5px solid #e5e7eb;
  border-radius: 12px;
  padding: 28px 30px;
  margin-bottom: 28px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.02);
}
#pm-page .pm-section h2 {
  font-size: 1.45rem;
  font-weight: 900;
  color: #166534;
  border-bottom: 2.5px solid #16a34a;
  padding-bottom: 10px;
  margin-bottom: 18px;
}
#pm-page .pm-section h3 { font-size: 1.2rem; font-weight: 800; color: #15803d; margin: 24px 0 12px; }
#pm-page .pm-section p { font-size: 0.98rem; font-weight: 500; color: #1f2937; margin-bottom: 16px; }
#pm-page .pm-section ul, #pm-page .pm-section ol { padding-left: 22px; margin-bottom: 16px; font-weight: 500; }
#pm-page .pm-section li { margin-bottom: 8px; color: #1f2937;}

#pm-page .info-box { background: #f0fdfa; border-left: 4px solid #0d9488; border-radius: 0 8px 8px 0; padding: 14px 18px; margin: 16px 0; font-weight: 600; color: #0f766e; }
#pm-page .warn-box { background: #fffbeb; border-left: 4px solid #d97706; border-radius: 0 8px 8px 0; padding: 14px 18px; margin: 16px 0; font-weight: 600; color: #b45309; }

/* ===== MATH BLOCKS ===== */
#pm-page .math-block {
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  padding: 16px 22px;
  margin: 16px 0;
  text-align: center;
  overflow-x: auto;
  font-size: 1.05rem;
  line-height: 1.8;
}
#pm-page .math-block .label {
  display: block;
  font-size: 0.8rem;
  font-weight: 800;
  color: #6b7280;
  text-align: left;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ===== MATHJAX WORDPRESS GUARDS ===== */
/* Prevent MathJax blocks from breaking mobile layouts */
#pm-page mjx-container {
  display: inline-block !important;
  max-width: 100% !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  vertical-align: middle !important;
  padding-bottom: 2px;
}
#pm-page mjx-container[display="true"] { 
  display: block !important; 
  margin: 15px auto !important; 
  text-align: center !important; 
}
/* Revert any aggressive WordPress SVG resets */
#pm-page mjx-container svg { 
  max-width: none !important; 
  max-height: none !important; 
  /* DO NOT set width/height here; let MathJax inline styles govern aspect ratio */
}

/* ===== TABLES ===== */
#pm-page .pm-table-wrap { overflow-x: auto; margin: 20px 0; border: 1.5px solid #e5e7eb; border-radius: 8px; }
#pm-page .pm-table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
#pm-page .pm-table th { background: #f0fdf4; color: #166534; padding: 12px 16px; text-align: left; font-weight: 800; border-bottom: 2px solid #16a34a; }
#pm-page .pm-table td { padding: 10px 16px; border-bottom: 1px solid #e5e7eb; font-weight: 500; color: #1f2937; }
#pm-page .pm-table tr:nth-child(even) td { background: #fafafa; }

/* ===== CALCULATOR WIDGET ===== */
#pm-page .widget-container {
  background: #f8fafc;
  border: 1.5px solid #e5e7eb;
  border-radius: 12px;
  padding: 28px;
  margin-bottom: 20px;
}
#pm-page .widget-row { display: flex; flex-wrap: wrap; gap: 20px; }
#pm-page .widget-col { flex: 1; min-width: 250px; }

#pm-page .input-group { margin-bottom: 16px; }
#pm-page .input-label { display: flex; justify-content: space-between; font-weight: 800; font-size: 0.95rem; color: #1e293b; margin-bottom: 6px; }
#pm-page .input-optional { font-weight: 600; font-size: 0.8rem; color: #64748b; }
#pm-page .input-field {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid #cbd5e1;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  background: #fff;
  transition: all 0.2s;
}
#pm-page .input-field:focus { border-color: #16a34a; outline: none; box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.2); }

#pm-page .btn-group { display: flex; gap: 12px; margin-top: 24px; }
#pm-page .pm-btn {
  flex: 1;
  padding: 12px 20px;
  font-size: 1rem;
  font-weight: 800;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.1s, background 0.2s;
}
#pm-page .pm-btn-primary { background: #16a34a; color: #fff; }
#pm-page .pm-btn-primary:hover { background: #15803d; transform: translateY(-1px); }
#pm-page .pm-btn-danger { background: #e2e8f0; color: #475569; }
#pm-page .pm-btn-danger:hover { background: #cbd5e1; }

#pm-page .results-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-top: 24px; display: none; }
#pm-page .res-card { padding: 20px; border-radius: 10px; border-top: 4px solid; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,0.04); text-align: center; }
#pm-page .res-gross { border-color: #16a34a; }
#pm-page .res-operating { border-color: #0284c7; }
#pm-page .res-net { border-color: #7e22ce; }
#pm-page .res-title { font-size: 1.05rem; font-weight: 900; color: #1e293b; margin-bottom: 8px; }
#pm-page .res-formula-text { font-size: 0.8rem; font-weight: 700; color: #64748b; margin-bottom: 12px; font-family: monospace; }
#pm-page .res-profit { font-size: 1.1rem; font-weight: 800; color: #334155; margin-bottom: 4px; }
#pm-page .res-margin { font-size: 2.2rem; font-weight: 900; }
#pm-page .res-margin.c-gross { color: #16a34a; }
#pm-page .res-margin.c-op { color: #0284c7; }
#pm-page .res-margin.c-net { color: #7e22ce; }

#pm-page .pm-toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(100px); background: #1e293b; color: #fff; padding: 12px 24px; border-radius: 8px; font-weight: 700; font-size: 0.95rem; opacity: 0; transition: all 0.3s ease; z-index: 9999; box-shadow: 0 4px 15px rgba(0,0,0,0.15); pointer-events: none; }
#pm-page .pm-toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* ===== FAQ ===== */
#pm-page .faq-item { border: 1.5px solid #e5e7eb; border-radius: 8px; margin-bottom: 10px; overflow: hidden; }
#pm-page .faq-q { background: #f8fafc; padding: 14px 20px; font-weight: 800; font-size: 1rem; color: #166534; cursor: pointer; display: flex; justify-content: space-between; align-items: center; user-select: none; }
#pm-page .faq-q::after { content: '+'; font-size: 1.4rem; font-weight: 900; color: #16a34a; }
#pm-page .faq-item.open .faq-q::after { content: '−'; }
#pm-page .faq-a { display: none; padding: 16px 20px; font-size: 0.95rem; font-weight: 500; color: #374151; border-top: 1px solid #e5e7eb; background: #fff; }
#pm-page .faq-item.open .faq-a { display: block; }

/* ===== FOOTER ===== */
#pm-page .pm-footer { text-align: center; padding: 30px 20px; border-top: 2px solid #e5e7eb; margin-top: 40px; font-size: 0.9rem; color: #6b7280; font-weight: 600; }
#pm-page .pm-footer a { color: #16a34a; text-decoration: none; font-weight: 800; }

@media (max-width: 600px) {
  #pm-page .pm-section { padding: 20px 16px; }
  #pm-page .btn-group { flex-direction: column; }
}

}
