/* =========================
   CALCULATOR + RESULTS LAYOUT
========================= */

.calculator-layout {
  display: grid;
  grid-template-columns: 1fr 0.9fr;
  gap: 2rem;
  align-items: start;
}

/* =========================
   CALCULATOR CARD
========================= */

.calculator-box {
  padding: 1.5rem;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.06);
}

/* =========================
   FORM
========================= */

.calculator-form {
  display: grid;
  gap: 1.1rem;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-field label {
  font-size: 0.85rem;
  font-weight: 500;
  color: #374151;
}

.form-field input {
  padding: 0.65rem 0.75rem;
  font-size: 0.95rem;
  border-radius: 10px;
  border: 1px solid #d1d5db;
}

.form-field input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

/* =========================
   BUTTON
========================= */

.primary-btn {
  margin-top: 0.75rem;
  padding: 0.7rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  background: #2563eb;
  color: #ffffff;
}

.primary-btn:hover {
  background: #1e4ed8;
}

/* =========================
   RESULTS CARD
========================= */

.calculator-results {
  padding: 1.4rem 1.5rem;
  background: #f8fafc;
  border-radius: 16px;
  border: 1px solid #e5e7eb;
  height: fit-content;
}

.calculator-results h2 {
  font-size: 1.15rem;
  margin-bottom: 1rem;
}

.results-grid {
  display: grid;
  gap: 1rem;
}

.result-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.result-label {
  font-size: 0.85rem;
  color: #475569;
}

.result-item strong {
  font-size: 1rem;
  font-weight: 600;
  color: #020617;
}

/* =========================
   CHART
========================= */

.chart-wrapper {
  margin-top: 1.2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.chart-legend {
  display: flex;
  gap: 1.2rem;
  font-size: 0.85rem;
  color: #374151;
}

.legend-box {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 6px;
  display: inline-block;
}

.legend-box.principal {
  background: #2563eb;
}

.legend-box.interest {
  background: #ef4444;
}

/* =========================
   ARTICLE
========================= */

.content-article {
  width: 90%;
  max-width: 1100px;
  margin-top: 3.5rem;
  line-height: 1.8;
  color: #1f2937;
}

.content-article h2 {
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
}

.content-article h3 {
  font-size: 1.1rem;
  margin-top: 1.8rem;
  margin-bottom: 0.4rem;
}

.content-article p {
  font-size: 0.96rem;
  color: #374151;
}

/* =========================
   OVERLAY (PDF SAFE)
========================= */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 1000;
}

.schedule-panel {
  background: #ffffff;
  width: 85%;
  max-width: 1100px;
  margin: 4vh auto;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}

/* Header (not in PDF capture) */
.panel-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Scroll container */
.panel-body {
  overflow-y: auto;
  max-height: 65vh;
  padding: 0;
}

/* PDF content wrapper */
#pdfContent {
  padding: 1.25rem;
}

/* Summary */
.schedule-summary {
  background: #f8fafc;
  padding: 1rem;
  border-radius: 12px;
  margin-bottom: 1rem;
}

/* Table */
.schedule-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.schedule-table th,
.schedule-table td {
  padding: 10px;
  font-size: 14px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
}

/* Sticky header (no gap bleed) */
.schedule-table thead th {
  /* position: sticky;
  top: 0; */
  position: static;
  background: #ffffff;
  z-index: 5;
  box-shadow: inset 0 -1px 0 #e5e7eb;
}

/* Footer buttons */
.panel-actions {
  padding: 1rem 1.25rem;
  border-top: 1px solid #e5e7eb;
  display: flex;
  gap: 1rem;
}

/* =========================
   MOBILE FIXES
========================= */

@media (max-width: 900px) {

  .calculator-layout {
    grid-template-columns: 1fr;
  }

  .calculator-results {
    width: 100%;
  }

  /* Stack results + chart */
  .calculator-results > div {
    display: flex !important;
    flex-direction: column;
    gap: 1.2rem;
  }

  .results-grid {
    gap: 0.75rem;
  }

  .result-item {
    align-items: flex-start;
  }

  .chart-wrapper canvas {
    width: 180px !important;
    height: 180px !important;
  }

  .chart-legend {
    justify-content: center;
    font-size: 0.8rem;
  }

  #openScheduleBtn {
    width: 100%;
  }

  .content-article {
    width: 100%;
  }
}

