/* =====================================================================
   CIC Connect | assets/theme-fix.css
   Loaded by render.php AFTER app.css. app.css itself is untouched.

   Three faults, all of them visible to staff every day.

   1. AUTO WAS NOT DARK MODE.
      app.css carries 266 [data-theme="dark"] rules and only 11 for
      auto. Auto flipped the colour variables and repainted eight
      components; the other two hundred and fifty kept the light colour
      written into them by hand. That is why "follow my device" looked
      broken while "dark" looked fine, and why people gave up on auto.
      The block below mirrors every one of those dark rules onto auto,
      inside the device query, so the two are now identical by
      construction rather than by somebody remembering.
      It is generated from app.css, not retyped, so it cannot drift in
      the places a person would get bored.

   2. FOUR DARK RULES WERE LEAKING INTO LIGHT MODE.
      In a comma separated list only the first selector carried the
      [data-theme="dark"] prefix, so the rest applied in every theme:
      a selected mention, a menu hover, a word chip and a declined call
      icon were all painted dark on a light page. Put back below.

   3. A REPLY QUOTE WAS UNREADABLE IN DARK MODE.
      .cc-msgs .cc-m .cc-quote is three classes; the dark override is
      two, and both use !important, so the light rule won and the quote
      stayed near white. That is the bad background behind a reply.
      Repaired at matching specificity.
   ===================================================================== */

