:root {
  color-scheme: light;
  --background: #f3f6f4;
  --header: #e1edf5;
  --aloe: #86b2a2;
  --leaf: #bed5a7;
  --gold: #eed48c;
  --navy: #14294f;
  --green: #17674f;
  --muted: #536782;
  --card: #fff;
  --line: #dfe8e4;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--navy);
  background: var(--background);
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 0; }
button, input, select { font: inherit; }
button, summary, select, .choice, .check-row { cursor: pointer; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }
h1, h2, p { margin: 0; }
.app {
  width: min(100%, 570px);
  margin-inline: auto;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  display: grid;
  gap: 9px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 77px;
  padding: 12px;
  border-radius: 18px;
  background: linear-gradient(115deg, var(--header), #e9f2ed);
  border: 1px solid #dce9ed;
}
.brand-icon { width: 48px; height: 48px; border-radius: 13px; flex: none; object-fit: cover; box-shadow: 0 2px 5px #14294f18; }
.brand-name { color: var(--green); font-weight: 850; font-size: 13px; letter-spacing: .055em; margin-bottom: 3px; }
.brand-name span { color: var(--muted); font-size: 8px; font-weight: 750; margin-left: 4px; letter-spacing: .085em; }
h1 { font-size: clamp(15px, 4.5vw, 23px); line-height: 1.15; letter-spacing: -.045em; font-weight: 800; }
.card, .results { border-radius: 16px; border: 1px solid var(--line); box-shadow: 0 2px 8px #14294f08; }
.card { background: var(--card); }
.order, .choices { padding: 11px; }
h2, legend { font-size: 13px; font-weight: 750; }
.amounts, .choices-grid, .actions { display: grid; gap: 6px; }
.amounts, .cols-2, .actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.amounts { margin-top: 8px; }
.amounts > label { min-width: 0; font-size: 11px; font-weight: 720; color: var(--muted); }
.amount-field {
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 44px;
  margin-top: 4px;
  padding: 0 8px;
  border: 1px solid #d9e6df;
  border-radius: 9px;
  background: #f6faf7;
  color: var(--green);
}
.amount-field:focus-within { border-color: var(--green); box-shadow: 0 0 0 1px var(--green); }
.amount-field input {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--navy);
  font-size: clamp(16px, 4.6vw, 22px);
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  outline: none;
}
.amount-field input::placeholder { color: #65778c; opacity: 1; font-weight: 500; }
.amount-field:has(input[aria-invalid="true"]) { border-color: #a73d31; }
fieldset { border: 0; min-inline-size: 0; padding: 0; margin: 0; }
legend { margin: 0 0 5px; padding: 0; }
.choices > fieldset + fieldset, .choices > div, #leadership-panel > fieldset + fieldset { margin-top: 9px; }
.choice { position: relative; min-width: 0; }
.choice input, .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.choice-content {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 2px;
  text-align: center;
  padding: 3px 2px;
  border: 1px solid #dfe8e3;
  border-radius: 9px;
  background: #f6f9f7;
  font-size: 12px;
  font-weight: 720;
  line-height: 1.13;
}
.choice input:checked + .choice-content { background: #e3efe6; border-color: #4d8d75; color: #11543f; box-shadow: inset 0 0 0 .5px #4d8d75; }
.choice input:focus-visible + .choice-content { outline: 2px solid var(--green); outline-offset: 2px; }
.choice small { font-size: 10px; color: var(--muted); font-weight: 750; }
.choice input:checked + .choice-content small { color: var(--green); }
.modes .choice-content { font-size: clamp(11px, 3.35vw, 14px); white-space: nowrap; }
.customers { grid-template-columns: repeat(12, minmax(0, 1fr)); }
.customers .choice { grid-column: span 4; }
.customers .choice:nth-child(4) { grid-column: span 5; }
.customers .choice:nth-child(5) { grid-column: span 7; }
.select-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f6f9f7;
  color: var(--navy);
  font-size: 16px;
  padding: 0 7px;
}
.checks { display: grid; gap: 6px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.check-row {
  display: flex;
  align-items: center;
  min-height: 44px;
  gap: 8px;
  border-radius: 8px;
  padding: 4px 6px;
  background: #f6f9f7;
  font-size: 12px;
  font-weight: 700;
}
.check-row input { margin: 0; width: 18px; height: 18px; accent-color: var(--green); flex: none; }
.check-row small { display: block; color: var(--muted); font-size: 10px; font-weight: 600; line-height: 1.2; }
.error {
  margin-top: 7px;
  padding: 7px;
  border-radius: 7px;
  background: #fff1e8;
  color: #833326;
  font-size: 12px;
}
.results { padding: 12px; background: linear-gradient(135deg, #fffae9, #f9edca); border-color: var(--gold); }
#result-title { font-size: 13px; color: #574829; }
.total-line { display: flex; align-items: baseline; justify-content: space-between; gap: 7px; margin: 2px 0 9px; }
.total-line p { min-width: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; letter-spacing: -.045em; }
.total-currency { font-weight: 750; font-size: 15px; }
#total-amount { font-size: clamp(36px, 10vw, 52px); line-height: 1.06; }
#total-amount.compact-number { font-size: clamp(21px, 6.9vw, 37px); }
.total-rate { flex: none; border-radius: 999px; padding: 3px 8px; background: var(--gold); color: #403a27; font-size: 12px; font-weight: 800; }
.bonus + .bonus { margin-top: 8px; }
.bonus-heading {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: baseline;
  gap: 6px;
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 750;
}
.bonus-heading span:first-of-type { color: var(--green); }
.bonus-heading span:last-child { text-align: right; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
progress { display: block; width: 100%; height: 6px; appearance: none; border: 0; border-radius: 999px; background: #e8ddba; overflow: hidden; color: var(--green); }
progress::-webkit-progress-bar { background: #e8ddba; }
progress::-webkit-progress-value { background: var(--green); border-radius: 999px; }
progress::-moz-progress-bar { background: var(--green); border-radius: 999px; }
#leadership-progress::-webkit-progress-value { background: #7b5e26; }
#leadership-progress::-moz-progress-bar { background: #7b5e26; }
.detail-card summary { list-style: none; display: flex; align-items: center; justify-content: space-between; min-height: 44px; padding: 0 12px; font-size: 13px; font-weight: 750; border-radius: inherit; }
summary::-webkit-details-marker { display: none; }
summary::after { content: ''; width: 7px; height: 7px; border: solid var(--muted); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); margin-right: 3px; }
details[open] summary::after { transform: rotate(225deg); }
dl { margin: 0; padding: 0 12px 11px; font-size: 12px; }
dl > div { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 6px; padding: 6px 0; border-top: 1px solid var(--line); }
dt { color: var(--muted); }
dd { margin: 0; text-align: right; overflow-wrap: anywhere; font-weight: 650; }
dl .formula, dl .empty-details { grid-template-columns: 1fr; }
.formula dd { text-align: left; white-space: pre-line; line-height: 1.55; }
.actions button { min-height: 44px; border: 1px solid #b7cfc4; border-radius: 10px; background: var(--card); color: var(--green); font-size: 13px; font-weight: 750; }
.actions #copy { border-color: var(--green); background: var(--green); color: white; }
.actions #copy:disabled { cursor: default; border-color: #d4e3da; background: #e2eee6; color: #385e50; }
.toast { color: var(--green); text-align: center; font-size: 12px; }
.clipboard-field { position: fixed; inset: 0 auto auto 0; opacity: 0; pointer-events: none; }
footer { display: flex; gap: 5px; align-items: baseline; justify-content: center; font-size: 10px; color: var(--muted); padding: 1px 0 3px; }
footer strong { color: var(--green); letter-spacing: .08em; }
@media (min-width: 500px) {
  .app { padding-top: 23px; }
  .brand, .order, .choices, .results { padding-inline: 16px; }
  .customers { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .customers .choice:nth-child(n) { grid-column: auto; }
}
