:root {
  color-scheme: light;
  --ink: #182437;
  --muted: #788394;
  --green: #376c55;
  --green-dark: #28523f;
  --green-pale: #e9f1eb;
  --paper: #f5f6f2;
  --line: #e8ebe6;
  --white: #fff;
  font-family: "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button { cursor: pointer; }

.topbar {
  height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(6.5vw, calc((100vw - 1200px) / 2));
  color: white;
  background: #101b2c;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: white;
  text-decoration: none;
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -.7px;
}

.brand-mark {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid #678875;
  border-radius: 9px;
  color: #b7d2bd;
  font-size: 16px;
}

.brand-period { color: #a9c5ad; }
.topbar-note { display: flex; align-items: center; gap: 9px; color: #bbc3ce; font-size: 12px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #9dc39f; }
.topbar-install { padding: 8px 13px; border: 1px solid #728b7d; border-radius: 6px; background: transparent; color: #e6efe7; font-size: 11px; font-weight: 700; }
.topbar-install:hover { background: #233a34; }
.topbar-install[hidden] { display: none; }

.page { width: min(1120px, calc(100% - 48px)); margin: 0 auto; }
.intro { padding: 58px 0 32px; }
.eyebrow { margin: 0 0 10px; color: var(--green); font-size: 10px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; }

h1, h2, h3, p { margin-top: 0; }
h1 {
  margin-bottom: 14px;
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: clamp(36px, 5vw, 52px);
  line-height: 1.11;
  letter-spacing: -2.2px;
}
h1 span { color: var(--green); }
.intro-copy { max-width: 485px; margin: 0; color: #737e8b; font-size: 14px; line-height: 1.75; }

.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; }
.summary-card {
  min-height: 138px;
  padding: 20px 21px 17px;
  background: white;
  border: 1px solid #ebede9;
  border-radius: 11px;
}
.summary-primary { background: #173c31; border-color: #173c31; color: white; }
.summary-label { display: flex; align-items: center; gap: 8px; color: #808a96; font-size: 11px; font-weight: 600; }
.summary-primary .summary-label { color: #c6d9cd; }
.summary-icon { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 6px; background: #f0f3ef; color: #5a8067; font-size: 15px; }
.summary-primary .summary-icon { background: #2b5144; color: #c0d8c7; }
.income-icon { color: #59846b; }
.expense-icon { color: #9c7951; }
.leftover-icon { color: #6d79a2; }
.summary-value { margin: 14px 0 3px; font-family: "Segoe UI", Arial, sans-serif; font-size: 25px; font-weight: 700; letter-spacing: -.7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.summary-value.date-value { font-size: 20px; letter-spacing: -.4px; }
.summary-foot { margin: 0; color: #8b95a0; font-size: 11px; }
.summary-primary .summary-foot { color: #aac3b2; }

.content-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(290px, .8fr); gap: 18px; align-items: start; margin-top: 20px; }
.panel { background: white; border: 1px solid #e9ece7; border-radius: 11px; }
.loans-panel { padding: 25px 26px 18px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.section-heading .eyebrow { margin-bottom: 6px; }
h2 { margin-bottom: 0; font-family: "Segoe UI", Arial, sans-serif; font-size: 20px; letter-spacing: -.6px; }
.count-pill { padding: 6px 10px; border-radius: 20px; background: #f2f4f1; color: #737f79; font-size: 11px; font-weight: 600; }
.loan-list { display: grid; gap: 10px; }
.loan-card { padding: 16px; border: 1px solid var(--line); border-radius: 9px; }
.loan-topline { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.loan-name { margin: 0 0 4px; font-family: "Segoe UI", Arial, sans-serif; font-size: 15px; font-weight: 700; }
.loan-date { margin: 0; color: var(--muted); font-size: 11px; }
.loan-actions { display: flex; gap: 5px; }
.text-button { padding: 4px 6px; border: 0; background: transparent; color: #6d7e74; font-size: 11px; }
.text-button:hover { color: var(--green-dark); text-decoration: underline; }
.text-button.delete { color: #a26d68; }
.loan-amounts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 18px; }
.amount-block small { display: block; margin-bottom: 4px; color: #86909b; font-size: 10px; }
.amount-block strong { font-family: "Segoe UI", Arial, sans-serif; font-size: 14px; font-weight: 700; white-space: nowrap; }
.amount-block:nth-child(2) { text-align: center; }
.amount-block:last-child { text-align: right; }
.loan-progress { height: 4px; margin-top: 13px; overflow: hidden; border-radius: 4px; background: #eef0ed; }
.loan-progress span { display: block; width: 100%; height: 100%; border-radius: inherit; background: #90b19a; }
.empty-state { padding: 39px 18px 34px; text-align: center; }
.empty-icon { width: 42px; height: 42px; display: grid; place-items: center; margin: 0 auto 13px; border-radius: 12px; background: var(--green-pale); color: var(--green); font-size: 21px; }
.empty-state h3 { margin-bottom: 7px; font-family: "Segoe UI", Arial, sans-serif; font-size: 14px; }
.empty-state p { max-width: 285px; margin: 0 auto; color: var(--muted); font-size: 12px; line-height: 1.6; }
.panel-footnote { margin: 16px 0 0; padding-top: 13px; border-top: 1px solid #eff0ed; color: #8a939e; font-size: 10px; line-height: 1.55; }

.side-column { display: grid; gap: 14px; }
.form-panel, .budget-panel { padding: 21px 22px; }
.form-panel h2, .budget-panel h2 { margin-bottom: 18px; font-size: 17px; }
form label { display: block; margin: 13px 0 6px; color: #4a5664; font-size: 11px; font-weight: 600; }
form input {
  width: 100%;
  min-height: 39px;
  padding: 9px 11px;
  border: 1px solid #e2e6e1;
  border-radius: 6px;
  outline: none;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
}
form input::placeholder { color: #adb4bb; }
form input:focus { border-color: #6e9a7a; box-shadow: 0 0 0 3px #eaf2eb; }
.field-help { margin: 6px 0 0; color: #87919b; font-size: 10px; }
.form-actions { display: flex; gap: 8px; margin-top: 17px; }
.button { min-height: 39px; padding: 0 14px; border: 0; border-radius: 6px; font-size: 11px; font-weight: 700; transition: background .15s ease; }
.button-primary { flex: 1; background: var(--green); color: white; }
.button-primary:hover { background: var(--green-dark); }
.button-primary span { padding-left: 5px; font-size: 15px; vertical-align: -1px; }
.button-quiet { background: #f1f3f0; color: #66716b; }
.button-secondary { width: 100%; margin-top: 16px; background: #edf2ed; color: #315d43; }
.button-secondary:hover, .button-quiet:hover { background: #e2ebe2; }
.privacy-note { margin: 14px 0 0; padding-top: 12px; border-top: 1px solid #eff0ed; color: #89939d; font-size: 10px; line-height: 1.5; }
.privacy-note span { padding-right: 4px; color: #65866d; }
.notice { margin: 0 0 16px; padding: 10px 13px; border: 1px solid #e6c6bd; border-radius: 7px; background: #fff5f1; color: #8e493b; font-size: 12px; }
.notice[hidden] { display: none; }
.footer { display: flex; justify-content: space-between; padding: 25px 2px 32px; color: #758078; font-size: 10px; }
.footer span { color: #9aa29b; }

@media (max-width: 820px) {
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .content-grid { grid-template-columns: minmax(0, 1fr) minmax(260px, .85fr); }
}

@media (max-width: 650px) {
  .topbar { height: 58px; padding: 0 20px; }
  .topbar-note { display: none; }
  .status-dot { width: 8px; height: 8px; }
  .topbar-install { padding: 7px 10px; }
  .page { width: min(100% - 32px, 480px); }
  .intro { padding: 42px 0 25px; }
  h1 { font-size: 41px; }
  .intro-copy { font-size: 13px; }
  .summary-grid { gap: 9px; }
  .summary-card { min-height: 125px; padding: 15px 13px; }
  .summary-label { gap: 6px; font-size: 10px; }
  .summary-icon { width: 20px; height: 20px; }
  .summary-value { margin-top: 12px; font-size: 21px; }
  .summary-foot { font-size: 10px; }
  .content-grid { grid-template-columns: 1fr; gap: 13px; margin-top: 14px; }
  .loans-panel { padding: 21px 17px 15px; }
  .side-column { gap: 13px; }
  .form-panel, .budget-panel { padding: 20px 18px; }
  .footer { gap: 12px; font-size: 9px; }
}
