/* Scoped to the decomposition tool. Site chrome and typography remain shared. */
.ed-tool-shell--decomposition { --tool-rail: 1360px; padding-bottom: 70px; }
.ed-tool-shell--decomposition .ed-tool-hero { max-width: none; margin: 8px 0 24px; }
.ed-tool-shell--decomposition .ed-tool-hero h1 { font-size: clamp(37px, 5vw, 60px); letter-spacing: -.05em; }
.ed-tool-shell--decomposition .ed-tool-lead { font-size: clamp(14px, 2vw, 18px); }
.ed-tool-shell--decomposition .ed-tool-copy ol { list-style: decimal; }
.ed-decomp {
  --dec-warm: #fffefa;
  --dec-border: #e8e1d0;
  --dec-gold: #ffdc45;
  --dec-muted: #4f6380;
  --dec-blue: #17375c;
  --dec-dark: #102024;
  --dec-row: #edf3fb;
  --dec-input: #c5d3e6;
  color: var(--ed-color-text, #121a23);
  font-variant-numeric: tabular-nums;
}
.ed-decomp [hidden] { display: none !important; }
.ed-decomp :is(button, summary, select) { cursor: pointer; }
.ed-decomp button {
  border: 1px solid #c9d6e7;
  background: #fff;
  color: var(--dec-blue);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 650;
}
.ed-decomp button:hover { border-color: #839bbc; }
.ed-dec-toolbar, .ed-dec-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
}
.ed-dec-toolbar { justify-content: flex-end; margin-bottom: 14px; }
.ed-dec-toolbar label {
  display: flex;
  gap: 9px;
  align-items: center;
  border: 1px solid #cbd8e9;
  background: #fff;
  border-radius: 11px;
  padding: 5px 10px;
  font-size: 13px;
  font-weight: 700;
}
.ed-dec-toolbar select {
  appearance: auto;
  min-height: 30px;
  max-width: 100%;
  border: 0;
  background: #fff;
  color: #1056a4;
  font-weight: 700;
}
.ed-dec-layout { display: grid; grid-template-columns: minmax(0, 2.08fr) minmax(275px, 1fr); gap: 15px; align-items: start; }
.ed-dec-main { display: grid; gap: 14px; min-width: 0; }
.ed-dec-box { background: var(--dec-warm); border: 1px solid var(--dec-border); border-radius: 21px; padding: 19px 20px; }
.ed-decomp .ed-dec-box h2 { font-size: 28px; line-height: 1.12; letter-spacing: -.035em; font-weight: 800; }
.ed-dec-box h2::before {
  content: "";
  display: inline-block;
  height: 5px;
  width: 19px;
  border-radius: 8px;
  margin: 0 8px .16em 0;
  background: var(--dec-gold);
}
.ed-decomp .ed-dec-muted { color: var(--dec-muted); font-size: 13px; margin: 5px 0 9px; }
.ed-decomp [data-custom]:not(:empty) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 10px 0; }
.ed-decomp :is([data-custom], .ed-dec-stage-edit) label { display: grid; gap: 4px; font-size: 12px; color: var(--dec-muted); min-width: 0; }
.ed-decomp :is([data-custom], .ed-dec-stage-edit) input {
  width: 100%; min-width: 0; padding: 7px 9px; border-radius: 8px; border: 1px solid var(--dec-input); background: #fff; color: var(--dec-blue);
}
.ed-dec-formula {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 18px minmax(0, 1fr) 18px minmax(0, 1fr);
  gap: 5px;
  align-items: center;
  padding: 7px 0;
}
.ed-dec-formula > span { text-align: center; color: var(--dec-blue); font-size: 19px; font-weight: 700; }
.ed-dec-formula + [hidden] + .ed-dec-formula { border-top: 1px solid #eae5d8; }
.ed-dec-field { display: grid; align-content: start; min-width: 0; gap: 4px; }
.ed-dec-label { display: flex; align-items: center; gap: 4px; min-height: 23px; font-size: 12px; font-weight: 650; color: var(--dec-muted); }
.ed-dec-label label { min-width: 0; overflow-wrap: anywhere; }
.ed-dec-short-label { display: none; }
.ed-decomp .ed-dec-help {
  flex: none;
  width: 22px;
  height: 22px;
  border: 1px solid #b7c9df;
  border-radius: 50%;
  background: #f5f9ff;
  color: #1b568f;
  font-size: 12px;
  line-height: 1;
  padding: 0;
}
.ed-dec-input {
  display: flex;
  min-width: 0;
  align-items: center;
  min-height: 40px;
  border: 1px solid var(--dec-input);
  border-radius: 10px;
  background: #fff;
}
.ed-dec-input input {
  min-width: 0;
  width: 100%;
  padding: 7px 8px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: inherit;
  font-size: 16px;
  font-weight: 680;
}
.ed-dec-input > span { padding-right: 7px; color: var(--dec-muted); font-size: 11px; }
.ed-dec-input input::placeholder { opacity: 1; color: #6a7f97; }
.ed-dec-field.is-calculated .ed-dec-input { background: var(--dec-row); border-color: #d3e1f2; }
.ed-dec-field.is-calculated input::placeholder { color: var(--dec-blue); }
.ed-dec-input:has(input[aria-invalid=true]) { border-color: #a82935; }
.ed-dec-field small {
  width: fit-content;
  font-size: 11px;
  color: var(--dec-muted);
}
.ed-dec-field.is-calculated small { background: #e7eff9; color: #264e79; border-radius: 10px; padding: 1px 6px; }
.ed-dec-sales { margin-top: 8px; padding: 12px; border-radius: 15px; border: 1px solid #f0dfa5; background: #fff5d5; }
.ed-dec-sales h3 { font-size: 17px; }
.ed-dec-badge { display: flex; gap: 5px; align-items: center; white-space: nowrap; border-radius: 14px; padding: 3px 7px; background: var(--dec-gold); font-size: 12px; }
.ed-dec-start, .ed-dec-sales-preview, .ed-dec-mobile-back, .ed-decomp [data-action="step"] { display: none; }
.ed-dec-step + .ed-dec-step { border-top: 1px solid #eddfb5; }
.ed-dec-stage-edit { display: flex; align-items: end; justify-content: space-between; gap: 8px; margin-top: 7px; }
.ed-dec-stage-edit label { width: min(100%, 280px); }
.ed-decomp [data-action="remove"] { padding: 7px 8px; white-space: nowrap; }
.ed-decomp [data-action="add"] { margin-top: 7px; background: #fffdf6; color: #594411; border-color: #d9c786; }
.ed-dec-economy { background: #f9f5ea; }
.ed-dec-switch { display: inline-flex; flex-wrap: wrap; gap: 4px; align-items: center; padding: 4px; background: #f3f6fa; border-radius: 12px; }
.ed-decomp .ed-dec-switch button { padding: 6px 9px; border: 0; background: transparent; }
.ed-decomp .ed-dec-economy .ed-dec-switch button[aria-pressed=true] { background: var(--dec-gold); color: #28200c; }
.ed-dec-money { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; margin-top: 9px; }
.ed-dec-money .ed-dec-label { min-height: 32px; }
.ed-dec-economy details { margin-top: 10px; padding-top: 10px; border-top: 1px solid #e7dfca; }
.ed-dec-economy summary { color: var(--dec-blue); font-size: 14px; font-weight: 700; }
.ed-dec-economy .ed-dec-muted { margin: 7px 0 0; }
.ed-dec-result {
  min-width: 0;
  border-radius: 21px;
  background: var(--dec-dark);
  color: #fff;
  padding: 20px;
  scroll-margin-top: 115px;
}
.ed-decomp .ed-dec-result h2 { color: #fff; font-size: 23px; line-height: 1.15; margin-bottom: 10px; }
.ed-dec-result .ed-dec-switch { display: flex; gap: 4px; background: #24373c; margin-bottom: 13px; }
.ed-decomp .ed-dec-result .ed-dec-switch button { flex: 1 0 auto; color: #deedf0; }
.ed-decomp .ed-dec-result .ed-dec-switch button[aria-pressed=true] { color: #142329; background: #f9faf9; }
.ed-decomp .ed-dec-result-label { color: #bed2d5; font-size: 11px; letter-spacing: .07em; text-transform: uppercase; font-weight: 700; }
.ed-decomp .ed-dec-profit { color: var(--dec-gold); font-size: clamp(31px, 3.6vw, 49px); letter-spacing: -.05em; line-height: 1.1; font-weight: 850; overflow-wrap: anywhere; }
.ed-decomp .ed-dec-result-note { font-size: 13px; color: #bed2d5; margin-top: 4px; }
.ed-dec-result dl { margin: 9px 0 0; }
.ed-dec-result dl > div { display: flex; justify-content: space-between; align-items: center; gap: 7px; padding: 7px 0; border-bottom: 1px solid #ffffff28; }
.ed-dec-result dl > div:last-child { border: 0; }
.ed-dec-result dt { display: flex; gap: 4px; align-items: center; font-size: 12px; color: #e0eef0; }
.ed-dec-result dd { margin: 0; text-align: right; overflow-wrap: anywhere; font-size: 14px; font-weight: 700; }
.ed-dec-result :is([data-metric=drr], [data-metric=romi]) dd { color: var(--dec-gold); }
.ed-decomp .ed-dec-result .ed-dec-help { color: #eef8fa; background: #253c42; border-color: #7996a1; }
.ed-dec-bottom, .ed-decomp [data-action=close-result] { display: none; }
.ed-dec-message, .ed-dec-conflict { color: #842330; font-size: 13px; padding-top: 6px; }
.ed-dec-conflict > div { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.ed-decomp .ed-dec-conflict button { color: #842330; border-color: #ca9ba1; padding: 5px 8px; }
.ed-dec-tip {
  position: fixed;
  width: min(310px, calc(100vw - 16px));
  z-index: 10020;
  border: 1px solid #b9cce5;
  background: #fff;
  color: #172b46;
  border-radius: 12px;
  padding: 11px 13px;
  box-shadow: 0 10px 25px #12284a28;
  font-size: 13px;
}
.ed-dec-tip p { margin: 4px 0; }
.ed-dec-tip small:not(:empty) { display: block; background: #edf4ff; padding: 4px 6px; border-radius: 6px; font-size: 12px; }

@media (max-width: 920px) {
  .ed-tool-shell--decomposition { padding-inline: clamp(12px, 3vw, 27px); }
  .ed-dec-layout { grid-template-columns: minmax(0, 1fr); }
  .ed-dec-box { padding: 13px; }
  .ed-dec-money { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ed-dec-sales-preview, .ed-dec-mobile-back { display: block; }
  .ed-dec-sales-preview ul { list-style: none; margin: 7px 0; padding: 0; }
  .ed-dec-sales-preview li { display: flex; justify-content: space-between; gap: 8px; padding: 5px 0; border-bottom: 1px solid #efdfab; color: #534426; font-size: 13px; }
  .ed-dec-sales-preview li span { overflow-wrap: anywhere; }
  .ed-dec-sales-preview li b { color: var(--dec-blue); text-align: right; }
  .ed-decomp [data-action=edit-sales], .ed-decomp [data-action=back-sales] { background: #fffdf6; color: #594411; border-color: #d9c786; }
  .ed-dec-mobile-back { margin: 8px 0; }
  .ed-dec-sales-editor { display: none; }
  .ed-decomp[data-sales-editing=true] .ed-dec-sales-preview { display: none; }
  .ed-decomp[data-sales-editing=true] .ed-dec-sales-editor { display: block; }
  .ed-dec-start { display: flex; justify-content: space-between; gap: 8px; margin: 8px 0 4px; font-weight: 700; color: var(--dec-blue); }
  .ed-dec-step + .ed-dec-step { border: 0; }
  .ed-dec-step { margin: 6px 0; background: #fffdf7; border-radius: 10px; }
  .ed-decomp [data-action="step"] { display: grid; width: 100%; text-align: left; grid-template-columns: minmax(0, 1fr) auto 13px; align-items: center; gap: 6px; min-height: 46px; background: #fffdf7; border-color: #e8d9ac; }
  .ed-decomp [data-action="step"] span { overflow-wrap: anywhere; }
  .ed-decomp [data-action="step"] small { color: #4f6580; }
  .ed-dec-step[data-open=true] [data-action=step] { border-color: #be9826; }
  .ed-dec-step[data-open=true] [data-action=step] b { transform: rotate(180deg); }
  .ed-dec-step-body { display: none; padding-inline: 6px; }
  .ed-dec-step[data-open=true] .ed-dec-step-body, .ed-dec-step.has-conflict .ed-dec-step-body { display: block; }
  .ed-dec-result { display: none; }
  .ed-decomp[data-result-open=true] .ed-dec-result { display: block; }
  .ed-decomp [data-action=close-result] { display: inline-block; padding: 7px 9px; background: #263c42; color: #fff; border-color: #486068; }
  .ed-dec-bottom {
    position: sticky;
    z-index: 40;
    bottom: max(12px, env(safe-area-inset-bottom));
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    background: var(--dec-dark);
    color: #fff;
    padding: 8px 11px;
    margin-top: 12px;
    border-radius: 15px;
    box-shadow: 0 5px 20px #0f22273d;
    transition: visibility 0s 180ms;
  }
  .ed-decomp[data-result-open=true] .ed-dec-bottom { display: none; }
  .ed-decomp:has(input:focus) .ed-dec-bottom { visibility: hidden; transition-delay: 0s; }
  .ed-dec-bottom > div { min-width: 0; }
  .ed-dec-bottom [data-result] { display: block; color: var(--dec-gold); font-size: 19px; font-weight: 820; line-height: 1.12; overflow-wrap: anywhere; }
  .ed-dec-bottom small { color: #bed2d5; font-size: 11px; }
  .ed-decomp [data-action=open-result] { flex: none; min-height: 42px; padding: 6px 10px; background: #263c42; color: #fff; border-color: #486068; white-space: nowrap; }
}
@media (max-width: 500px) {
  .ed-tool-shell--decomposition .ed-tool-hero { margin-bottom: 14px; }
  .ed-dec-toolbar { justify-content: stretch; gap: 6px; }
  .ed-dec-toolbar label { flex: 1 1 100%; justify-content: space-between; }
  .ed-dec-toolbar > button { flex: 0 0 auto; }
  .ed-dec-formula { grid-template-columns: minmax(0, 1fr) 10px minmax(0, 1fr) 10px minmax(0, 1fr); gap: 3px; align-items: end; }
  .ed-dec-formula > span { font-size: 14px; margin-bottom: 20px; }
  .ed-dec-label { font-size: 11px; min-height: 23px; }
  .ed-dec-wide-label { display: none; }
  .ed-dec-short-label { display: inline; }
  .ed-decomp .ed-dec-label .ed-dec-help { width: 19px; height: 19px; }
  .ed-dec-field small { font-size: 9px; }
  .ed-dec-input input { padding-inline: 4px; }
  .ed-dec-input > span { padding-right: 3px; }
  .ed-dec-sales { padding: 8px; }
  .ed-dec-sales h3 { font-size: 14px; }
  .ed-dec-badge { font-size: 11px; }
  .ed-dec-result { padding: 15px; }
}
