/* EMI Calculator - compact, #3d85c6 */
:root {
  --emi-brand: #3d85c6;
  --emi-brand-dark: #2c6396;
  --emi-brand-light: #eaf4fb;
  --emi-brand-border: #b6d5f2;
  --emi-bg: #f4f8fc;
  --emi-surface: rgba(255, 255, 255, 0.95);
  --emi-solid: #ffffff;
  --emi-text: #1a1a1a;
  --emi-muted: #64748b;
  --emi-shadow: 0 10px 28px rgba(61, 133, 198, 0.12);
  --emi-radius: 16px;
  --emi-font: 'DM Sans', system-ui, sans-serif;
}

#tool-main {
  font-family: var(--emi-font);
  color: var(--emi-text);
  background: var(--emi-bg);
  background-image: radial-gradient(ellipse 70% 40% at 50% -5%, rgba(61, 133, 198, 0.1), transparent);
  padding-bottom: 16px;
}

.emi-wrap {
  max-width: 480px;
  margin: 0 auto;
  padding: 12px 16px 8px;
}

.emi-hero {
  text-align: center;
  margin-bottom: 12px;
}

.emi-hero h1 {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--emi-brand);
  margin: 0 0 4px;
}

.emi-hero p {
  color: var(--emi-muted);
  font-size: 0.85rem;
  margin: 0;
}

.emi-glass {
  background: var(--emi-surface);
  border: 1px solid var(--emi-brand-border);
  border-radius: var(--emi-radius);
  box-shadow: var(--emi-shadow);
  padding: 14px 16px;
  margin-bottom: 10px;
}

.emi-presets {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.emi-presets button {
  flex: 1;
  padding: 8px 6px;
  border-radius: 10px;
  border: 1px solid var(--emi-brand-border);
  background: var(--emi-solid);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--emi-brand-dark);
  cursor: pointer;
}

.emi-presets button:hover {
  background: var(--emi-brand-light);
}

.emi-presets button.active {
  background: var(--emi-brand);
  border-color: var(--emi-brand);
  color: #fff;
}

.emi-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
}

.emi-form-grid .emi-field:first-child {
  grid-column: 1 / -1;
}

.emi-field label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--emi-brand-dark);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.emi-amount-wrap {
  position: relative;
}

.emi-amount-wrap .emi-currency {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-weight: 700;
  color: var(--emi-brand);
  font-size: 0.95rem;
}

.emi-amount-wrap input,
.emi-input {
  width: 100%;
  padding: 10px 10px 10px 28px;
  font-size: 1rem;
  font-weight: 600;
  border: 1.5px solid var(--emi-brand-border);
  border-radius: 10px;
  background: #f7fbff;
  box-sizing: border-box;
}

.emi-input {
  padding: 10px;
}

.emi-amount-wrap input:focus,
.emi-input:focus,
.emi-select:focus {
  border-color: var(--emi-brand);
  outline: none;
  box-shadow: 0 0 0 2px var(--emi-brand-light);
}

.emi-tenure-inline {
  display: flex;
  gap: 6px;
}

.emi-tenure-inline .emi-input {
  flex: 1;
  min-width: 0;
}

.emi-select {
  width: 5.2rem;
  padding: 10px 6px;
  font-size: 0.82rem;
  font-weight: 600;
  border: 1.5px solid var(--emi-brand-border);
  border-radius: 10px;
  background: #f7fbff;
  color: var(--emi-brand-dark);
}

.emi-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.emi-btn {
  padding: 11px 16px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.92rem;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.emi-btn--primary {
  flex: 1;
  background: var(--emi-brand);
  color: #fff;
  box-shadow: 0 4px 14px rgba(61, 133, 198, 0.3);
}

.emi-btn--primary:hover {
  background: var(--emi-brand-dark);
}

.emi-btn--ghost {
  background: var(--emi-solid);
  border: 1px solid var(--emi-brand-border);
  color: var(--emi-muted);
  padding-left: 14px;
  padding-right: 14px;
}

.emi-btn--sm {
  padding: 7px 14px;
  font-size: 0.8rem;
}

.emi-result {
  padding: 12px 14px;
  animation: emiIn 0.3s ease;
}

@keyframes emiIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.emi-result[hidden] { display: none !important; }

.emi-result-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.emi-result-emi {
  text-align: left;
  flex: 1;
}

.emi-result-emi span {
  display: block;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--emi-muted);
}

.emi-result-emi strong {
  font-size: 1.5rem;
  color: var(--emi-brand);
  font-weight: 800;
  line-height: 1.2;
}

.emi-chart-wrap {
  width: 88px;
  height: 88px;
  flex-shrink: 0;
}

.emi-chart-wrap canvas {
  width: 88px !important;
  height: 88px !important;
}

.emi-stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 8px;
}

.emi-stat {
  padding: 8px 6px;
  border-radius: 8px;
  background: var(--emi-brand-light);
  text-align: center;
}

.emi-stat label {
  display: block;
  font-size: 0.62rem;
  text-transform: uppercase;
  color: var(--emi-muted);
  margin-bottom: 2px;
}

.emi-stat strong {
  font-size: 0.78rem;
  color: var(--emi-brand-dark);
  font-weight: 700;
  word-break: break-word;
}

.emi-result-actions {
  text-align: center;
  margin-bottom: 6px;
}

.emi-schedule-inline summary {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--emi-brand-dark);
  cursor: pointer;
  padding: 6px 0;
}

.emi-table-wrap {
  overflow: auto;
  max-height: 200px;
  margin-top: 6px;
  border: 1px solid var(--emi-brand-border);
  border-radius: 8px;
}

.emi-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.72rem;
}

.emi-table th,
.emi-table td {
  padding: 6px 8px;
  text-align: right;
  border-bottom: 1px solid var(--emi-brand-border);
}

.emi-table th {
  background: var(--emi-brand-light);
  position: sticky;
  top: 0;
  font-size: 0.68rem;
}

.emi-table th:first-child,
.emi-table td:first-child {
  text-align: center;
}

.emi-toast {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
}

.emi-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.emi-toast--success { background: #166534; color: #fff; }
.emi-toast--error { background: #b91c1c; color: #fff; }
.emi-toast--warning { background: #b45309; color: #fff; }

@media (max-width: 380px) {
  .emi-stat-row {
    grid-template-columns: 1fr;
  }
  .emi-stat strong {
    font-size: 0.85rem;
  }
}
