.calc-widget {
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2rem;
  box-shadow: var(--shadow-md);
  margin: 1.5rem 0;
}

.calc-input-group {
  margin-bottom: 1rem;
}

.calc-input-group label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.35rem;
}

.calc-input-group input,
.calc-input-group select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  font-size: 1rem;
  color: var(--text);
  background: var(--bg);
  outline: none;
}

.calc-input-group input:focus,
.calc-input-group select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.calc-input-group .hint {
  display: block;
  color: var(--text-muted);
  font-size: 0.82rem;
  margin-top: 0.25rem;
}

.input-prefix {
  position: relative;
}

.input-prefix span {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  font-weight: 700;
}

.input-prefix input { padding-left: 2rem; }

.calc-input-group input[type="range"] {
  --range-progress: 0%;
  height: 42px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.calc-input-group input[type="range"]:focus {
  border-color: transparent;
  box-shadow: none;
}

.calc-input-group input[type="range"]::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(
    to right,
    var(--primary) 0%,
    var(--primary) var(--range-progress),
    #e2e8f0 var(--range-progress),
    #e2e8f0 100%
  );
}

.calc-input-group input[type="range"]::-webkit-slider-thumb {
  width: 22px;
  height: 22px;
  margin-top: -7px;
  border: 3px solid #fff;
  border-radius: 999px;
  background: var(--primary);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.22);
  -webkit-appearance: none;
  appearance: none;
}

.calc-input-group input[type="range"]:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 4px var(--primary-light), 0 2px 6px rgba(15, 23, 42, 0.22);
}

.calc-input-group input[type="range"]::-moz-range-track {
  height: 8px;
  border-radius: 999px;
  background: #e2e8f0;
}

.calc-input-group input[type="range"]::-moz-range-progress {
  height: 8px;
  border-radius: 999px;
  background: var(--primary);
}

.calc-input-group input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: 3px solid #fff;
  border-radius: 999px;
  background: var(--primary);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.22);
}

.dual-control input[type="range"] {
  min-width: 0;
}

.calc-btn {
  width: 100%;
  padding: 0.9rem 1.5rem;
  border: 0;
  border-radius: var(--radius);
  background: var(--primary);
  color: #fff;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
  box-shadow: var(--shadow);
}

.calc-btn:hover {
  background: var(--primary-dark);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.calc-btn:active {
  transform: translateY(0);
  box-shadow: var(--shadow);
}

.calc-result {
  display: none;
  margin-top: 1.25rem;
  padding: 1.25rem;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-lg);
  background: var(--primary-light);
}

.calc-result.show { display: block; }

.india-page {
  --primary: var(--india);
  --primary-dark: #ea580c;
  --primary-light: var(--india-light);
}

.india-page .calc-widget {
  border-color: #fed7aa;
}

.india-page .calc-result {
  border-color: #fdba74;
  background: var(--india-light);
}

.india-page .calc-btn {
  background: var(--india);
}

.india-page .calc-btn:hover {
  background: #ea580c;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.field-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.section-label {
  margin: 1rem 0 0.7rem;
  color: var(--india);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.dual-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 140px;
  gap: 0.6rem;
  align-items: center;
}

.result-card.highlight {
  border-color: #fdba74;
  background: #fffbeb;
}

.better-badge {
  display: inline-flex;
  align-items: center;
  margin-top: 0.45rem;
  border-radius: 999px;
  padding: 0.18rem 0.55rem;
  color: #166534;
  background: #dcfce7;
  font-size: 0.78rem;
  font-weight: 800;
}

.mini-note {
  color: var(--text-secondary);
  font-size: 0.88rem;
  margin-top: 0.35rem;
}

.visual-panel {
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid #fed7aa;
  border-radius: var(--radius-lg);
  background: #fffaf5;
}

.summary-list {
  display: grid;
  gap: 0.65rem;
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
}

.summary-list li {
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

.svg-slip {
  width: 100%;
  min-height: 360px;
}

.result-value {
  display: block;
  color: var(--primary);
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
  font-size: clamp(1.35rem, 4.5vw, 2rem);
  font-weight: 800;
  line-height: 1.15;
}

.result-label {
  display: block;
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-top: 0.2rem;
}

.calc-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
  margin-bottom: 1.25rem;
  padding: 0.35rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
}

.calc-tab {
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-secondary);
  padding: 0.7rem 0.5rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.calc-tab.active {
  background: var(--bg);
  color: var(--primary);
  box-shadow: var(--shadow);
}

.chart-container {
  position: relative;
  height: 280px;
  margin-top: 1rem;
}

.amortization-table {
  width: 100%;
  overflow-x: auto;
  margin-top: 1rem;
}

.progress-bar-container {
  width: 100%;
  min-height: 14px;
  overflow: hidden;
  background: #dbeafe;
  border-radius: 999px;
  margin-top: 1rem;
}

.progress-bar-fill {
  width: 0;
  height: 14px;
  background: var(--primary);
  border-radius: 999px;
  transition: width 0.6s ease;
}

.how-to-steps {
  counter-reset: steps;
  list-style: none;
  padding-left: 0;
}

.how-to-steps li {
  counter-increment: steps;
  position: relative;
  padding-left: 3rem;
  margin-bottom: 1rem;
}

.how-to-steps li::before {
  content: counter(steps);
  position: absolute;
  left: 0;
  top: 0.1rem;
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: #fff;
  border-radius: 999px;
  font-weight: 700;
}

.formula-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  margin: 1rem 0;
}

.example-box {
  background: var(--bg-secondary);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
  padding: 1rem;
  margin: 1rem 0;
}

.slab-buttons,
.toggle-buttons {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.toggle-buttons { grid-template-columns: repeat(2, 1fr); }

.slab-btn,
.toggle-btn {
  border: 1.5px solid var(--border);
  background: var(--bg);
  border-radius: var(--radius);
  padding: 0.75rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.slab-btn.active,
.toggle-btn.active {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.bmi-scale {
  width: 100%;
  margin-top: 1rem;
}

.bmi-marker {
  transition: transform 0.5s ease;
}

@media (max-width: 767px) {
  .calc-widget { padding: 1.25rem; }
  .calc-tabs,
  .slab-buttons { grid-template-columns: 1fr; }
  .field-grid,
  .field-grid.three,
  .dual-control { grid-template-columns: 1fr; }
  .chart-container { height: 200px; }
}
