main { max-width: 1180px; }
#settings-title, #development-title { margin-top: 0; font-size: 1.2rem; }
#sum-settings label { display: block; font-weight: 650; margin: 12px 0 7px; }
#sum-settings input { width: 100%; min-height: 48px; padding: 12px; font: inherit; color: var(--text); background: white; border: 1px solid var(--border); border-radius: 9px; }
#general-term { font-family: ui-monospace, monospace !important; }
.bounds-fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px; max-width: 330px; }
#syntax-help, #bounds-help, #math-status { color: var(--muted); font-size: .9rem; }
#syntax-help code { display: inline-block; }
#input-error { color: #a52f2f; }
#input-error:empty { display: none; }
#development { margin-top: 24px; }
#formula-line { text-align: center; font-size: 1.25rem; overflow-x: auto; padding: 20px 0; }
#expansion { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px 8px; margin: 24px 0; }
.sum-group { max-width: 100%; overflow-x: auto; }
.sum-pair { display: flex; align-items: center; gap: 5px; padding: 4px; }
.sum-term { position: relative; background: white; color: var(--text); min-height: 76px; padding: 12px 8px; border: 1px solid var(--border); border-radius: 8px; }
.sum-term.cancelled { color: #72828c; background: #f4f6f7; }
.sum-term.cancelled::after { content: ''; position: absolute; top: 50%; left: 6%; width: 88%; height: 2px; background: #677b89; transform: rotate(-28deg); pointer-events: none; }
.sum-parenthesis { font-size: 2.8rem; font-weight: 300; }
.sum-index { color: #88949f; text-align: center; font-size: .85rem; margin: 4px 0; }
.sum-plus, .sum-dots { padding-top: 30px; }
#status { min-height: 24px; }
@media(max-width: 540px){ .bounds-fields { gap: 10px; } .sum-term { padding-inline: 5px; } }


#formula-line { display: flex; align-items: center; justify-content: safe center; gap: 8px; }
#formula-line > span { flex-shrink: 0; }
#status:empty { display: none; }

.sum-term.remaining-term { background: #d9efcf; border-color: #59870b; color: #0c355c; }

.sum-fields { display: grid; gap: 12px 18px; max-width: 730px; align-items: end; }
.general-field { min-width: 0; max-width: 360px; }
.bounds-fields > div { min-width: 0; }
@media(min-width: 850px) {
  .sum-fields { grid-template-columns: minmax(0,360px) minmax(0,330px); }
  .bounds-fields { gap: 18px; }
}
