/* Shared U-tool interface tokens. Loaded after feature styles. */
:root{--ui-control:32px;--ui-radius:8px;--ui-gap:8px;--ui-border:#3c304b;--ui-panel:#17121f;--ui-muted:#a99bb9}
body{font-size:13px}
:is(button,.dash-pop summary){min-height:var(--ui-control)!important;padding:6px 10px!important;border-radius:var(--ui-radius)!important;font-size:12px!important;line-height:18px!important;box-shadow:none!important}
button{border:1px solid var(--ui-border);background:#241b30;font-weight:600}
button:hover:not(:disabled){background:#30223f;border-color:#9c72ce}
button.primary{background:#8754cf;border-color:#a77ce4}
button.ghost{background:transparent}
:is(input,select,textarea):not([type=checkbox]):not([type=radio]){min-height:var(--ui-control)!important;padding:6px 9px!important;border-radius:var(--ui-radius)!important;font-size:13px!important;line-height:18px!important;border-color:var(--ui-border);background:#110e19;box-shadow:none}
label{font-size:11px!important;gap:5px!important;line-height:1.45}
label.check{font-size:12px!important;gap:7px!important}
input:is([type=checkbox],[type=radio]){width:15px!important;height:15px!important;min-height:15px!important;accent-color:#a477ff}
:is(.page-head,.report-heading,.dash-heading){display:flex!important;flex-flow:row wrap!important;align-items:center!important;justify-content:flex-end!important;gap:10px!important;margin:20px 0 14px!important;min-height:0!important}
:is(.page-head,.report-heading,.dash-heading)>h1{flex:0 0 100%;width:100%;font-size:23px!important;line-height:1.3;margin:0 0 3px!important;letter-spacing:-.4px}
:is(.page-head,.report-heading,.dash-heading)>div:has(h1){flex:0 0 100%;width:100%}
.head-actions{margin-left:auto!important;justify-content:flex-end!important;gap:6px!important;flex-wrap:wrap}
.section-profile-picker{max-width:280px;margin-left:0!important}
:is(.tabs,.rule-tabs,.company-tabs){display:flex;gap:5px!important;flex-wrap:wrap;padding:0 0 8px!important;margin-bottom:12px!important;border-radius:0;background:transparent;box-shadow:none}
:is(.tabs,.rule-tabs) button{border:1px solid var(--ui-border)!important;background:#1d1628}
:is(.tabs,.rule-tabs) button.active{background:#382448;border-color:#9868c5!important;color:#e2c9ff}
:is(.toolbar,.dash-toolbar,.report-controls,.rule-toolbar,.asset-toolbar){gap:8px!important;padding:10px 12px!important;margin-bottom:12px!important;border-radius:var(--ui-radius)!important;flex-wrap:wrap}
:is(.panel,.record,.stat,.rule-card,.company-template,.company-job){border-radius:10px!important;border-color:var(--ui-border);box-shadow:none}
:is(.panel-pad,.record,.stat,.rule-card,.company-template,.company-job){padding:12px!important}
.panel{margin-bottom:12px!important}
.panel-head{padding:10px 12px!important;gap:8px}
.panel-head h2{font-size:14px!important}
:is(.form-grid,.cards,.stats,.split){gap:12px!important}
:is(.inline,.record-actions,.rule-tools){gap:6px!important}
:is(.record-actions,.rule-card-bottom,.company-template>.inline){justify-content:flex-end}
:is(.company-templates,.company-jobs,.rule-list){gap:9px!important}
.rule-card h2{font-size:15px;margin-bottom:8px}
.rule-expression{margin:12px 0 10px 24px;font-size:13px;gap:7px}
.rule-card-scope{margin:0 0 10px 24px;gap:12px}
.rule-card-bottom{padding-top:10px}
.rule-tabs{margin-bottom:0!important;border:0}
.rule-tools{flex-wrap:wrap}
.stat-value{font-size:25px;margin:8px 0 5px}
:is(th,td){padding:9px 12px!important;font-size:12px}
th{font-size:11px}
.pill{font-size:10px!important;padding:3px 6px!important;border-radius:5px!important}
.cell-sub{font-size:11px;color:var(--ui-muted);margin-top:4px}
.notice{font-size:12px!important;line-height:1.5!important;padding:9px 12px!important;border-radius:8px!important;margin-bottom:12px!important}
.empty{min-height:130px;padding:22px}
.empty h3{font-size:15px!important}
.empty p{font-size:12px!important}
.nav{gap:3px}.nav a{padding:9px 10px;font-size:12px;border-radius:7px}
.modal{width:min(760px,100%);max-height:90vh;border-radius:12px!important;border-color:#604375;background:#191321}
:is(.modal-header,.modal-footer){padding:11px 14px!important;gap:8px!important}
.modal-header h2{font-size:16px!important}
.modal-body{padding:14px!important}
.modal-body>.form-grid{gap:12px!important}
.company-editor .modal-body{gap:10px}
:is(.dash-pop>div,.rule-picker-menu){border:1px solid var(--ui-border);border-radius:10px!important;padding:12px!important;background:#1c1526;box-shadow:0 12px 35px #0006}
:is(.asset-row,.dash-option){padding:8px 10px!important;font-size:12px}
.modal .company-preview{padding:10px;margin-top:10px;font-size:12px}
.ui-icon-button{display:inline-flex!important;align-items:center;justify-content:center;width:32px!important;min-width:32px!important;height:32px!important;padding:6px!important;flex:0 0 32px;vertical-align:middle}
.ui-icon-button svg{width:16px;height:16px;display:block;pointer-events:none}
.ui-icon-button[data-ui-icon=delete]{color:#ff879a}
@media(max-width:700px){:root{--ui-control:36px}.main{padding-left:12px;padding-right:12px}.head-actions{width:100%}.section-profile-picker{max-width:none;width:100%}.ui-icon-button{width:36px!important;height:36px!important;min-width:36px!important;flex-basis:36px}.rule-toolbar{align-items:stretch}.rule-tools{width:100%}.rule-tools input,.rule-tools select{flex:1;min-width:130px}.modal{max-height:95vh}}
.creative-drop{padding:18px;border:1px dashed #9465bc;border-radius:9px;display:grid;gap:5px;text-align:center;cursor:pointer;margin-bottom:10px;background:#21172c}.creative-drop span{font-size:11px;color:#ad9cbf}.creative-drop.dragging{background:#39264d;border-color:#c99aff}.creative-file{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:6px 0}.creative-file span{overflow-wrap:anywhere}#creative-list{margin-bottom:12px}

/* Campaign / ad set / ad hierarchy. */
#modal-form.bundle-editor{width:min(1320px,96vw);max-width:1320px}
.bundle-editor .modal-body{padding:14px;overflow:auto}
.bundle-name{max-width:440px;margin-bottom:12px}
.bundle-columns{display:grid;grid-template-columns:minmax(220px,.9fr) minmax(280px,1.15fr) minmax(230px,1fr);gap:12px;align-items:start}
.bundle-column{min-width:0;border:1px solid var(--border,#293247);border-radius:10px;overflow:hidden}
.bundle-column>h3{display:flex;align-items:center;gap:8px;margin:0;padding:11px 12px;border-bottom:1px solid var(--border,#293247);font-size:13px}
.bundle-column>h3>span{display:grid;place-items:center;width:22px;height:22px;border-radius:6px;background:var(--surface-2,#202b40);font-size:11px}
.bundle-column-body{display:flex;flex-direction:column;gap:10px;padding:12px}
.bundle-column-body .hint{margin:-5px 0 0;font-size:11px}
.bundle-column-body .form-grid{gap:8px}
.bundle-column-body textarea{min-height:72px;field-sizing:content}
.bundle-divider{font-size:11px;font-weight:600;color:var(--muted,#96a2b5);border-top:1px solid var(--border,#293247);padding-top:12px;margin-top:2px}
.placement-groups{display:grid;gap:8px}
.placement-group{margin:0;padding:7px 10px 10px;border:1px solid var(--border,#293247);border-radius:7px;min-width:0}
.placement-group legend{padding:0 4px;font-weight:600}
.placement-group label{display:flex;align-items:center;gap:7px;font-size:12px;margin:5px 0}
.placement-group>label{padding-left:8px}
.placement-group input[type=checkbox]{width:14px;height:14px;flex-shrink:0}
.bundle-editor [hidden]{display:none!important}
@media(max-width:1000px){.bundle-columns{grid-template-columns:1fr}.bundle-name{max-width:none}}

/* Compact, readable template conversation previews. */
.company-templates{gap:10px}
.company-template{padding:12px!important;gap:10px!important}
.company-template-body{min-width:0}
.company-template-body>h3{font-size:13px;margin:0 0 7px!important;line-height:1.4}
.template-thread,.template-replies{list-style:none;padding:0;margin:0}
.template-thread{font-size:12px;line-height:1.5;min-width:0}
.template-message-row{display:flex;align-items:flex-start;gap:7px;padding:4px 0;min-width:0}
.template-message-icon{display:inline-flex;flex:0 0 16px;width:16px;height:18px;align-items:center;color:var(--muted,#9894aa)}
.template-message-icon svg{width:16px;height:16px}
.is-comment>.template-message-row>.template-message-icon{color:var(--purple,#a477ff)}
.template-message-text{white-space:pre-wrap;overflow-wrap:anywhere;min-width:0}
.template-replies{margin:1px 0 2px 7px;padding-left:15px;border-left:1px solid var(--line,#333043)}
.template-replies .template-message-row{gap:6px}
.company-template>.inline{gap:6px;justify-content:flex-end;margin-top:6px}
.company-template-toolbar{margin-bottom:10px!important;gap:10px}
.company-template-toolbar input[type=text],.company-template-toolbar input[type=search]{max-width:360px}
#modal-form .check:has(.template-thread){align-items:flex-start;padding:9px 0;border-bottom:1px solid var(--line,#333043)}
#modal-form .check:has(.template-thread)>span{min-width:0;flex:1}
#modal-form .check:has(.template-thread)>input{margin-top:4px}
@media(max-width:600px){.template-replies{padding-left:10px;margin-left:5px}}
.thread-image-controls{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin:6px 0}
.thread-image-picker{position:relative;display:inline-flex!important;align-items:center;min-height:28px;padding:4px 9px;border:1px solid var(--line);border-radius:7px;overflow:hidden;cursor:pointer;font-size:11px!important}
.thread-image-picker input[type=file]{position:absolute;inset:0;width:100%;height:100%;opacity:0;cursor:pointer}
.thread-image-picker:focus-within{outline:2px solid var(--purple);outline-offset:2px}
.thread-image-preview{display:flex;align-items:center;gap:8px;max-width:100%;min-width:0}
.thread-image-preview img,.thread-comment-image{width:76px;height:64px;object-fit:cover;border:1px solid var(--line);border-radius:7px}
.thread-image-preview span{max-width:190px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:11px}
.thread-comment-image{width:auto;height:auto;max-width:220px;max-height:160px;object-fit:contain}
.target-picker{position:relative;min-width:0}
.target-picker>label{display:block;font-size:11px;color:var(--muted);margin-bottom:5px}
.target-picker summary{display:flex;justify-content:space-between;gap:8px;align-items:center;list-style:none;min-height:32px;padding:7px 9px;border:1px solid var(--line);border-radius:7px;cursor:pointer;font-size:12px}
.target-picker summary::-webkit-details-marker{display:none}
.target-picker summary>[data-picker-summary]{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.target-picker details[open]>summary{border-color:var(--purple)}
.target-picker-popover{margin-top:5px;border:1px solid var(--line);border-radius:8px;padding:8px;background:var(--panel);box-shadow:0 8px 24px #0003}
.target-picker-popover>input{width:100%}
.target-picker-tools{display:flex;align-items:center;justify-content:space-between;gap:6px;margin:7px 0;font-size:10px;color:var(--muted)}
.target-picker-options{max-height:235px;overflow-y:auto;overscroll-behavior:contain}
.target-picker-option{display:flex!important;align-items:center;gap:7px;padding:6px 4px;margin:0!important;cursor:pointer;font-size:12px!important;border-radius:4px}
.target-picker-option:hover{background:#a477ff12}
.target-picker-option>input{width:14px!important;height:14px!important;flex:0 0 14px}
.target-picker-option>span{flex:1;min-width:0}
.target-picker-option small{font-size:10px;color:var(--muted)}
.target-picker-option>span>small{display:block}

#modal-form.bundle-editor,#modal-form.campaign-launch-editor{display:flex;flex-direction:column;overflow:hidden}
.bundle-editor .modal-header,.bundle-editor .modal-footer,.campaign-launch-editor .modal-header,.campaign-launch-editor .modal-footer{flex:0 0 auto}
.bundle-editor .modal-body,.campaign-launch-editor .modal-body{flex:1;min-height:0;overflow:auto}
.campaign-launch-editor [hidden]{display:none!important}
