* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Google Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: #f5f5f5;
  padding: 20px;
  color: #333;
  line-height: 1.5;
  min-height: 100vh;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  background: white;
  border-radius: 8px;
  padding: 30px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.page-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 30px;
}

.page-header h1 {
  margin-bottom: 0;
  color: #262626;
}

.heading-link {
  font-size: 0.65rem;
  font-weight: 500;
  color: #1a6b2c;
  text-decoration: none;
  flex-shrink: 0;
}

.heading-link:hover {
  text-decoration: underline;
}

h2 {
  margin-bottom: 15px;
  color: #262626;
  font-size: 1.2em;
}

.form-section {
  margin-bottom: 40px;
  padding: 20px;
  background: #fafafa;
  border: 1px solid #e0e0e0;
}

.form-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 15px;
}

.form-group {
  margin-bottom: 0;
}

label {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
  color: #555;
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="search"],
select {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 0;
  font-size: 14px;
  background: white;
}

input:focus,
select:focus {
  outline: none;
  border-color: #1a6b2c;
}

.hint {
  display: block;
  font-size: 12px;
  color: #888;
  margin-top: 4px;
}

.part-payments-row {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #e0e0e0;
}

.part-payments-row > label {
  display: block;
  margin-bottom: 10px;
}

.part-payments-row .part-payment-item {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 10px;
}

.part-payment-item input {
  margin-bottom: 0;
}

button {
  background: #1a6b2c;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 0;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
}

button:hover {
  background: #155724;
}

.btn-secondary {
  background: #6c757d;
}

.btn-secondary:hover {
  background: #5a6268;
}

.btn-remove {
  background: #dc3545;
  padding: 10px;
}

.btn-remove:hover {
  background: #c82333;
}

#loan-form > button {
  margin-top: 15px;
}

.error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
  padding: 12px;
  border-radius: 0;
  margin-bottom: 15px;
}

#results {
  margin-top: 30px;
}

.summary-section {
  margin-bottom: 40px;
  padding: 20px;
  background: #fafafa;
  border: 1px solid #e0e0e0;
}

.summary-value {
  font-size: 1.1em;
  font-weight: 600;
  color: #262626;
}

.summary-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.summary-row .summary-value {
  flex: 1;
  min-width: 0;
}

.info-trigger {
  position: relative;
  cursor: help;
  font-size: 0.9em;
  color: #6c757d;
  font-weight: 400;
}

.info-trigger .info-popover {
  visibility: hidden;
  position: absolute;
  left: 50%;
  bottom: 100%;
  transform: translateX(-50%) translateY(-8px);
  width: 280px;
  padding: 10px 12px;
  background: #262626;
  color: #fff;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  border-radius: 4px;
  white-space: normal;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.info-trigger .info-popover::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -6px;
  border: 6px solid transparent;
  border-top-color: #262626;
}

.info-trigger:hover .info-popover {
  visibility: visible;
}

/* Table header totals: show popover below so it isn't clipped by .table-wrapper overflow */
#schedule-table th {
  position: relative;
}
#schedule-table th .info-trigger .info-popover--table {
  width: max-content;
  bottom: auto;
  top: 100%;
  transform: translateX(-50%) translateY(8px);
}
#schedule-table th .info-trigger .info-popover--table::after {
  top: auto;
  bottom: 100%;
  border-top-color: transparent;
  border-bottom-color: #262626;
}

.schedule-section {
  padding: 20px;
  background: #fafafa;
  border: 1px solid #e0e0e0;
}

.schedule-controls {
  margin-bottom: 15px;
}

.schedule-controls input {
  max-width: 280px;
}

.table-wrapper {
  overflow-x: auto;
}

#schedule-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

#schedule-table th,
#schedule-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #e0e0e0;
}

#schedule-table th {
  background: #f8f8f8;
  font-weight: 600;
  color: #262626;
}

#schedule-table td {
  font-variant-numeric: tabular-nums;
}

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

#schedule-table tbody tr.hidden {
  display: none;
}
