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

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f4f6fb;
  color: #1f2933;
}

.app-container {
  max-width: 1100px;
  margin: 24px auto;
  padding: 0 16px 32px;
}

.app-header {
  text-align: center;
  margin-bottom: 24px;
}

.app-header h1 {
  margin: 0;
  font-size: 1.9rem;
  color: #111827;
}

.app-header p {
  margin: 4px 0 0;
  color: #4b5563;
}

.card {
  background: #ffffff;
  border-radius: 12px;
  padding: 20px 20px 16px;
  margin-bottom: 18px;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.06);
}

.card h2 {
  margin-top: 0;
  margin-bottom: 12px;
  font-size: 1.1rem;
  color: #111827;
}

.grid {
  display: grid;
  gap: 12px 16px;
}

.two-col {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.three-col {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field label {
  font-size: 0.85rem;
  color: #4b5563;
}

.field input,
.field textarea,
.field select {
  border-radius: 8px;
  border: 1px solid #d1d5db;
  padding: 8px 10px;
  font-size: 0.9rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.35);
}

.field textarea {
  resize: vertical;
}

.table-wrapper {
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  margin: 4px 0 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

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

thead {
  background: #f3f4f6;
}

tbody tr {
  background: #ffffff;
}

tbody tr:nth-child(2n) {
  background: #f9fafb;
}

tbody tr:hover {
  background: #f3f4f6;
}

td input {
  width: 100%;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  padding: 6px 8px;
  font-size: 0.85rem;
  box-sizing: border-box;
}

td input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background-color 0.15s, box-shadow 0.15s, transform 0.05s;
}

.btn.primary {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.35);
}

.btn.secondary {
  background: #e5e7eb;
  color: #111827;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn.primary:hover {
  background: linear-gradient(135deg, #1d4ed8, #1e40af);
}

.btn.secondary:hover {
  background: #d1d5db;
}

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

.totals {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-end;
  font-size: 0.9rem;
}

.totals div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  min-width: 260px;
}

.totals .grand-total {
  font-weight: 600;
  font-size: 1rem;
}

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

.emi-header h2 {
  margin-right: auto;
}

.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #d1d5db;
  transition: 0.2s;
  border-radius: 34px;
}

.slider::before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.2s;
  border-radius: 50%;
}

.switch input:checked + .slider {
  background-color: #2563eb;
}

.switch input:checked + .slider::before {
  transform: translateX(18px);
}

.emi-config.hidden,
.emi-summary.hidden,
.table-wrapper.hidden {
  display: none;
}

.emi-summary {
  margin-top: 10px;
  font-size: 0.88rem;
  color: #374151;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

@media (max-width: 640px) {
  .totals {
    align-items: stretch;
  }

  .totals div {
    min-width: 0;
  }

  .actions {
    flex-direction: column;
    align-items: stretch;
  }
}