/* --- 1. auto follows the device, properly --------------------------- */
@media(prefers-color-scheme:dark){
  [data-theme="auto"]{--teal:#2E8F8A; --teal-d:#0B4D4A; --teal-l:#3FA9A3;
  --gold:#E0B84A; --cream:#121917; --ink:#E6EDEB;
  --line:#2A3835; --muted:#94A5A1; --white:#1A2320; --danger:#E45B5B;
  --shadow:0 1px 3px rgba(0,0,0,.5),0 6px 20px rgba(0,0,0,.35);
  color-scheme:dark;}
  [data-theme="auto"] .cc-top{background:#0B1614}
  [data-theme="auto"] .cc-side{background:#151E1B;border-right-color:var(--line)}
  [data-theme="auto"] .cc-tabs{background:#151E1B;border-top-color:var(--line)}
  [data-theme="auto"] .cc-card,
  [data-theme="auto"] .cc-inbox-side,
  [data-theme="auto"] .cc-grp,
  [data-theme="auto"] .cc-s-box,
  [data-theme="auto"] .cc-th-box,
  [data-theme="auto"] .cc-fw-box,
  [data-theme="auto"] .cc-np,
  [data-theme="auto"] .cc-upmodal-b{background:var(--white);border-color:var(--line)}
  [data-theme="auto"] input,
  [data-theme="auto"] select,
  [data-theme="auto"] textarea{background:#101917;color:var(--ink);border-color:var(--line)}
  [data-theme="auto"] input::placeholder,
  [data-theme="auto"] textarea::placeholder{color:#6C7C78}
  [data-theme="auto"] .cc-m-body{background:#22302C;color:var(--ink)}
  [data-theme="auto"] .cc-m.mine .cc-m-body{background:#14524E;color:#EAF3F1}
  [data-theme="auto"] .cc-quote{background:rgba(255,255,255,.08)!important;color:#DCE9E7!important}
  [data-theme="auto"] .cc-quote b{color:var(--gold)!important}
  [data-theme="auto"] .cc-quote span{color:#B9C9C5!important}
  [data-theme="auto"] .cc-chat-pane{background:#0E1614!important;background-image:none!important}
  [data-theme="auto"] .cc-daysep span{background:#1E2A27;border-color:var(--line);color:var(--muted)}
  [data-theme="auto"] .cc-agrow,
  [data-theme="auto"] .cc-agbuild,
  [data-theme="auto"] .cc-people,
  [data-theme="auto"] .cc-picklist,
  [data-theme="auto"] .cc-deptchip,
  [data-theme="auto"] .cc-cdm,
  [data-theme="auto"] .cc-ef,
  [data-theme="auto"] .cc-guardbox,
  [data-theme="auto"] .cc-agenda li,
  [data-theme="auto"] .cc-spk-p,
  [data-theme="auto"] .cc-tx,
  [data-theme="auto"] .cc-casegrid,
  [data-theme="auto"] .cc-lettertpl-b,
  [data-theme="auto"] .cc-serie{background:#1B2522;border-color:var(--line)}
  [data-theme="auto"] .cc-casebody{background:#101917;border-color:var(--line)}
  [data-theme="auto"] .cc-botsum{background:#241F12;border-color:var(--gold)}
  [data-theme="auto"] .cc-bot{background:#151E1B;border-top-color:var(--line)}
  [data-theme="auto"] .cc-bot-o{background:#101917;border-color:var(--teal);color:var(--teal-l)}
  [data-theme="auto"] .cc-np-row.unread{background:#241F12}
  [data-theme="auto"] .cc-np-top,
  [data-theme="auto"] .cc-s-top,
  [data-theme="auto"] .cc-th-top{background:#101917;border-color:var(--line)}
  [data-theme="auto"] .cc-ct:hover,
  [data-theme="auto"] .cc-qk:hover,
  [data-theme="auto"] .cc-s-r:hover,
  [data-theme="auto"] .cc-pick:hover{background:#1B2522}
  [data-theme="auto"] .btn-ghost{color:var(--teal-l);border-color:var(--teal-l)}
  [data-theme="auto"] mark{background:var(--gold);color:#121917}
  [data-theme="auto"] img.cc-brand-logo{filter:none}
  [data-theme="auto"] .cc-theme{background:#101917}
  [data-theme="auto"] .cc-sndbtn{background:#101917}
  [data-theme="auto"] .cc-g-top{background:#101917}
  [data-theme="auto"] .cc-g-sec h4 i{background:#1B2522}
  [data-theme="auto"] .cc-g-r:hover{background:#1B2522}
  [data-theme="auto"] .cc-svrow:hover{background:#1B2522}
  [data-theme="auto"] .cc-svbar{background:#1B2522}
  [data-theme="auto"] .cc-svbar-f{background:rgba(46,143,138,.28)}
  [data-theme="auto"] .cc-svtexts p{background:#1B2522}
  [data-theme="auto"] .cc-vopt:hover{background:#1B2522}
  [data-theme="auto"] .cc-vopt:has(input:checked){background:#14332F}
  [data-theme="auto"] .cc-calhow div{background:#1B2522}
  [data-theme="auto"] .cc-rp-top{background:#101917}
  [data-theme="auto"] .cc-rp-r:hover{background:#1B2522}
  [data-theme="auto"] .cc-annbar-important{background:#241F12}
  [data-theme="auto"] .cc-annbar-urgent{background:#2A1616}
  [data-theme="auto"] .cc-ann{background:#1B2522}
  [data-theme="auto"] .cc-anbar{background:#2A3835}
  [data-theme="auto"] .cc-engrow.on{background:#1B2522}
  [data-theme="auto"] .cc-rol li{background:#1B2522}
  [data-theme="auto"] .cc-rq{background:#241F12}
  [data-theme="auto"] .cc-rhint{background:#1B2522}
  [data-theme="auto"] .cc-pv{background:#101917}
  [data-theme="auto"] .cc-board{background:#0F1615}
  [data-theme="auto"] .cc-up-i{background:#1B2522}
  [data-theme="auto"] .cc-up-k{background:#12312E}
  [data-theme="auto"] .cc-up-c{background:#12312E}
  [data-theme="auto"] .cc-up-i.near{background:#241F12}
  [data-theme="auto"] .cc-agrow,
  [data-theme="auto"] .cc-auth,
  [data-theme="auto"] .cc-bg-panel,
  [data-theme="auto"] .cc-bot-o,
  [data-theme="auto"] .cc-burger span,
  [data-theme="auto"] .cc-call-note,
  [data-theme="auto"] .cc-card,
  [data-theme="auto"] .cc-casebody,
  [data-theme="auto"] .cc-cbtn.off,
  [data-theme="auto"] .cc-cbtn.on svg,
  [data-theme="auto"] .cc-chan-filter,
  [data-theme="auto"] .cc-composer #ccBody,
  [data-theme="auto"] .cc-composer textarea,
  [data-theme="auto"] .cc-countdown,
  [data-theme="auto"] .cc-day span,
  [data-theme="auto"] .cc-emoji,
  [data-theme="auto"] .cc-emoji-tabs button.on,
  [data-theme="auto"] .cc-evhead-code input,
  [data-theme="auto"] .cc-macts,
  [data-theme="auto"] .cc-mentions,
  [data-theme="auto"] .cc-notif form button,
  [data-theme="auto"] .cc-np,
  [data-theme="auto"] .cc-people-count,
  [data-theme="auto"] .cc-picker,
  [data-theme="auto"] .cc-picklist,
  [data-theme="auto"] .cc-pin-chip,
  [data-theme="auto"] .cc-pollopt,
  [data-theme="auto"] .cc-post-menu-p,
  [data-theme="auto"] .cc-qr,
  [data-theme="auto"] .cc-quote:hover,
  [data-theme="auto"] .cc-qvote,
  [data-theme="auto"] .cc-reserve,
  [data-theme="auto"] .cc-rx-b,
  [data-theme="auto"] .cc-s-box,
  [data-theme="auto"] .cc-share-agenda,
  [data-theme="auto"] .cc-share-cta,
  [data-theme="auto"] .cc-share-panel,
  [data-theme="auto"] .cc-side,
  [data-theme="auto"] .cc-sys,
  [data-theme="auto"] .cc-tabs,
  [data-theme="auto"] .cc-th-box,
  [data-theme="auto"] .cc-upmodal-b,
  [data-theme="auto"] .cc-wp-o,
  [data-theme="auto"] .cc-wp-panel,
  [data-theme="auto"] input[type=text]{background:var(--white)}
  [data-theme="auto"] .cc-acct,
  [data-theme="auto"] .cc-att,
  [data-theme="auto"] .cc-bg-x,
  [data-theme="auto"] .cc-bgo,
  [data-theme="auto"] .cc-cal-add,
  [data-theme="auto"] .cc-callnote,
  [data-theme="auto"] .cc-cd-u,
  [data-theme="auto"] .cc-cdm:hover,
  [data-theme="auto"] .cc-chan:hover,
  [data-theme="auto"] .cc-clip:hover,
  [data-theme="auto"] .cc-cover-p,
  [data-theme="auto"] .cc-cp-btn:hover,
  [data-theme="auto"] .cc-ct:hover,
  [data-theme="auto"] .cc-ctab,
  [data-theme="auto"] .cc-deptcard:hover,
  [data-theme="auto"] .cc-emoji-page button:hover,
  [data-theme="auto"] .cc-enrol,
  [data-theme="auto"] .cc-ev:hover,
  [data-theme="auto"] .cc-evhead-code,
  [data-theme="auto"] .cc-guardbox,
  [data-theme="auto"] .cc-hact:hover,
  [data-theme="auto"] .cc-m-body,
  [data-theme="auto"] .cc-m-file,
  [data-theme="auto"] .cc-macts button:hover,
  [data-theme="auto"] .cc-mentions button:hover,
  [data-theme="auto"] .cc-mic:hover,
  [data-theme="auto"] .cc-np-more:hover,
  [data-theme="auto"] .cc-pick i,
  [data-theme="auto"] .cc-picker button:hover,
  [data-theme="auto"] .cc-post-act:hover,
  [data-theme="auto"] .cc-post-menu-p a:hover,
  [data-theme="auto"] .cc-pushbox,
  [data-theme="auto"] .cc-qk:hover,
  [data-theme="auto"] .cc-replybar,
  [data-theme="auto"] .cc-sgguard,
  [data-theme="auto"] .cc-sp-code,
  [data-theme="auto"] .cc-tagcloud a,
  [data-theme="auto"] .cc-voice{background:#212D29}
  [data-theme="auto"] .cc-agbuild,
  [data-theme="auto"] .cc-agenda li,
  [data-theme="auto"] .cc-agmins input,
  [data-theme="auto"] .cc-audience,
  [data-theme="auto"] .cc-bot,
  [data-theme="auto"] .cc-casegrid,
  [data-theme="auto"] .cc-cdm,
  [data-theme="auto"] .cc-deptcard,
  [data-theme="auto"] .cc-deptchip,
  [data-theme="auto"] .cc-dgrp summary:hover,
  [data-theme="auto"] .cc-ef,
  [data-theme="auto"] .cc-emoji-tabs,
  [data-theme="auto"] .cc-inbox-d:hover,
  [data-theme="auto"] .cc-lettertpl-b,
  [data-theme="auto"] .cc-newp:hover,
  [data-theme="auto"] .cc-np-more,
  [data-theme="auto"] .cc-np-row:hover,
  [data-theme="auto"] .cc-np-top,
  [data-theme="auto"] .cc-people,
  [data-theme="auto"] .cc-pick:hover,
  [data-theme="auto"] .cc-proof,
  [data-theme="auto"] .cc-qtext,
  [data-theme="auto"] .cc-rep,
  [data-theme="auto"] .cc-s-r:hover,
  [data-theme="auto"] .cc-s-top,
  [data-theme="auto"] .cc-spk-p,
  [data-theme="auto"] .cc-spkrow,
  [data-theme="auto"] .cc-th-top,
  [data-theme="auto"] .cc-tx{background:#1E2926}
  [data-theme="auto"] .cc-callrow-ico,
  [data-theme="auto"] .cc-enrol.on,
  [data-theme="auto"] .cc-evloc,
  [data-theme="auto"] .cc-myrep-res,
  [data-theme="auto"] .cc-pollbar,
  [data-theme="auto"] .cc-qa-ans,
  [data-theme="auto"] .cc-qvote.on,
  [data-theme="auto"] .cc-rx-b.mine,
  [data-theme="auto"] .cc-s-h i{background:#14403C}
  [data-theme="auto"] .cc-await,
  [data-theme="auto"] .cc-flash-info,
  [data-theme="auto"] .cc-minorbox,
  [data-theme="auto"] .cc-post-state.pending{background:#3A2F14}
  [data-theme="auto"] .cc-delbox,
  [data-theme="auto"] .cc-msgs-err,
  [data-theme="auto"] .cc-post-state.rejected,
  [data-theme="auto"] .cc-rec{background:#3A1D1D}
  [data-theme="auto"] .cc-bg-x:hover,
  [data-theme="auto"] .cc-bot-p,
  [data-theme="auto"] .cc-efbar,
  [data-theme="auto"] .cc-ev-tag.ended{background:#2A3835}
  [data-theme="auto"] .cc-agrow-x:hover,
  [data-theme="auto"] .cc-callrow-ico.missed,
  [data-theme="auto"] .cc-ef-x:hover,
  [data-theme="auto"] .cc-wordchip.block{background:#4A2020}
  [data-theme="auto"] .cc-botsum,
  [data-theme="auto"] .cc-np-row.unread,
  [data-theme="auto"] .cc-th-m.root{background:#262218}
  [data-theme="auto"] .cc-sys:hover,
  [data-theme="auto"] table.cc-t tr:hover td{background:#1E2926}
  [data-theme="auto"] .cc-chat-list,
  [data-theme="auto"] .cc-composer{background:#161F1D}
  [data-theme="auto"] .cc-callnote.internal,
  [data-theme="auto"] .cc-m.internal .cc-m-body{background:#3A2F14}
  [data-theme="auto"] .cc-flash-ok{background:#14352B}
  [data-theme="auto"] .cc-flash-err{background:#3A1D1D}
  [data-theme="auto"] .cc-b-active{background:#14352B}
  [data-theme="auto"] .cc-b-pending{background:#3A2F14}
  [data-theme="auto"] .cc-b-suspended{background:#4A2020}
  [data-theme="auto"] .cc-b-archived{background:#2A3835}
  [data-theme="auto"] .cc-pins{background:#302819}
  [data-theme="auto"] 0%{background:#4A3C15}
  [data-theme="auto"] .cc-pollopt.on .cc-pollbar{background:#1A544F}
  [data-theme="auto"] .cc-dgrp-l{background:#1E2926}
  [data-theme="auto"] .cc-dot{color:#2B2410}
  [data-theme="auto"] .btn-gold{color:#2b1f05}
  [data-theme="auto"] .cc-post-state.rejected strong,
  [data-theme="auto"] .cc-post-state.rejected span,
  [data-theme="auto"] .cc-delbox h3{color:#FF9B9B}
  [data-theme="auto"] .cc-chan-filter,
  [data-theme="auto"] .cc-pin-chip,
  [data-theme="auto"] .cc-macts,
  [data-theme="auto"] .cc-rx-b,
  [data-theme="auto"] .cc-picker,
  [data-theme="auto"] .cc-mentions,
  [data-theme="auto"] .cc-qvote,
  [data-theme="auto"] .cc-share-cta,
  [data-theme="auto"] .cc-call-note,
  [data-theme="auto"] .cc-post-menu-p,
  [data-theme="auto"] .cc-share-panel,
  [data-theme="auto"] .cc-reserve,
  [data-theme="auto"] .cc-countdown,
  [data-theme="auto"] .cc-wp-panel,
  [data-theme="auto"] .cc-emoji,
  [data-theme="auto"] .cc-pollopt,
  [data-theme="auto"] .cc-auth,
  [data-theme="auto"] .cc-sys,
  [data-theme="auto"] .cc-qr{border-color:var(--line)}
  [data-theme="auto"] .cc-cbtn.on svg{background:transparent}
  [data-theme="auto"] .cc-burger span{background:var(--ink)}
  [data-theme="auto"] [style*="background:#fff"],
  [data-theme="auto"] [style*="background: #fff"],
  [data-theme="auto"] [style*="background:#FFF"]{background:var(--white)!important;color:var(--ink)}
}

/* --- 2. put the leaked rules back into light ------------------------ */
:root:not([data-theme="dark"]) .cc-mentions button.on{
  background:var(--teal);color:#fff}
:root:not([data-theme="dark"]) .cc-post-menu-p button:hover{
  background:#F1EDE3;color:var(--ink)}
:root:not([data-theme="dark"]) .cc-wordchip{
  background:#F1EDE3;color:var(--ink)}
:root:not([data-theme="dark"]) .cc-callrow-ico.declined{
  background:#FEE2E2}

/* Auto on a dark device wants the dark values back. */
@media(prefers-color-scheme:dark){
  [data-theme="auto"] .cc-mentions button.on,
  [data-theme="auto"] .cc-post-menu-p button:hover,
  [data-theme="auto"] .cc-wordchip{background:#212D29;color:var(--ink)}
  [data-theme="auto"] .cc-callrow-ico.declined{background:#4A2020}
}

/* --- 3. the reply quote, at a specificity that actually wins --------
   Matching .cc-msgs .cc-m .cc-quote class for class, so the theme
   decides the colour rather than the order the file happens to be in. */
[data-theme="dark"] .cc-msgs .cc-m .cc-quote{
  background:rgba(245,241,232,.09)!important;color:#DCE9E7!important}
[data-theme="dark"] .cc-msgs .cc-m .cc-quote b{color:var(--gold)!important}
[data-theme="dark"] .cc-msgs .cc-m .cc-quote span{color:#B9C9C5!important}
[data-theme="dark"] .cc-msgs .cc-m .cc-quote:hover{
  background:rgba(245,241,232,.15)!important}
[data-theme="dark"] .cc-msgs .cc-m.mine .cc-quote{
  background:rgba(0,0,0,.34)!important;color:#EAF3F1!important}

@media(prefers-color-scheme:dark){
  [data-theme="auto"] .cc-msgs .cc-m .cc-quote{
    background:rgba(245,241,232,.09)!important;color:#DCE9E7!important}
  [data-theme="auto"] .cc-msgs .cc-m .cc-quote b{color:var(--gold)!important}
  [data-theme="auto"] .cc-msgs .cc-m .cc-quote span{color:#B9C9C5!important}
  [data-theme="auto"] .cc-msgs .cc-m .cc-quote:hover{
    background:rgba(245,241,232,.15)!important}
  [data-theme="auto"] .cc-msgs .cc-m.mine .cc-quote{
    background:rgba(0,0,0,.34)!important;color:#EAF3F1!important}
}
