/* V6.3.188: shared controls and active-theme surfaces.
   Keep semantic badges, chart series, schedule colours and clock rings intact. */
:root {
  --ui-text:#17283b; --ui-muted:#526579; --ui-surface:#ffffff;
  --ui-soft:#f2f6fa; --ui-border:#7b8da0; --ui-field:#ffffff;
  --ui-placeholder:#526579; --ui-focus:#146b53;
}
html[data-theme="night"] {
  color-scheme:dark;
  --ui-text:#edf5fc; --ui-muted:#c2d3e3; --ui-surface:#13283b;
  --ui-soft:#1a344b; --ui-border:#7894ad; --ui-field:#0e2133;
  --ui-placeholder:#b3c5d5; --ui-focus:#63dfbc;
  /* Older component styles use these aliases instead of theme-text. */
  --text:var(--ui-text); --panel:var(--ui-surface); --card:var(--ui-surface);
  --surface:var(--ui-surface); --border:#496780; --line:#496780;
}
:is(main,dialog,.ta-drawer,.notification-drawer,.personal-note-modal,.unsaved-modal)
  :is(input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]):not([type="submit"]):not([type="button"]),select,textarea) {
  box-sizing:border-box; min-width:0;
  border:1.5px solid var(--ui-border)!important; border-radius:8px;
  background:var(--ui-field)!important; color:var(--ui-text)!important;
  padding:9px 11px; font-family:inherit; line-height:1.35;
}
:is(main,dialog,.ta-drawer,.notification-drawer) :is(input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]),select) {min-height:40px}
:is(main,dialog,.ta-drawer,.notification-drawer) :is(input,textarea)::placeholder {
  color:var(--ui-placeholder)!important; opacity:1;
}
:is(main,dialog,.ta-drawer,.notification-drawer) select option {
  background:var(--ui-field); color:var(--ui-text);
}
:is(main,dialog,.ta-drawer,.notification-drawer) :is(input[type="checkbox"],input[type="radio"]) {
  accent-color:#087657; flex-shrink:0;
}
:is(main,dialog,.ta-drawer,.notification-drawer) input[type="file"] {
  border:1.5px solid var(--ui-border)!important; border-radius:8px;
  background:var(--ui-field)!important; color:var(--ui-text)!important;
  padding:8px; max-width:100%; min-width:0;
}
:is(main,dialog,.ta-drawer,.notification-drawer) input[type="file"]::file-selector-button {
  padding:7px 10px; margin-right:10px; border:1px solid var(--ui-border);
  border-radius:6px; background:var(--ui-soft); color:var(--ui-text);
  font:inherit; cursor:pointer;
}
:is(main,dialog,.ta-drawer,.notification-drawer) :is(input,select,textarea,[contenteditable="true"],button,a,summary):focus-visible {
  outline:2px solid var(--ui-focus)!important; outline-offset:3px;
}
:is(main,dialog,.ta-drawer,.notification-drawer) :is(input,select,textarea,button):disabled {
  opacity:.7; cursor:not-allowed;
}
:is(main,dialog,.ta-drawer) :is(input,textarea)[readonly] {
  background:var(--ui-soft)!important; border-style:dashed!important;
}
:is(main,dialog,.ta-drawer) [contenteditable="true"] {
  background:var(--ui-field)!important; color:var(--ui-text)!important;
  border:1.5px solid var(--ui-border); border-radius:8px;
}
.case-reply-editor:empty::before {color:var(--ui-placeholder)!important}
:is(.form-actions,.drawer-action-footer,.personal-note-actions,.leave-type-detail-actions,.pay-dialog-actions,.template-actions) {
  gap:8px; align-items:center; flex-wrap:wrap;
}
:is(.form-actions,.drawer-action-footer,.personal-note-actions,.leave-type-detail-actions,.pay-dialog-actions,.template-actions) :is(button,.btn,.button) {
  min-height:40px; margin-top:0; line-height:1.35;
}
.ui-stack-form>label {margin:14px 0 6px; line-height:1.4}
.ui-stack-form>label:first-child {margin-top:0}
.ui-stack-form>.form-actions {display:flex; justify-content:flex-end; margin-top:18px}
.ui-stack-form>textarea {resize:vertical}
:is(main,dialog) :is(button.secondary,a.button.secondary,a.btn.secondary) {
  background:var(--ui-soft)!important; color:var(--ui-text)!important;
  border:1px solid var(--ui-border)!important;
}
:is(main,dialog) :is(button.danger,a.button.danger,a.btn.danger) {
  background:#a42632!important; color:#fff!important; border:1px solid #a42632!important;
}
:is(main,dialog) :is(button.danger,a.button.danger,a.btn.danger):hover {background:#831d27!important}
html[data-theme="night"] :is(main,dialog) :is(button.danger,a.button.danger,a.btn.danger) {
  background:#8a263a!important; color:#fff!important; border-color:#e27b8e!important;
}
html[data-theme="night"] :is(dialog,.unsaved-modal,.org-multi-popover,.quicktext-menu) {
  background:var(--ui-surface)!important; color:var(--ui-text)!important;
  border-color:var(--ui-border)!important;
}
html[data-theme="night"] dialog::backdrop {background:rgba(3,12,22,.72)}
html[data-theme="night"] :is(main,dialog,.ta-drawer) label {color:var(--ui-text)}
html[data-theme="night"] :is(.teams-rail,.teams-conversation,.conversation-head,.conversation-feed,.teams-composer,.channel-post,.thread-reply,.inline-reply,.message-welcome,.welcome-action,.email-message-list,.email-connect-empty,.case-hero,.case-card,.rich-reply-editor,.signature-preview,.reply-preview,.template-library-item,.permission-row,.permissions-section,.leave-type-row,.pay-rule-line,.kanban .deal) {
  background:var(--ui-surface)!important; color:var(--ui-text)!important;
  border-color:#496780!important;
}
html[data-theme="night"] :is(.customer-detail-box,.case-number,.open-age,.badge-count,.rich-reply-toolbar,.quicktext-shortcut-input,.quicktext-choice,.welcome-action:hover,.kanban .column,.calendar-day,.agenda-day,.agenda-head,.weekdays,.cal-event,.calendar-legend .legend) {
  background:var(--ui-soft)!important; color:var(--ui-text)!important;
  border-color:#496780!important;
}
html[data-theme="night"] .support-message.inbound {background:#152f46!important;color:var(--ui-text)!important;border-color:#496780!important}
html[data-theme="night"] .support-message.outbound {background:#193a53!important;color:var(--ui-text)!important}
html[data-theme="night"] .support-message.internal {background:#3b3020!important;color:#fff0cf!important}
html[data-theme="night"] :is(.case-title p,.customer-detail-box span,.kv span,.case-fact small,.muted-empty,.life-step,.life-step.done,.post-meta,.welcome-action-hint,.rail-empty,.email-message-main p,.org-multi-field>span small,.org-multi-dropdown summary small,.prospect-question-help,.prospect-previous-answer,.prospect-data-source,.call-outcome-help,.pay-condition-explainer,.template-library-item p,.reply-preview p,.signature-preview p) {
  color:var(--ui-muted)!important;
}
html[data-theme="night"] :is(.messagebody,.post-body,.thread-reply,.case-reply-editor,.quicktext-choice span,.quicktext-choice strong,.team-name,.conversation-head h2,.permission-grid-head,.permission-row label,.leave-type-identity,.pay-rule-condition,.pay-rule-result) {color:var(--ui-text)!important}
html[data-theme="night"] :is(.case-mini-actions a,.case-mini-actions button,.rich-reply-toolbar .editor-tool,.case-tab,.template-tab,.template-tab:not(.active),.quicktext-choice) {
  background:var(--ui-soft)!important; color:var(--ui-text)!important;
  border-color:var(--ui-border)!important;
}
html[data-theme="night"] :is(.case-tab.active,.template-tab.active) {background:#235f50!important;color:#fff!important;border-color:#63dfbc!important}
html[data-theme="night"] :is(.quicktext-choice:hover,.quicktext-choice:focus-visible) {background:#284c67!important}
html[data-theme="night"] .quicktext-shortcut {background:#284c67!important;color:#e1f0ff!important}
html[data-theme="night"] :is(.related-row strong,.recent-row strong,.messagebody a,.case-reply-editor a,.agenda-head a,.month-more,.calendar-nav a) {color:#a9d7ff!important}
html[data-theme="night"] :is(.sla-good,.leave-summary-remaining) {color:#9fe9c5!important}
.life-step.done {opacity:1; text-decoration:none}
html[data-theme="night"] :is(.drawer-action-error,.form-error,.field-error,.error-message) {color:#ffb4b4!important}
/* Chart labels change; series fills, strokes and schedule colours do not. */
html[data-theme="night"] :is(.bi-page,.ci-page,.campaign-report) svg text {fill:var(--ui-muted)}
html[data-theme="night"] :is(.teams-person,.channel-link,.message-welcome h2,.welcome-grid b,.post-actions button) {color:var(--ui-text)!important}
html[data-theme="night"] :is(.direct-bubble,.msg-quick-create,.lifecycle-current,.lifecycle-next,.contact-edit-form,.wizard-help-box,.wizard-choice-question,.create-review-grid>div) {background:var(--ui-soft)!important;color:var(--ui-text)!important;border-color:#496780!important}
html[data-theme="night"] .direct-bubble.mine {background:#193a53!important}
html[data-theme="night"] :is(.teams-rail-title,.teams-person small,.team-name small,.conversation-head p,.teams-composer>div,.post-meta time,.post-meta small,.direct-bubble small,.thread-reply small,.quicktext-choice small) {color:var(--ui-muted)!important}
html[data-theme="night"] :is(.ci-kpis small,.ci-bar small,.ci-rank,.ci-empty,.bi-kpi small,.bi-card p,.bi-filterbar label,.lifecycle-current strong,.lifecycle-next strong) {color:var(--ui-muted)!important}
html[data-theme="night"] .company-locked-form :is(input,select,textarea):disabled {background:var(--ui-soft)!important;color:var(--ui-muted)!important;border-color:var(--ui-border)!important}
@media(max-width:600px) {
  .ui-stack-form>.form-actions {justify-content:stretch}
  .ui-stack-form>.form-actions>* {flex:1 1 auto; text-align:center}
}

/* V6.3.191: Cold Calling status badge legibility */
.prospect-status-badge { color:#172b45 !important; background:#edf3fa !important; border-color:#91a9c4 !important; }
html[data-theme="night"] .prospect-status-badge { color:#f5f9ff !important; background:#253b56 !important; border-color:#7594b8 !important; }
