/* Advanced extends existing tables; primary-cell padding and geometry stay untouched. */
.model-mode-tools{display:flex;align-items:center;gap:6px;flex-wrap:wrap;font-size:.72rem}
.model-mode-toggle{display:inline-flex;border:1px solid #d9dfd7;border-radius:6px;overflow:hidden}
.model-mode-toggle button{border:0;border-radius:0;background:transparent;font:inherit;padding:5px 8px;min-height:28px}
.model-mode-toggle button[aria-pressed="true"]{background:#183e32;color:#fff}
.model-scenario-label{display:flex;align-items:center;gap:4px}
.model-scenario-label select{max-width:125px;font:inherit;padding:4px}
.model-toolbar-menu{position:relative}
.model-toolbar-menu summary{cursor:pointer;min-height:28px;display:flex;align-items:center;padding:3px 6px}
.model-menu{position:absolute;right:0;top:100%;z-index:30;width:240px;background:white;padding:12px;border:1px solid #cbd5ca;box-shadow:0 8px 24px #16332626;display:grid;gap:8px}
.model-menu p{font-size:.75rem;line-height:1.5;margin:0}.model-menu input{width:100%;min-width:0}
.model-collapse{font-size:.7rem!important;min-height:28px!important}
.model-notice{font-size:.8rem;color:#7c321c;background:#fff2e8;padding:8px 12px;margin:8px 0}
#statement-grid [data-model-disclosure]{position:relative}
#statement-grid [data-model-disclosure]::after{content:'›';position:absolute;left:100%;margin-left:4px;color:#547763;pointer-events:none}
#statement-grid [data-model-disclosure][aria-expanded="true"]::after{content:'⌄'}
#model [data-cell]{position:relative;cursor:text;color:#145b8b}
#model [data-cell]:hover{background:#edf5fa}
#model [data-cell]:focus-visible{outline:2px solid #26745a;outline-offset:-2px;background:#edf5fa}
#model .model-cell-editor{position:absolute;inset:0;box-sizing:border-box;width:100%;height:100%;min-width:0;min-height:0;border:2px solid #26745a;border-radius:0;background:#fff;font:inherit;color:#173d32;text-align:inherit;padding:3px 5px;z-index:5}
#model .model-cell-editor[aria-invalid="true"]{border-color:#a03621}
#model .model-detail th,#model .model-detail td{background:#f7f9f6;padding:5px 8px;font-size:.72rem;line-height:1.45;vertical-align:middle;overflow-wrap:anywhere}
#model .model-detail th{font-weight:400;min-width:0;max-width:none;white-space:normal}
#model .model-detail td{min-width:0}
#model .model-detail.depth-1 th{padding-left:12px}
#model .model-detail.depth-2 th{padding-left:20px}
#model .model-detail.depth-3 th{padding-left:28px}
#model .model-detail.depth-4 th{padding-left:36px}
#model .model-detail button{font:inherit;padding:2px 3px;min-width:24px;min-height:24px;border:0;background:transparent;color:#215641;border-radius:2px}
#model .model-detail button:hover{background:#e2ecdf}
#model .model-detail .model-line-name{display:inline-block;min-width:30px;max-width:calc(100% - 51px);vertical-align:middle}
#model .model-calculated{color:#535e55}
#model [data-inactive="true"]{opacity:.55}
#model .model-inline-rule{display:flex;flex-wrap:wrap;align-items:center;gap:5px;text-align:left;max-width:100%;white-space:normal}
#model .model-inline-rule input,#model .model-inline-rule select{font:inherit;min-height:30px;max-width:140px;min-width:0;padding:3px;border:1px solid #c7d4c5;border-radius:3px;background:white}
#model .model-inline-rule input{width:100px}
#model .model-inline-rule small{flex-basis:100%;line-height:1.5;color:#526151}
#model .rule-group,#model .rule-condition{display:inline-flex;flex-wrap:wrap;gap:4px;align-items:center}
@media(max-width:700px){.model-mode-tools{gap:4px}.model-scenario-label{font-size:0}.model-scenario-label select{font-size:.72rem;max-width:110px}.model-menu{position:fixed;top:20%;left:5%;right:auto;max-width:90vw}.model-collapse{font-size:.65rem!important}#model .model-detail button{min-height:28px}}
@media(max-width:700px){#model .history-controls{flex-wrap:wrap;min-width:0;max-width:100%}.model-mode-tools{flex:1 1 100%;min-width:0}}
