/* arm-tools: no external fonts, no trackers, no CDN */

* { box-sizing: border-box; }

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.55;
  color: #1c1c1c;
  background: #f6f6f2;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 18px 64px;
}

header.topbar {
  border-bottom: 1px solid #d6d6cf;
  background: #fff;
}
header.topbar .wrap {
  padding-top: 16px;
  padding-bottom: 16px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
header.topbar h1 {
  font-size: 1.1rem;
  margin: 0;
  letter-spacing: 0.2px;
}
header.topbar .sub {
  font-size: 0.85rem;
  color: #666;
}

/* Password gate */
.gate {
  max-width: 380px;
  margin: 80px auto;
  padding: 28px 24px;
  background: #fff;
  border: 1px solid #d6d6cf;
  border-radius: 8px;
  text-align: center;
}
.gate h2 { margin: 0 0 8px; font-size: 1.1rem; }
.gate p { color: #555; margin: 0 0 18px; font-size: 0.9rem; }
.gate input {
  width: 100%;
  padding: 10px 12px;
  font-size: 1rem;
  border: 1px solid #bbb;
  border-radius: 5px;
  margin-bottom: 10px;
}
.gate button {
  width: 100%;
  padding: 10px 12px;
  font-size: 1rem;
  background: #1b3a5c;
  color: #fff;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}
.gate button:hover { background: #234e7a; }
.gate .err { color: #b00020; font-size: 0.85rem; min-height: 1.2em; }

/* Tabs */
nav.tabs {
  display: flex;
  gap: 2px;
  margin: 18px 0 18px;
  border-bottom: 1px solid #d6d6cf;
  flex-wrap: wrap;
}
nav.tabs button {
  background: none;
  border: none;
  padding: 10px 16px;
  font-size: 0.95rem;
  font-weight: 500;
  color: #555;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
}
nav.tabs button.active {
  color: #1b3a5c;
  border-bottom-color: #1b3a5c;
}
nav.tabs button:hover { color: #1b3a5c; }

section.panel { display: none; }
section.panel.active { display: block; }

h2.panel-title {
  font-size: 1.15rem;
  margin: 0 0 4px;
}
.panel-lede {
  color: #555;
  font-size: 0.9rem;
  margin: 0 0 20px;
}

/* Form grid */
.grid {
  display: grid;
  gap: 12px 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-bottom: 16px;
}
.field label {
  display: block;
  font-size: 0.82rem;
  color: #555;
  margin-bottom: 4px;
}
.field input, .field select {
  width: 100%;
  padding: 8px 10px;
  font-size: 0.95rem;
  border: 1px solid #bbb;
  border-radius: 4px;
  background: #fff;
}
.field input:focus, .field select:focus {
  outline: none;
  border-color: #1b3a5c;
  box-shadow: 0 0 0 2px rgba(27,58,92,0.15);
}

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

button.primary {
  background: #1b3a5c;
  color: #fff;
  border: none;
  padding: 9px 18px;
  font-size: 0.95rem;
  border-radius: 5px;
  cursor: pointer;
}
button.primary:hover { background: #234e7a; }
button.ghost {
  background: #fff;
  color: #1b3a5c;
  border: 1px solid #1b3a5c;
  padding: 7px 14px;
  font-size: 0.9rem;
  border-radius: 5px;
  cursor: pointer;
}
button.ghost:hover { background: #eaf0f7; }
button.danger {
  background: transparent;
  color: #b00020;
  border: 1px solid #d6d6cf;
  padding: 6px 10px;
  font-size: 0.85rem;
  border-radius: 4px;
  cursor: pointer;
}

/* Output card */
.card {
  background: #fff;
  border: 1px solid #d6d6cf;
  border-radius: 6px;
  padding: 16px 18px;
  margin: 14px 0;
}
.card h3 { margin: 0 0 8px; font-size: 1rem; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 4px 18px; font-size: 0.92rem; }
.kv .k { color: #555; }
.kv .v { font-variant-numeric: tabular-nums; font-weight: 500; }
.kv .big { font-size: 1.1rem; font-weight: 600; }

.flag {
  margin-top: 8px;
  padding: 8px 10px;
  background: #fff7e6;
  border-left: 3px solid #d89a00;
  font-size: 0.88rem;
  color: #5c4200;
}
.flag.ok {
  background: #eef6ee;
  border-left-color: #2a6e3f;
  color: #1f4f2e;
}

/* Security rows for LVR tool */
.sec-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 10px;
}
.sec-table th, .sec-table td {
  text-align: left;
  padding: 6px 8px;
  vertical-align: top;
  font-size: 0.9rem;
  border-bottom: 1px solid #eee;
}
.sec-table th { font-weight: 500; color: #555; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.4px; }
.sec-table input, .sec-table select {
  width: 100%;
  padding: 5px 7px;
  font-size: 0.9rem;
  border: 1px solid #bbb;
  border-radius: 3px;
}

/* Amortisation schedule table */
.schedule-wrap {
  max-height: 420px;
  overflow: auto;
  border: 1px solid #d6d6cf;
  border-radius: 5px;
  background: #fff;
}
.schedule {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}
.schedule th, .schedule td {
  padding: 5px 8px;
  text-align: right;
  border-bottom: 1px solid #f0f0ea;
}
.schedule th {
  background: #f6f6f2;
  position: sticky;
  top: 0;
  font-weight: 500;
  color: #555;
  text-align: right;
  font-size: 0.78rem;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
.schedule td:first-child, .schedule th:first-child { text-align: left; width: 70px; }

/* Chart */
.chart-wrap {
  background: #fff;
  border: 1px solid #d6d6cf;
  border-radius: 6px;
  padding: 12px;
  margin: 12px 0;
}
.chart-wrap svg { width: 100%; height: auto; display: block; }

/* Rate step rows */
.step-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; margin-bottom: 6px; align-items: center; }
.step-row input { padding: 6px 8px; font-size: 0.9rem; border: 1px solid #bbb; border-radius: 3px; }

/* Footer */
footer.foot {
  margin-top: 40px;
  padding-top: 18px;
  border-top: 1px solid #d6d6cf;
  font-size: 0.82rem;
  color: #666;
}
footer.foot p { margin: 4px 0; }

.small { font-size: 0.82rem; color: #666; }
.warn { color: #8a5b00; }
.hidden { display: none !important; }

/* Toast for clipboard feedback */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #1b3a5c;
  color: #fff;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.88rem;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}
.toast.show { opacity: 1; }

/* Responsive */
@media (max-width: 600px) {
  .grid { grid-template-columns: 1fr; }
  .wrap { padding: 16px 14px 40px; }
  nav.tabs button { padding: 9px 12px; font-size: 0.88rem; }
}
