:root {
  font-family: system-ui, sans-serif;
  color: #17352c;
  background: #eef2ee;
  font-size: 15px;
  --evergreen: #112e27;
  --green: #18523f;
  --gold: #dfbd75;
  --line: #dce6de;
  --muted: #4c655a;
}
* { box-sizing: border-box }
[hidden] { display: none !important }
body { margin: 0 }
header {
  min-height: 66px;
  padding: 12px clamp(16px,4vw,64px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}
header strong { display: flex; align-items: center; gap: 10px; letter-spacing: .14em }
header > span { color: var(--muted); font-size: 12px; text-align: right }
.brand-mark { color: var(--gold); background: var(--evergreen); border-radius: 9px; padding: 7px 10px; font-family: Georgia, serif }
main { max-width: 1600px; margin: auto; padding: clamp(12px, 3vw, 36px) }
.notice { color: #694c16; background: #fff8e9; border: 1px solid #e8d7ac; padding: 12px 16px; border-radius: 9px; font-size: 13px }
#login, #mfa { max-width: 460px; margin: 48px auto; padding: 32px; border: 1px solid var(--line); border-radius: 16px; background: white }
label { display: grid; gap: 7px; font-size: 13px; font-weight: 650 }
#login label, #mfa label { margin: 15px 0 }
input, select { min-width: 0; width: 100%; padding: 12px; border: 1px solid #adbbb2; border-radius: 8px; background: white; color: inherit; font: inherit }
button { background: var(--green); color: white; border: 0; border-radius: 8px; padding: 11px 16px; font: inherit; font-weight: 650; cursor: pointer }
button:hover { background: #266b53 }
button:disabled { opacity: .55; cursor: wait }
:focus-visible { outline: 3px solid #a17326; outline-offset: 3px }
h1, h2, h3, p { margin: 0 0 14px }
h1 { font-family: Georgia, serif; font-weight: 500; font-size: clamp(29px, 4vw, 44px); letter-spacing: -.035em }
h2 { font-size: 19px }
h3 { font-size: 16px }
#qr { max-width: 220px }
#message { color: #694c16; font-weight: 650 }
#message:empty { display: none }
#logout { display: block; margin: 0 0 12px auto }
#dashboard { display: grid; grid-template-columns: 206px minmax(0,1fr); overflow: hidden; min-height: 660px; border: 1px solid var(--line); border-radius: 18px; background: #f8faf8; box-shadow: 0 15px 42px #112e2710 }
#nav { background: var(--evergreen); padding: 24px 12px; display: flex; flex-direction: column; gap: 6px; }
#nav button { text-align: left; background: transparent; color: #dbe7df; font-size: 14px; border-left: 3px solid transparent }
#nav button:hover, #nav button[aria-current=true] { background: #254b3f; color: white }
#nav button[aria-current=true] { border-left-color: var(--gold) }
#workspace { padding: clamp(14px, 3vw, 36px); min-width: 0 }
.workspace-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; gap: 10px }
.workspace-toolbar span { color: var(--muted); font-size: 13px }
.workspace-toolbar button { background: white; color: var(--green); border: 1px solid var(--line) }
.overview-hero { border-radius: 14px; background: linear-gradient(115deg,#112e27,#235747); color: #fff; padding: clamp(24px,4vw,44px); border-bottom: 3px solid var(--gold) }
.overview-hero p { color: #e0e9e4; margin: 0 }
.cards { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(160px,100%),1fr)); gap: 12px; margin: 18px 0 }
.metric { min-width: 0; padding: 16px; background: white; border: 1px solid var(--line); border-radius: 11px }
.metric small { display: block; color: var(--muted); margin-bottom: 9px }
.metric strong { font-size: clamp(17px,2vw,23px); font-variant-numeric: tabular-nums; overflow-wrap: anywhere }
.panel form { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); align-items: end; gap: 14px; background: white; border: 1px solid var(--line); padding: 20px; border-radius: 12px; margin-bottom: 18px }
.panel form h3 { grid-column: 1 / -1 }
.panel form button { justify-self: start }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 12px; background: white }
table { border-collapse: collapse; width: 100%; font-size: 13px }
td, th { padding: 13px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; font-variant-numeric: tabular-nums }
tbody tr:last-child td { border-bottom: 0 }
th { background: #eef4ef; color: #405b50; font-size: 12px }
tbody tr:hover { background: #f5f8f5 }
.empty { padding: 20px; text-align: center; color: var(--muted); background: #eef4ef; border-radius: 10px }
.muted { font-size: 13px; color: var(--muted) }
#reportTools, .schedule-section { background: white; border: 1px solid var(--line); border-radius: 14px; padding: clamp(15px,3vw,24px); margin-top: 18px }
#reportTools { display: grid; gap: 20px }
.portfolio-report-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px }
.portfolio-report-header h2 { margin: 0; font-size: clamp(20px, 3vw, 26px); letter-spacing: -.025em }
.portfolio-export { background: white; border: 1px solid #c5d5ca; color: var(--green); font-size: 13px; min-height: 44px }
.portfolio-export:hover { background: #edf4ee; color: var(--green) }
.payout-metrics { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(180px,100%),1fr)); gap: 10px; margin: 0 }
.payout-metric { min-width: 0; padding: 14px; background: #edf4ee; border: 1px solid #dce6de; border-radius: 10px }
.payout-metric-due { background: #fbf4e6; border-color: #e9dabc }
.payout-metric dt, .interest-totals dt { color: var(--muted); font-size: 13px; font-weight: 650 }
.payout-metric-due dt { color: #684e20 }
.payout-metric dd, .interest-totals dd { margin: 4px 0 0; font-size: clamp(20px, 2.4vw, 27px); font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; line-height: 1.25 }
.payout-metric .payout-date { font-size: 13px; font-weight: 550; color: var(--muted) }
.payout-metric .payout-empty { font-size: 16px }
.interest-breakdown { border-top: 1px solid var(--line); padding-top: 16px }
.interest-breakdown h3 { margin: 0 0 12px }
#portfolioInterestProgress { appearance: none; display: block; width: 100%; height: 11px; border: 0; border-radius: 999px; overflow: hidden; background: #dce6de; margin: 0 0 14px; accent-color: var(--green) }
#portfolioInterestProgress::-webkit-progress-bar { background: #dce6de }
#portfolioInterestProgress::-webkit-progress-value { background: var(--green) }
#portfolioInterestProgress::-moz-progress-bar { background: var(--green) }
.interest-totals { display: flex; flex-wrap: wrap; gap: 14px 32px; justify-content: space-between; margin: 0 }
.interest-totals dt::before { content: ""; display: inline-block; width: 9px; height: 9px; margin-right: 7px; border-radius: 3px; background: #dce6de; border: 1px solid #b4c2b7 }
.interest-paid dt::before { background: var(--green); border-color: var(--green) }
.interest-totals dd { font-size: clamp(17px, 2vw, 21px) }

.schedule-section > select { max-width: 460px; margin-bottom: 16px }
.schedule-section form { margin-top: 18px }
@media (max-width: 760px) {
  #dashboard { grid-template-columns: minmax(0,1fr) }
  #nav { flex-direction: row; overflow: auto; padding: 10px }
  #nav button { white-space: nowrap }
  .panel form { grid-template-columns: minmax(0,1fr) }
}

#reviewDialog { width:min(560px,calc(100% - 32px)); max-height:calc(100% - 32px); border:1px solid #dce5dd; border-radius:18px; padding:0; color:#152d26; background:#fff; box-shadow:0 24px 80px #0c241c40 }
#reviewDialog::backdrop { background:#10292099 }
#reviewDialog form { padding:clamp(18px,4vw,30px) }
#reviewTitle { margin:0 0 8px; font-size:clamp(24px,4vw,32px) }
#reviewDescription { margin:0 0 18px; color:#516860 }
#reviewDetails { margin:0; display:grid; gap:8px }
#reviewDetails:empty { display:none }
#reviewDetails div { display:flex; flex-wrap:wrap; justify-content:space-between; gap:5px 12px; padding:9px 12px; border-radius:8px; background:#f3f5f0 }
#reviewDetails dt { color:#516860 }
#reviewDetails dd { margin:0; font-weight:650; overflow-wrap:anywhere; font-variant-numeric:tabular-nums }
#reviewDetails div:last-child { color:#fff; background:#173e32 }
#reviewDetails div:last-child dt { color:#e5ede7 }
.review-actions { display:flex; justify-content:flex-end; flex-wrap:wrap; gap:10px; margin-top:20px }
.review-cancel { background:#e9efea; color:#173e32 }
