/* Block-based selection shares the institution's existing typography and controls. */
.policy-builder[hidden],.policy-preview[hidden],.policy-error[hidden]{display:none!important}
.policy-builder{margin:18px 0 24px;scroll-margin-top:100px;padding:22px;min-width:0}
.policy-top,.policy-toolbar,.policy-secondary,.policy-editor-actions,.policy-library-row,.policy-footer,.policy-preview-heading,.policy-sort-heading,.policy-pair{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.policy-top,.policy-preview-heading{justify-content:space-between}.policy-top h3,.policy-preview-heading h3{margin:0}.policy-top p{margin:8px 0;color:var(--slate-600)}
.policy-toolbar{margin:16px 0}.policy-toolbar label{flex:1;min-width:170px;max-width:330px}.policy-state{font-size:.82rem;color:var(--slate-600)}.policy-state.dirty{color:#9b286b}.policy-secondary{margin:10px 0 18px}
.policy-workspace{display:grid;grid-template-columns:minmax(220px,1fr) minmax(0,2fr);gap:18px;align-items:start;min-width:0}
.policy-blocks{min-width:0;display:grid;gap:9px}.policy-block-card{margin-inline-start:calc(var(--policy-depth)*10px);padding:9px;border:1px solid #e4dce4;border-radius:12px;background:#fff;min-width:0;display:flex;align-items:center;gap:7px}.policy-block-card.is-active{border-color:var(--institution-accent);background:#fff5fb}.policy-block-card.is-disabled{opacity:.65}.policy-block-title{display:flex;gap:9px;align-items:flex-start;flex:1;text-align:right;min-width:0;border:0;background:transparent;color:inherit;cursor:pointer;font:inherit;padding:5px}.policy-block-title span:last-child{min-width:0}.policy-block-title strong{font-size:.84rem}.policy-block-title small{display:block;font-size:.74rem;color:var(--slate-600);margin-top:7px;overflow-wrap:anywhere;line-height:1.8}.policy-number{background:#f5e6f0;border-radius:7px;padding:4px 7px;flex-shrink:0}.policy-card-actions{display:flex;flex-direction:column;gap:4px}.policy-card-actions .btn{padding:3px 10px;min-height:32px}
.policy-editor{border:1px solid #e5dfe5;border-radius:12px;padding:16px;min-width:0;scroll-margin-top:100px}.policy-editor-heading{display:flex;gap:14px;align-items:center;flex-wrap:wrap}.policy-editor-heading>label:first-child{flex:1}.policy-editor .check-line{display:flex;align-items:center;gap:8px}.policy-editor .check-line input{width:auto!important;min-height:0!important}.policy-editor input,.policy-editor select,.policy-toolbar input,.policy-library select{width:100%;min-width:0}.policy-rule{margin:14px 0;padding:10px 12px;border:1px solid #eadfe7;border-radius:10px}.policy-rule>summary{cursor:pointer;font-size:.82rem;overflow-wrap:anywhere;padding:7px 0;color:#64475b}.policy-fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin:12px 0}.policy-selector{min-width:0;background:#fbf8fa;padding:11px;border-radius:9px}.policy-selector label{display:block;font-size:.81rem}.policy-selector .btn{margin-top:8px;max-width:100%;white-space:normal;font-size:.75rem}.policy-selector small{display:block;margin-top:7px;color:#625968;font-size:.73rem;overflow-wrap:anywhere}.policy-unresolved{outline:1px solid #b83d56;background:#fff5f6}.policy-more,.policy-order,.policy-library{margin:16px 0;border-top:1px solid #eadfe7;padding-top:12px}.policy-more>summary,.policy-order>summary,.policy-library>summary,.policy-preview summary{cursor:pointer;color:#835773;padding:8px 0}.policy-rest{margin:18px 0}.policy-editor-actions{margin-top:18px}.policy-library-row{margin:12px 0}.policy-library-row label{flex:1;min-width:190px}.policy-library-row select{min-height:40px}
.policy-order>ol,.policy-value-order{padding:0;list-style:none;margin:12px 0;display:grid;gap:10px}.policy-sort-field{border:1px solid #e8dfe5;border-radius:8px;padding:10px}.policy-sort-heading{justify-content:space-between}.policy-sort-heading strong{font-size:.81rem}.policy-sort-heading .btn,.policy-value-order .btn{padding:4px 9px;min-height:34px}.policy-value-order li{display:flex;align-items:center;gap:8px;justify-content:space-between;border-top:1px solid #ede5ea;padding-top:6px;font-size:.77rem}.policy-value-order li>span{overflow-wrap:anywhere}.policy-value-order li>div{flex-shrink:0}.policy-error{padding:12px;margin:12px 0;background:#fff0f1;color:#9b263c;border-radius:8px}.policy-preview{margin-top:24px;border-top:2px solid #e5ccdc;padding-top:20px;scroll-margin-top:100px}.policy-table-wrap{overflow:auto;max-width:100%;margin:12px 0}.policy-table{width:100%;border-collapse:collapse;font-size:.78rem;min-width:570px}.policy-table th,.policy-table td{padding:10px;border-bottom:1px solid #ece3e9;text-align:right;vertical-align:top}.policy-table th{background:#fbf3f8;color:#655161}.policy-table small{display:block;color:#786c75;margin-top:6px}.policy-table td{overflow-wrap:anywhere}.policy-table td:first-child{white-space:nowrap}.policy-table p{line-height:1.9}.policy-pagination{display:flex;align-items:center;justify-content:center;gap:9px;flex-wrap:wrap;margin:12px 0;font-size:.79rem}.policy-footer{justify-content:space-between;margin:20px 0 8px}.policy-pair{padding:12px 0;border-bottom:1px solid #eee0e9;justify-content:space-between;font-size:.81rem}
dialog.policy-choice-dialog{width:min(680px,calc(100vw - 24px));max-height:calc(100dvh - 32px);padding:20px;border:1px solid #dbc9d6;border-radius:15px;background:white;color:#393442;overflow:auto;box-shadow:0 18px 60px #30203533}dialog.policy-choice-dialog::backdrop{background:#20132366}.policy-choice-heading{display:flex;align-items:center;justify-content:space-between;gap:10px}.policy-choice-heading h3{font-size:1rem}.policy-choice-dialog input[type=search]{width:100%;min-height:44px;font:inherit;border:1px solid #d9cdda;border-radius:9px;padding:10px}.policy-choice-actions{display:flex;gap:9px;flex-wrap:wrap;margin:12px 0}.policy-choice-options{max-height:350px;overflow:auto;border:1px solid #e7dee4;border-radius:9px}.policy-choice-option{display:flex;gap:10px;align-items:center;padding:10px 12px;min-height:44px;cursor:pointer;font-size:.83rem;border-bottom:1px solid #f0e8ed}.policy-choice-option input{width:18px;min-width:18px;height:18px;accent-color:var(--institution-accent)}.policy-choice-option span{overflow-wrap:anywhere}.policy-choice-footer{padding-top:12px}.policy-choice-footer>span{font-size:.8rem;color:#6d5968}.policy-origin{margin-top:8px;padding:8px;border-radius:6px;background:#fdf1f8;color:#7b3764;font-size:.75rem}.manual-final-limit{padding:10px 13px;margin:8px 0 14px;border:1px solid #dfcfda;border-radius:9px;background:#fbf5f9;font-size:.82rem}.manual-final-limit.over-limit{background:#fff2eb;border-color:#e7b69b;color:#883911}.manual-table tr.over-final-limit td{background:#fff9f4}.policy-final-warning{padding:16px;border:1px solid #a84327;color:#85351f}
@media(max-width:1000px){.policy-workspace{grid-template-columns:1fr}.policy-blocks{grid-template-columns:repeat(2,minmax(0,1fr))}.policy-block-card{margin-inline-start:0}.policy-block-card[style*="--policy-depth:1"],.policy-block-card[style*="--policy-depth:2"],.policy-block-card[style*="--policy-depth:3"]{border-inline-start:4px solid #ddb7d0}}
@media(max-width:580px){.policy-builder{padding:13px}.policy-editor{padding:11px}.policy-fields,.policy-blocks{grid-template-columns:1fr}.policy-toolbar .btn{flex:1;min-width:140px}.policy-toolbar label{max-width:none;flex-basis:100%}.policy-rule{padding:9px}.policy-sort-heading{align-items:flex-start}.policy-sort-heading>div{display:flex;gap:4px;flex-wrap:wrap}.policy-choice-dialog{padding:12px!important}.policy-choice-dialog input[type=search]{font-size:16px}.policy-choice-options{max-height:300px}.policy-footer .btn{flex:1}.policy-library-row{align-items:stretch;flex-direction:column}}
@media(pointer:coarse){.policy-builder .btn,.policy-choice-dialog .btn{min-height:44px}.policy-card-actions .btn,.policy-sort-heading .btn,.policy-value-order .btn{min-width:44px}.policy-builder input,.policy-builder select{font-size:16px!important}}
@media print{.policy-builder,#open-selection-policy,.manual-final-limit,.policy-choice-dialog{display:none!important}.policy-origin{background:none;color:#333}}