@media (max-width: 768px) {

  .schedule-panel {
    width: 100%;
    height: 100vh;
    max-height: 100vh;
    margin: 0;
    border-radius: 0;
  }

  .panel-header {
    position: sticky;
    top: 0;
    background: #ffffff;
    z-index: 20;
  }

  .panel-body {
    max-height: calc(100vh - 120px);
    overflow-x: auto;
  }

  #pdfContent {
    padding: 1rem;
  }

  .schedule-summary {
    font-size: 0.9rem;
    display: grid;
    gap: 0.5rem;
  }

  .schedule-table {
    min-width: 720px;
    font-size: 13px;
  }

  .schedule-table th,
  .schedule-table td {
    padding: 8px 6px;
    white-space: nowrap;
  }

  .panel-actions {
    position: sticky;
    bottom: 0;
    background: #ffffff;
    z-index: 30;
  }
}

/* =========================
   SELECT / DROPDOWN (EMI-LIKE)
========================= */
.calculator-form select {
  width: 100%;
  height: 48px;
  padding: 0.55rem 0.75rem;
  font-size: 0.95rem;
  line-height: 1.4;
  border-radius: 10px;
  border: 1px solid #cbd5f5;
  background-color: #dfe4ea;
  color: #0f172a;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  cursor: pointer;

  /* Custom arrow */
  background-image:
    linear-gradient(45deg, transparent 50%, #64748b 50%),
    linear-gradient(135deg, #64748b 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 19px,
    calc(100% - 12px) 19px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

/* Hover */
.calculator-form select:hover {
  border-color: #2563eb;
}

/* Focus (keyboard + click) */
.calculator-form select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* Disabled (future-proof) */
.calculator-form select:disabled {
  background-color: #f1f5f9;
  color: #94a3b8;
  cursor: not-allowed;
}

/* =========================
   QubeTools – MODERN CALCULATOR SKELETON
========================= */

.calculator-results {
  position: relative;
  overflow: hidden;
  background: #f8fafc;
}

/* Hide real content */
.calculator-results.is-loading * {
  visibility: hidden;
}

/* Skeleton overlay */
.calculator-results.is-loading::after {
  content: "";
  position: absolute;
  inset: 1.4rem 1.5rem;
  border-radius: 14px;
  z-index: 20;
  pointer-events: none;

  background:
    /* shimmer sweep */
    linear-gradient(
      110deg,
      rgba(79,108,255,0) 40%,
      rgba(79,108,255,0.18) 50%,
      rgba(79,108,255,0) 60%
    ),

    /* result rows */
    linear-gradient(#e6ebff 0 0) 0 0 / 100% 18px,
    linear-gradient(#e6ebff 0 0) 0 36px / 100% 18px,
    linear-gradient(#e6ebff 0 0) 0 72px / 100% 18px,

    /* action button */
    linear-gradient(#dfe6ff 0 0) 0 112px / 100% 44px,

    /* chart ring */
    radial-gradient(circle, #dfe6ff 98%, transparent 100%)
      right 40px / 220px 220px;

  background-repeat: no-repeat;
  background-size:
    220% 100%,
    100% 18px,
    100% 18px,
    100% 18px,
    100% 44px,
    220px 220px;

  animation:
    QubeTools-calculator-shimmer 1.6s linear infinite,
    QubeTools-calculator-breathe 2.4s ease-in-out infinite;
}

/* Shimmer motion */
@keyframes QubeTools-calculator-shimmer {
  0% {
    background-position:
      -120% 0,
      0 0,
      0 36px,
      0 72px,
      0 112px,
      right 40px;
  }
  100% {
    background-position:
      120% 0,
      0 0,
      0 36px,
      0 72px,
      0 112px,
      right 40px;
  }
}

/* Soft pulse */
@keyframes QubeTools-calculator-breathe {
  0%   { opacity: 0.85; }
  50%  { opacity: 1; }
  100% { opacity: 0.85; }
}

/* Mobile refinement */
@media (max-width: 900px) {
  .calculator-results.is-loading::after {
    background:
      linear-gradient(
        110deg,
        rgba(79,108,255,0) 40%,
        rgba(79,108,255,0.18) 50%,
        rgba(79,108,255,0) 60%
      ),
      linear-gradient(#e6ebff 0 0) 0 0 / 100% 16px,
      linear-gradient(#e6ebff 0 0) 0 32px / 100% 16px,
      linear-gradient(#dfe6ff 0 0) 0 72px / 100% 42px,
      radial-gradient(circle, #dfe6ff 98%, transparent 100%)
        center 120px / 180px 180px;

    background-size:
      220% 100%,
      100% 16px,
      100% 16px,
      100% 42px,
      180px 180px;
  }
}
/* =========================
   OVERLAY
========================= */

.overlay {
position: fixed;
inset: 0;
background: rgba(0,0,0,0.55);
z-index: 9999;
display: flex;
justify-content: flex-end;
}

.overlay.hidden {
display: none;
}

.schedule-panel {
width: 75%;
max-width: 1100px;
height: 100%;
background: #ffffff;
padding: 1.5rem 1.7rem;
overflow-y: auto;
box-shadow: -20px 0 50px rgba(0,0,0,0.25);
}

.panel-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 1rem;
}

.close-btn {
border: none;
background: #ef4444;
color: #fff;
font-size: 1.1rem;
padding: 0.35rem 0.7rem;
border-radius: 8px;
cursor: pointer;
}

/* =========================
   PRELOADER
========================= */
#page-preloader {
  position: fixed;
  inset: 0;
  background: #ffffff;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* =========================
   FORM GRID (NO SCROLL)
========================= */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
}

@media (max-width: 640px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

/* =========================
   DROPDOWN
========================= */
.calculator-form select {
  width: 100%;
  height: 48px;
  padding: 0.55rem 0.75rem;
  font-size: 0.95rem;
  border-radius: 10px;
  border: 1px solid #cbd5f5;
  background-color: #ffffff;
  appearance: none;
  cursor: pointer;
  background-image:
    linear-gradient(45deg, transparent 50%, #64748b 50%),
    linear-gradient(135deg, #64748b 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 20px,
    calc(100% - 12px) 20px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

/* =========================
   OVERLAY
========================= */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 9999;
  display: flex;
  justify-content: flex-end;
}

.overlay.hidden {
  display: none;
}

.schedule-panel {
  width: 75%;
  max-width: 1100px;
  height: 100%;
  background: #ffffff;
  padding: 1.5rem 1.7rem;
  overflow-y: auto;
  box-shadow: -20px 0 50px rgba(0,0,0,0.25);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.close-btn {
  border: none;
  background: #ef4444;
  color: #fff;
  font-size: 1.1rem;
  padding: 0.35rem 0.7rem;
  border-radius: 8px;
  cursor: pointer;
}

/* =========================
   TABLE (STATIC THEAD)
========================= */
.schedule-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  font-size: 0.9rem;
}

.schedule-table th,
.schedule-table td {
  padding: 0.6rem 0.7rem;
  border-bottom: 1px solid #e5e7eb;
  text-align: right;
}

.schedule-table th:first-child,
.schedule-table td:first-child {
  text-align: center;
}

.schedule-table thead {
  background: #f8fafc;
  position: static;
}

.schedule-table tbody tr:hover {
  background: #f1f5f9;
}

/* =========================
   CHART
========================= */
.chart-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 1.5rem;
}

.chart-legend {
  display: flex;
  gap: 1.2rem;
  margin-top: 0.75rem;
  font-size: 0.85rem;
}

.legend-box {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
  margin-right: 0.35rem;
}

.legend-box.principal {
  background: #2563eb;
}

.legend-box.interest {
  background: #ef4444;
}

/* =========================
   OVERLAY BUTTONS
========================= */
.panel-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.2rem;
}

.panel-actions .primary-btn {
  width: fit-content;
  padding: 0.55rem 1.2rem;
}
/* =========================
   SCHEDULE PANEL IMPROVEMENT
========================= */

.schedule-panel {
  width: 75%;
  max-width: 1100px;
  height: 100%;
  background: #ffffff;
  padding: 0;
  display: flex;
  flex-direction: column;
  box-shadow: -20px 0 60px rgba(0,0,0,0.25);
}

/* HEADER */
.panel-header {
  padding: 1.2rem 1.6rem;
  border-bottom: 1px solid #e5e7eb;
  background: #ffffff;
  position: sticky;
  top: 0;
  z-index: 20;
}

.panel-header h2 {
  font-size: 1.2rem;
  font-weight: 600;
}

/* CLOSE BUTTON */
.close-btn {
  border: none;
  background: #ef4444;
  color: #ffffff;
  font-size: 1rem;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.close-btn:hover {
  background: #dc2626;
}

/* CONTENT AREA */
#pdfContent {
  flex: 1;
  overflow-y: auto;
  padding: 1.4rem 1.6rem;
}

/* =========================
   TABLE DESIGN
========================= */

.schedule-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

/* HEADER */
.schedule-table thead {
  background: #f8fafc;
}

.schedule-table thead th {
  text-align: right;
  padding: 0.75rem 0.6rem;
  font-weight: 600;
  border-bottom: 2px solid #e5e7eb;
}

.schedule-table thead th:first-child {
  text-align: center;
}

/* BODY */
.schedule-table tbody td {
  padding: 0.75rem 0.6rem;
  border-bottom: 1px solid #e5e7eb;
  text-align: right;
  color: #334155;
}

.schedule-table tbody td:first-child {
  text-align: center;
  font-weight: 500;
}

/* ROW HOVER */
.schedule-table tbody tr:hover {
  background: #f1f5f9;
}

/* STRIPES */
.schedule-table tbody tr:nth-child(even) {
  background: #fafafa;
}

/* =========================
   ACTION BAR
========================= */

.panel-actions {
  padding: 1.2rem 1.6rem;
  border-top: 1px solid #e5e7eb;
  display: flex;
  gap: 0.8rem;
  justify-content: flex-start;
  background: #ffffff;
  position: sticky;
  bottom: 0;
}

/* BUTTONS */
.panel-actions .primary-btn {
  padding: 0.55rem 1.3rem;
  border-radius: 10px;
  font-size: 0.9rem;
}

/* =========================
   MOBILE
========================= */

@media (max-width: 900px) {

  .schedule-panel {
    width: 100%;
  }

  #pdfContent {
    padding: 1rem;
  }

  .schedule-table {
    font-size: 0.85rem;
  }

  .panel-actions {
    justify-content: space-between;
  }

}
/* =========================
   SCHEDULE TABLE ALIGNMENT
========================= */

.schedule-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  font-size: 0.95rem;
}

.schedule-table th,
.schedule-table td {
  text-align: center;
  padding: 10px 8px;
  border-bottom: 1px solid #e5e7eb;
}

.schedule-table thead {
  background: #f8fafc;
}

.schedule-table tbody tr:nth-child(even) {
  background: #fafafa;
}

.schedule-table tbody tr:hover {
  background: #f1f5f9;
}

/* =========================
   PDF STRUCTURE
========================= */

#pdfContent {
  padding: 20px;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

.pdf-header {
  text-align: center;
  margin-bottom: 16px;
}

.pdf-header h2 {
  margin: 0;
  font-size: 20px;
}

.pdf-header p {
  font-size: 13px;
  color: #555;
  margin-top: 6px;
}

.pdf-footer {
  margin-top: 16px;
  text-align: center;
  font-size: 12px;
  color: #666;
}
.input-error{
border-color:#ef4444;
box-shadow:0 0 0 2px rgba(239,68,68,.15);
}

/* ==================================================
   Production Calculator Surface
================================================== */

.page-content > .section:first-child {
  margin-top: 0 !important;
}

.page-content > .section:first-child .section-header {
  position: relative;
  overflow: hidden;
  max-width: none !important;
  padding: clamp(24px, 4vw, 38px);
  border: 1px solid #dfe7f2;
  border-radius: 24px;
  background:
    radial-gradient(520px 220px at 100% 0%, rgba(15, 118, 110, 0.12), transparent 72%),
    radial-gradient(480px 220px at 0% 100%, rgba(37, 99, 235, 0.12), transparent 72%),
    linear-gradient(180deg, rgba(255,255,255,0.96), rgba(248,251,255,0.9));
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.08);
}

.page-content > .section:first-child .section-header::before {
  content: "Calculator";
  display: inline-flex;
  width: fit-content;
  margin-bottom: 12px;
  padding: 6px 10px;
  border: 1px solid #cbe2df;
  border-radius: 999px;
  background: #eefbf8;
  color: #0f5f59;
  font-size: 0.74rem;
  line-height: 1;
  font-weight: 820;
  text-transform: uppercase;
}

.page-content > .section:first-child .section-header h1 {
  max-width: 780px;
  font-size: 2.5rem !important;
  line-height: 1.04 !important;
}

.page-content > .section:first-child .section-header p {
  max-width: 760px;
  color: #5d6b82 !important;
  font-size: clamp(0.98rem, 1.8vw, 1.12rem) !important;
}

.calculator-layout {
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr) !important;
  gap: 18px !important;
  align-items: stretch !important;
}

.calculator-box,
.calculator-results {
  min-width: 0;
  padding: clamp(18px, 2.6vw, 24px) !important;
  border: 1px solid #dfe7f2 !important;
  border-radius: 18px !important;
  background:
    radial-gradient(320px 150px at 100% 0%, rgba(37, 99, 235, 0.06), transparent 70%),
    #ffffff !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 18px 42px rgba(15, 23, 42, 0.06) !important;
}

.calculator-results {
  background:
    radial-gradient(320px 150px at 100% 0%, rgba(15, 118, 110, 0.07), transparent 70%),
    #fbfdff !important;
}

.form-field {
  gap: 8px !important;
}

.form-field label {
  color: #334155 !important;
  font-size: 0.84rem !important;
  font-weight: 720 !important;
}

.calculator-form input,
.calculator-form select {
  min-height: 44px;
  border: 1px solid #cfd8e6 !important;
  border-radius: 12px !important;
  background-color: #ffffff !important;
  color: #101828 !important;
  box-shadow: none !important;
}

.calculator-form input:focus,
.calculator-form select:focus {
  border-color: #2563eb !important;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.13) !important;
  outline: 0 !important;
}

.primary-btn,
.tool-main-btn {
  min-height: 44px;
  border: 0 !important;
  border-radius: 10px !important;
  background: linear-gradient(135deg, #111827, #2563eb 58%, #0f766e) !important;
  color: #ffffff !important;
  font-weight: 780 !important;
  box-shadow: 0 14px 30px rgba(37, 99, 235, 0.24) !important;
}

.primary-btn:hover,
.tool-main-btn:hover {
  background: linear-gradient(135deg, #0f766e, #1d4ed8 62%, #0f172a) !important;
  color: #ffffff !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 18px 38px rgba(15, 118, 110, 0.28) !important;
}

.calculator-results h2 {
  color: #101828 !important;
  font-size: 1.1rem !important;
  font-weight: 780 !important;
}

.result-item {
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #e8eef6;
}

.result-item:last-child {
  border-bottom: 0;
}

.result-label {
  color: #5d6b82 !important;
  font-weight: 650;
}

.result-item strong {
  color: #101828 !important;
  font-weight: 820 !important;
}

.chart-wrapper {
  padding-top: 18px;
  border-top: 1px dashed #dfe7f2;
}

.content-article {
  width: min(900px, 100%) !important;
  margin: clamp(36px, 6vw, 72px) auto 0 !important;
  padding: clamp(18px, 3vw, 28px);
  border: 1px solid #dfe7f2;
  border-radius: 20px;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.content-article h2,
.content-article h3 {
  color: #101828 !important;
}

.content-article p,
.content-article li {
  color: #475467 !important;
}

.schedule-panel {
  border-left: 1px solid #dfe7f2;
  background: #ffffff;
}

.panel-header,
.panel-actions {
  border-color: #dfe7f2 !important;
}

.close-btn {
  background: #dc2626 !important;
}

@media (max-width: 900px) {
  .calculator-layout {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 640px) {
  .page-content > .section:first-child .section-header,
  .calculator-box,
  .calculator-results,
  .content-article {
    border-radius: 16px !important;
  }

  .panel-actions {
    display: grid !important;
  }

  .panel-actions > * {
    width: 100% !important;
  }
}

/* ==================================================
   Flagship Calculator Interaction Layer
================================================== */

.calculator-layout {
  position: relative;
}

.calculator-box,
.calculator-results {
  position: relative;
  overflow: hidden;
  transition:
    transform 180ms ease,
    box-shadow 220ms ease,
    border-color 220ms ease;
}

.calculator-box::before,
.calculator-results::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.1), transparent 34%),
    linear-gradient(315deg, rgba(15, 118, 110, 0.1), transparent 38%);
  opacity: 0;
  transition: opacity 220ms ease;
}

.calculator-box:hover,
.calculator-results:hover {
  transform: translateY(-2px);
  border-color: #c9d8eb !important;
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.05),
    0 26px 64px rgba(15, 23, 42, 0.11) !important;
}

.calculator-box:hover::before,
.calculator-results:hover::before {
  opacity: 1;
}

.calculator-form {
  position: relative;
  z-index: 1;
  gap: 1rem !important;
}

.calculator-form h3 {
  margin: 0.45rem 0 0;
  padding: 0.75rem 0 0;
  border-top: 1px solid #edf2f7;
  color: #101828;
  font-size: 0.88rem;
  font-weight: 820;
  letter-spacing: 0 !important;
}

.form-field label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.form-field label::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #2563eb;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.calculator-form input,
.calculator-form select {
  height: 48px;
  padding: 0.68rem 0.82rem !important;
  background:
    linear-gradient(180deg, #ffffff 0%, #fbfdff 100%) !important;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease,
    background-color 160ms ease;
}

.calculator-form input:hover,
.calculator-form select:hover {
  border-color: #b8c9e0 !important;
  background: #ffffff !important;
}

.calculator-form input:focus,
.calculator-form select:focus {
  transform: translateY(-1px);
}

.calculator-form input::placeholder {
  color: #94a3b8;
}

.calculator-form select {
  background-image:
    linear-gradient(45deg, transparent 50%, #475569 50%),
    linear-gradient(135deg, #475569 50%, transparent 50%),
    linear-gradient(180deg, #ffffff 0%, #fbfdff 100%) !important;
  background-position:
    calc(100% - 18px) 20px,
    calc(100% - 12px) 20px,
    0 0 !important;
  background-size: 6px 6px, 6px 6px, 100% 100% !important;
  background-repeat: no-repeat !important;
}

.primary-btn {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  transition:
    transform 170ms ease,
    box-shadow 170ms ease,
    background 170ms ease;
}

.primary-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(120deg, transparent 20%, rgba(255,255,255,0.28), transparent 58%);
  transform: translateX(-130%);
  transition: transform 620ms ease;
}

.primary-btn:hover::after {
  transform: translateX(130%);
}

.primary-btn:active {
  transform: translateY(0) scale(0.99) !important;
}

.calculator-results h2 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 1rem !important;
}

.calculator-results h2::after {
  content: "Live results";
  padding: 5px 9px;
  border: 1px solid #cbe2df;
  border-radius: 999px;
  background: #eefbf8;
  color: #0f5f59;
  font-size: 0.68rem;
  line-height: 1;
  font-weight: 820;
  text-transform: uppercase;
  white-space: nowrap;
}

.results-grid {
  gap: 0.7rem !important;
}

.result-item {
  padding: 13px 14px !important;
  border: 1px solid #e7eef7;
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.92), rgba(248,250,252,0.78));
}

.result-item:hover {
  border-color: #c9d8eb;
  background: #ffffff;
}

.result-label {
  min-width: 0;
}

.result-item strong {
  text-align: right;
  font-size: clamp(0.95rem, 1.4vw, 1.12rem) !important;
}

.summary-box,
.analysis-table,
.schedule-summary {
  position: relative;
  z-index: 1;
}

.summary-box {
  padding: 14px;
  border: 1px solid #e7eef7;
  border-radius: 14px;
  background: #ffffff;
}

.analysis-table,
.schedule-table {
  overflow: hidden;
  border: 1px solid #e7eef7;
  border-radius: 14px;
  background: #ffffff;
  border-collapse: separate !important;
  border-spacing: 0;
}

.analysis-table th,
.analysis-table td,
.schedule-table th,
.schedule-table td {
  border-bottom: 1px solid #edf2f7 !important;
}

.analysis-table th,
.schedule-table th {
  background: #f8fafc !important;
  color: #334155;
  font-weight: 780;
}

.analysis-table tr:hover td,
.schedule-table tbody tr:hover td {
  background: #f8fbff;
}

.chart-wrapper canvas {
  max-width: 100%;
  border-radius: 50%;
  filter: drop-shadow(0 16px 26px rgba(15, 23, 42, 0.09));
}

.chart-legend,
.calculator-results .chart-wrapper + div,
.calculator-results canvas + div {
  flex-wrap: wrap;
  justify-content: center;
}

.legend-box {
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.08);
}

@media (max-width: 640px) {
  .page-content > .section:first-child .section-header {
    padding: 22px !important;
  }

  .page-content > .section:first-child .section-header h1 {
    font-size: 2rem !important;
  }

  .result-item {
    display: grid !important;
    grid-template-columns: 1fr;
    align-items: start !important;
  }

  .result-item strong {
    text-align: left;
  }

  .calculator-results h2 {
    align-items: flex-start;
  }
}

/* ==================================================
   Professional Calculator Refinement
================================================== */

.page-content > .section:first-child .section-header {
  display: block !important;
  padding: 24px 28px !important;
  border-radius: 14px !important;
  background:
    linear-gradient(180deg, #ffffff, #fbfdff) !important;
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.04),
    0 12px 30px rgba(15, 23, 42, 0.055) !important;
}

.page-content > .section:first-child .section-header::before {
  display: inline-flex !important;
  margin: 0 0 12px 0 !important;
  padding: 5px 9px !important;
  font-size: 0.68rem !important;
  letter-spacing: 0.02em !important;
  vertical-align: top !important;
}

.page-content > .section:first-child .section-header h1 {
  display: block !important;
  max-width: 780px !important;
  margin: 0 !important;
  font-size: clamp(1.85rem, 3vw, 2.2rem) !important;
  line-height: 1.12 !important;
  letter-spacing: 0 !important;
}

.page-content > .section:first-child .section-header p {
  max-width: 680px !important;
  margin-top: 12px !important;
  font-size: 0.95rem !important;
  line-height: 1.6 !important;
}

.calculator-layout {
  align-items: start !important;
  gap: 20px !important;
}

.calculator-box,
.calculator-results {
  border-radius: 14px !important;
  background: #ffffff !important;
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.04),
    0 14px 34px rgba(15, 23, 42, 0.06) !important;
}

.calculator-results {
  background: #fbfdff !important;
}

.calculator-box::before,
.calculator-results::before {
  display: none !important;
}

.calculator-box:hover,
.calculator-results:hover {
  transform: none !important;
  border-color: #ccd8e6 !important;
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.05),
    0 18px 42px rgba(15, 23, 42, 0.08) !important;
}

.calculator-form {
  gap: 0.95rem !important;
}

.calculator-form h3 {
  margin-top: 0.35rem !important;
  padding-top: 0.8rem !important;
  color: #1f2937 !important;
  font-size: 0.9rem !important;
}

.form-field {
  gap: 6px !important;
}

.form-field label {
  gap: 0 !important;
  color: #344054 !important;
  font-size: 0.8rem !important;
  font-weight: 720 !important;
}

.form-field label::before {
  display: none !important;
}

.calculator-form input,
.calculator-form select {
  height: 44px !important;
  min-height: 44px !important;
  border-radius: 9px !important;
  border-color: #c9d4e2 !important;
  background: #ffffff !important;
  font-size: 0.92rem !important;
}

.calculator-form input:hover,
.calculator-form select:hover {
  border-color: #9fb3cc !important;
}

.calculator-form input:focus,
.calculator-form select:focus {
  transform: none !important;
  border-color: #2563eb !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12) !important;
}

.calculator-form select {
  background-image:
    linear-gradient(45deg, transparent 50%, #475569 50%),
    linear-gradient(135deg, #475569 50%, transparent 50%) !important;
  background-position:
    calc(100% - 18px) 19px,
    calc(100% - 12px) 19px !important;
  background-size: 6px 6px, 6px 6px !important;
  background-repeat: no-repeat !important;
}

.primary-btn {
  min-height: 44px !important;
  border-radius: 9px !important;
  background: linear-gradient(135deg, #2563eb, #0f766e) !important;
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.2) !important;
}

.primary-btn::after {
  display: none !important;
}

.primary-btn:hover {
  transform: translateY(-1px) !important;
  box-shadow: 0 14px 28px rgba(15, 118, 110, 0.22) !important;
}

.calculator-results h2::after {
  content: "Results";
  background: #f0fdfa !important;
}

.calculator-result-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.calculator-result-title {
  min-width: 0;
}

.calculator-result-header h2 {
  margin: 0 !important;
}

.calculator-result-header h2::after {
  content: "Live results";
}

.calculator-result-actions {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  z-index: 3;
}

.calculator-action-btn {
  min-height: 34px;
  padding: 0 0.72rem;
  border: 1px solid #d5deea;
  border-radius: 9px;
  background: #ffffff;
  color: #344054;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 760;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.calculator-action-btn:hover {
  border-color: #9fb3cc;
  background: #f8fbff;
}

.calculator-download-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 50;
  min-width: 170px;
  padding: 0.35rem;
  border: 1px solid #d5deea;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.14);
}

.calculator-download-menu[hidden] {
  display: none;
}

.calculator-download-menu button {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 36px;
  padding: 0 0.7rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #344054;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.calculator-download-menu button:hover {
  background: #f1f5f9;
}

.result-item {
  padding: 12px !important;
  border-radius: 10px !important;
  background: #ffffff !important;
}

.result-label {
  color: #52637a !important;
  font-size: 0.8rem !important;
}

.result-item strong {
  font-size: 1rem !important;
}

.chart-wrapper {
  margin-top: 1rem !important;
  padding-top: 1rem !important;
}

.chart-wrapper canvas {
  width: min(230px, 100%) !important;
  height: auto !important;
  filter: none !important;
}

.summary-box {
  border-radius: 12px !important;
  line-height: 1.7 !important;
}

.content-article {
  border-radius: 16px !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04) !important;
}

@media (max-width: 640px) {
  .page-content > .section:first-child .section-header h1 {
    font-size: 1.7rem !important;
  }

  .calculator-result-header {
    display: grid;
  }

  .calculator-result-actions {
    width: 100%;
  }

  .calculator-action-btn {
    flex: 1;
  }
}

/* ==================================================
   Dashboard Result Panels
================================================== */

.calculator-results {
  padding: clamp(16px, 2.2vw, 22px) !important;
  border: 1px solid #d9e3ef !important;
  border-radius: 16px !important;
  background:
    linear-gradient(180deg, #ffffff 0%, #fbfdff 100%) !important;
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.05),
    0 18px 40px rgba(15, 23, 42, 0.08) !important;
}

.calculator-result-header,
.budget-results-header {
  align-items: flex-start !important;
  padding-bottom: 14px;
  border-bottom: 1px solid #e7eef7;
}

.calculator-result-title h2,
.budget-results-title h2,
.calculator-results > h2 {
  color: #101828 !important;
  font-size: clamp(1.02rem, 1.5vw, 1.18rem) !important;
  line-height: 1.25 !important;
  letter-spacing: 0 !important;
}

.calculator-result-title h2::after,
.calculator-results > h2::after {
  content: "Live dashboard" !important;
  border-color: #bfdbfe !important;
  background: #eff6ff !important;
  color: #1d4ed8 !important;
}

.calculator-action-btn,
.budget-action-btn {
  min-height: 36px !important;
  padding: 0 0.78rem !important;
  border-color: #d7e1ee !important;
  border-radius: 10px !important;
  background: #ffffff !important;
  color: #344054 !important;
  font-size: 0.78rem !important;
  font-weight: 800 !important;
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.calculator-action-btn:hover,
.budget-action-btn:hover {
  border-color: #a9bdd6 !important;
  background: #f8fbff !important;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08) !important;
  transform: translateY(-1px);
}

.calculator-download-menu,
.budget-download-menu {
  border-color: #d7e1ee !important;
  box-shadow:
    0 8px 18px rgba(15, 23, 42, 0.08),
    0 22px 54px rgba(15, 23, 42, 0.14) !important;
}

.results-grid {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 10px !important;
  margin-top: 14px;
}

.result-item {
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: 6px !important;
  min-height: 82px;
  padding: 13px !important;
  border: 1px solid #e3ebf5 !important;
  border-radius: 12px !important;
  background:
    linear-gradient(180deg, #ffffff 0%, #f9fbff 100%) !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.035);
}

.result-item:hover {
  border-color: #bfd0e4 !important;
  background: #ffffff !important;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.07);
}

.result-label {
  color: #667085 !important;
  font-size: 0.76rem !important;
  line-height: 1.35 !important;
  font-weight: 760 !important;
  text-transform: uppercase;
  letter-spacing: 0.03em !important;
}

.result-item strong {
  color: #101828 !important;
  font-size: clamp(1rem, 1.55vw, 1.2rem) !important;
  line-height: 1.25 !important;
  font-weight: 850 !important;
  text-align: left !important;
  overflow-wrap: anywhere;
}

.calculator-results .chart-wrapper {
  margin-top: 16px !important;
  padding: 16px 0 0 !important;
  border-top: 1px dashed #d9e3ef !important;
}

.calculator-results .chart-legend,
.calculator-results canvas + div,
.calculator-results .chart-wrapper + div {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 14px;
  color: #52637a;
  font-size: 0.82rem;
  font-weight: 650;
}

.summary-box {
  margin-top: 14px !important;
  padding: 14px !important;
  border: 1px solid #e3ebf5 !important;
  border-radius: 12px !important;
  background:
    linear-gradient(180deg, #ffffff 0%, #fbfdff 100%) !important;
  color: #475467 !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.035);
}

.summary-box strong {
  color: #101828;
}

.analysis-table,
.schedule-table {
  width: 100%;
  margin-top: 10px !important;
  border: 1px solid #e3ebf5 !important;
  border-radius: 12px !important;
  background: #ffffff !important;
  overflow: hidden !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.035);
}

.analysis-table th,
.schedule-table th {
  padding: 10px 12px !important;
  background: #f8fafc !important;
  color: #344054 !important;
  font-size: 0.76rem !important;
  font-weight: 820 !important;
  text-transform: uppercase;
  letter-spacing: 0.03em !important;
}

.analysis-table td,
.schedule-table td {
  padding: 10px 12px !important;
  color: #475467 !important;
  font-size: 0.85rem !important;
  line-height: 1.45 !important;
}

.analysis-table tr:hover td,
.schedule-table tbody tr:hover td {
  background: #f8fbff !important;
}

@media (max-width: 640px) {
  .results-grid {
    grid-template-columns: 1fr !important;
  }

  .result-item {
    min-height: 0;
  }
}

/* ==================================================
   Health / Text Summary Stability
================================================== */

.calculator-results > .summary-box,
.calculator-results .summary-box {
  display: block !important;
  white-space: normal !important;
  text-align: left !important;
}

.calculator-results .summary-box br {
  display: block !important;
  content: "" !important;
  margin-top: 6px;
}

.calculator-results .summary-box strong {
  display: inline !important;
  text-align: inherit !important;
  white-space: normal !important;
  overflow-wrap: anywhere;
}

.calculator-results .summary-box ul,
.calculator-results .summary-box ol {
  display: grid !important;
  gap: 8px !important;
  margin: 0 !important;
  padding-left: 1.1rem !important;
}

.calculator-results .summary-box li {
  display: list-item !important;
  color: #475467 !important;
  line-height: 1.65 !important;
}

.health-result-note {
  margin: 14px 0 0;
  padding: 10px 12px;
  border: 1px solid #d9f0ea;
  border-radius: 10px;
  background: #f7fffd;
  color: #37635c;
  font-size: 0.78rem;
  line-height: 1.55;
  font-weight: 650;
}

/* Keep export/share menus above result tiles. */
.calculator-results {
  overflow: visible !important;
}

.calculator-result-header {
  position: relative;
  z-index: 30;
}

.calculator-result-actions {
  position: relative;
  z-index: 40;
}

.calculator-download-menu,
.budget-download-menu {
  z-index: 200 !important;
}

.calculator-results .results-grid,
.calculator-results .budget-results-grid {
  position: relative;
  z-index: 1;
}
