/* Shared settings: neutral inherited values, blue editors, amber pending changes. */
.input-settings-body { display:flex; flex-direction:column; gap:10px; padding:12px 14px; }
.input-settings-current { display:flex; flex-wrap:wrap; align-items:center; gap:4px 12px; }
.input-settings-panel[open] > summary, .calculation-policy-panel[open] > summary { background:#eef5ff; border-bottom:1px solid #cedff4; }
.input-presets { max-width:none; border:0; padding:0; }
.input-presets > .form-label { margin-bottom:4px; }
.input-presets-selection { display:flex; gap:8px; align-items:start; }
.input-presets-selection > .preset-picker { flex:1; min-width:0; }
.input-presets-selection > button { flex-shrink:0; min-height:36px; }
.input-presets-actions { display:flex; gap:8px; flex-wrap:wrap; align-items:center; margin-top:8px; }
.input-presets > [role=status]:not([hidden]) { display:inline-block; margin-top:6px; padding:3px 7px; border-radius:4px; }
.input-settings-more { border:0; padding:0; }
.input-settings-more > summary { color:#425f7d; font-size:13px; }
.input-settings-more > p { margin:8px 0; }
.settings-source { display:inline-block; font-size:12px; line-height:1.45; color:#52657b; overflow-wrap:anywhere; }
.settings-source-own { color:#195797; background:#eaf3ff; padding:2px 6px; border-radius:4px; }
.settings-state { font-size:12px; color:#52657b; overflow-wrap:anywhere; }
.settings-state-pending { color:#77500d; background:#fff2d5; border-radius:4px; padding:4px 8px; }
.preset-library-form { max-width:1600px; margin-inline:auto; }
.preset-identity { display:grid; grid-template-columns:minmax(0,2fr) minmax(0,1fr); gap:12px 20px; }
.preset-section { border:1px solid #d5dfeb; border-radius:6px; }
.preset-section > summary { padding:10px 12px; overflow-wrap:anywhere; }
.preset-section[open] > summary { background:#eef5ff; border-bottom:1px solid #d5dfeb; }
.preset-section-body { padding:0 12px; }
.preset-setting { padding:12px 0; border-bottom:1px solid #e1e7ef; min-width:0; }
.preset-setting:last-child { border-bottom:0; }
.preset-setting-heading { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:4px 10px; margin-bottom:8px; }
.preset-inherited-value { display:flex; gap:8px 20px; justify-content:space-between; align-items:start; flex-wrap:wrap; }
.preset-structure-preview { display:flex; flex-direction:column; gap:6px; min-width:0; }
.preset-structure-preview > div { display:flex; gap:4px 12px; flex-wrap:wrap; overflow-wrap:anywhere; }
.preset-row-actions { display:flex; flex-wrap:wrap; gap:4px; }
.preset-setting [data-preset-value-area] > label { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); }
.preset-setting [data-preset-value-area] > .form-control,.preset-setting [data-preset-value-area] > .form-select { max-width:680px; }
.preset-reset { padding-left:0; margin-top:6px; }
.preset-setting-reset { border-left:3px solid #c39129; background:#fffbf2; padding-left:10px; }
.preset-add-setting { margin-top:12px; }
.preset-add-setting > summary { color:#195797; }
.preset-save-bar { position:sticky; bottom:0; z-index:12; display:flex; align-items:center; justify-content:flex-end; flex-wrap:wrap; gap:8px; padding:12px; background:#fff; border:1px solid #d5dfeb; border-radius:6px; box-shadow:0 -3px 10px #203a5610; }
.preset-save-bar > [role=status] { margin-right:auto; }
.template-card { border:1px solid #d5dfeb; border-radius:6px; margin-bottom:8px; background:#fff; min-width:0; }
.template-card > summary { padding:10px 12px; overflow-wrap:anywhere; }
.template-card > summary > strong { margin-right:12px; }
.template-card > summary > .settings-source { margin-left:10px; }
.template-card[open] { border-color:#8db4e5; }
.template-card[open] > summary { background:#eef5ff; border-bottom:1px solid #d5e3f4; }
.template-row-description { font-size:12px; color:#52657b; }
.template-card-body { padding:12px; }
.template-parameter-grid { display:grid; grid-template-columns:minmax(0,1fr) minmax(120px,.45fr); gap:10px 20px; padding-top:0; align-items:start; }
.template-field { min-width:0; }
.template-field > label { display:block; font-size:13px; margin-bottom:4px; }
.template-field-product { grid-column:1 / -1; order:1; }
.template-field > small { display:block; margin-bottom:4px; font-size:12px; }
.template-field input[type=number] { width:9ch; min-width:86px; max-width:100%; }
.template-field > .settings-source { margin-top:4px; margin-right:8px; }
.template-field-reset { padding:2px 0; font-size:12px; vertical-align:baseline; }
.template-extra { margin-top:12px; }
.template-extra > summary { font-size:13px; color:#425f7d; overflow-wrap:anywhere; }
.template-extra[open] > .template-parameter-grid { margin-top:10px; }
.template-remove { padding:4px 0; margin-top:10px; }
@media(max-width:600px) {
    .preset-identity,.template-parameter-grid { grid-template-columns:minmax(0,1fr); }
    .template-card-body { padding:10px; }
    .preset-section-body { padding:0 8px; }
    .preset-save-bar > [role=status] { flex-basis:100%; }
    .preset-save-bar > .btn { flex:1; }
    .template-row-description { display:block; margin-top:4px; }
    .template-card > summary > .settings-source { margin:4px 0 0; }
    .input-settings-current .settings-state { flex-basis:100%; }
    .template-field-reset { min-height:36px; }
}
.input-settings-tools { display:flex; flex-wrap:wrap; align-items:start; gap:8px 24px; border-top:1px solid #e0e7ef; padding-top:8px; }
.input-settings-tools > details[open] { flex-basis:100%; }
.input-settings-tools > .selection-conditions { margin-top:0!important; }
.template-card[open] > summary > .settings-source-own { display:none; }
/* Also used by Django admin, where Bootstrap controls are not loaded. */
.template-field .form-control,.template-field .form-select { box-sizing:border-box; width:100%; min-height:36px; padding:7px 10px; border:1px solid #c5d3e2; border-radius:4px; background-color:#fff; color:#193657; }
.template-field-reset,.template-remove { background:transparent; border:0; color:#195797; cursor:pointer; text-decoration:underline; }
.template-remove { color:#b42318; }
.settings-source[hidden],.template-card [hidden] { display:none!important; }

/* Server-declared sections; controls stay mounted while switching or filtering. */
.preset-browser { display:grid; grid-template-columns:minmax(180px,250px) minmax(0,1fr); gap:20px; align-items:start; }
.preset-browser-content { min-width:0; }
.preset-navigation { position:sticky; top:12px; max-height:75vh; overflow:auto; display:flex; flex-direction:column; gap:3px; padding:6px; border:1px solid #d5dfeb; border-radius:8px; background:#f7f9fc; }
.preset-nav-button { display:flex; justify-content:space-between; gap:8px; border:0; border-radius:5px; padding:9px 10px; background:transparent; color:#354e69; text-align:left; overflow-wrap:anywhere; }
.preset-nav-button[aria-current=true] { background:#deebfc; color:#124e9b; font-weight:600; }
.preset-nav-button:hover { background:#eaf1fa; }
.preset-nav-button:focus-visible { outline:2px solid #1769c2; outline-offset:1px; }
.preset-nav-button span { font-size:12px; color:#52657b; }
.preset-browser-tools { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:8px; margin-bottom:12px; }
.preset-differences { display:flex; gap:8px; align-items:center; font-size:14px; }
.preset-related { display:flex; align-items:center; flex-wrap:wrap; gap:4px; padding:10px 0; color:#52657b; font-size:13px; }
.preset-browser [hidden] { display:none!important; }
@media(max-width:800px){
 .preset-browser { grid-template-columns:minmax(0,1fr);gap:12px; }
 .preset-navigation { position:static; max-height:220px; display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); }
 .preset-nav-button { min-width:0; font-size:13px; min-height:44px; }
}

.template-numeric-header,.template-numeric-row > .template-card-body { display:grid; grid-template-columns:repeat(var(--template-numeric-columns,2),minmax(90px,1fr)) minmax(70px,.5fr); gap:10px; align-items:start; padding:10px; }
.template-numeric-header { background:#f0f4f9; border-radius:6px 6px 0 0; font-size:13px; }
.template-numeric-row { border-radius:0; margin-bottom:0; }
.template-numeric-row > summary[hidden],.template-numeric-row .template-extra { display:none; }
.template-numeric-row .template-parameter-grid { display:contents; }
.template-numeric-row .template-field > label { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); }
.template-numeric-row .template-remove { margin:0;align-self:start; }
.template-numeric-row .template-field-reset { display:block; }
@media(max-width:400px){.template-numeric-header,.template-numeric-row > .template-card-body { grid-template-columns:minmax(70px,1fr) minmax(70px,1fr) 60px;gap:6px;padding:8px 5px; } .template-numeric-row .template-field input[type=number] {min-width:0;width:100%;} }

@media(max-width:600px){ .template-numeric-wide .template-numeric-header {display:none;} .template-numeric-wide .template-card-body {grid-template-columns:minmax(0,1fr);} .template-numeric-wide .template-field > label {position:static;width:auto;height:auto;clip-path:none;} }

.preset-common-source {font-size:12px;color:#52657b;padding:10px 0 0;margin:0;}
[data-common-source] .preset-setting:not(.preset-setting-reset) .preset-setting-heading > [data-preset-source] {display:none;}
.preset-skip-link {font-size:12px;padding:8px 10px;}
/* The numeric table has one section source; keep per-cell descriptions for assistive tools. */
.template-numeric-row .settings-source {position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);}
.template-numeric-row .template-field input[type=number] {width:100%;max-width:none;min-width:0;}
.template-numeric-row .template-field-reset {font-size:12px;font-weight:400;padding:2px 0;}
@media(max-width:400px){
 .template-numeric-header,.template-numeric-row > .template-card-body {grid-template-columns:repeat(var(--template-numeric-columns,2),minmax(0,1fr)) 28px;}
 .template-numeric-row .template-remove {font-size:0;min-width:28px;min-height:36px;}
 .template-numeric-row .template-remove::after {content:'×';font-size:24px;line-height:1;}
 .template-numeric-header > :last-child {font-size:0;}
 .template-numeric-wide .template-card-body {grid-template-columns:minmax(0,1fr);}
}
