/* =====================================================================================================
   theme-universal.css  -  ONE place for the controls that must always wear the THEME's dark tone.
   Loaded on every page after the legacy styles (selectors start with "html body" and use !important, so they win over the
   per-module rules and over the inline colours that the table renderers write).  Change the theme (any preset, light / dark
   view) and every control below follows by itself, because they all read the same variable: --ui-btn  (= the theme's dark tone, --tn / --ov-a).
   ===================================================================================================== */
html { --ui-btn: var(--tn, var(--ov-a, #1e3a8a)); --ui-btn-hv: color-mix(in srgb, var(--ui-btn) 78%, #000000); --ui-btn-bd: color-mix(in srgb, var(--ui-btn) 60%, #000000); --ui-btn-soft: color-mix(in srgb, var(--ui-btn) 22%, #ffffff); }

/* 1 + 2 + 3a)  "View" buttons in every table (all modules + every System Configuration tab) and the User Configuration "Log!" button.
   They are written by JS with an inline blue / teal background, so they are found by what they open. */
html body button[style*="background:#3b82f6"], html body button[style*="background: #3b82f6"],
html body button[onclick*="hc_openView"], html body button[onclick*="openAdminUcView"], html body button[onclick*="openFullLogModal"] {
  background: var(--ui-btn) !important; color: #ffffff !important; border-color: var(--ui-btn) !important; }
html body button[style*="background:#3b82f6"]:hover, html body button[style*="background: #3b82f6"]:hover,
html body button[onclick*="hc_openView"]:hover, html body button[onclick*="openAdminUcView"]:hover, html body button[onclick*="openFullLogModal"]:hover { background: var(--ui-btn-hv) !important; color: #ffffff !important; }
html body button[onclick*="hc_openView"] i, html body button[onclick*="openAdminUcView"] i { color: inherit !important; }

/* 3b)  "Add/Edit User" button of the User Configuration page (the minimised green state keeps its own colour) */
html body button#btn-add-edit-user.top-action-btn:not(.btn-new-min), html body button#btn-add-edit-user.top-action-btn:not(.btn-new-min):hover, html body button#btn-add-edit-user.top-action-btn:not(.btn-new-min):focus {
  background: var(--ui-btn) !important; background-color: var(--ui-btn) !important; color: #ffffff !important; }
html body button#btn-add-edit-user.top-action-btn:not(.btn-new-min):hover { background: var(--ui-btn-hv) !important; background-color: var(--ui-btn-hv) !important; }

/* 4)  Search / reset icon buttons (all themes, Royal Blue included - no blue is left, also on hover and when the box has focus) */
html body .univ-search-btn, html body .custom-search-btn-search { background: var(--ui-btn) !important; color: #ffffff !important; }
html body .custom-search-btn-search { border-color: var(--ui-btn) !important; }
html body .univ-search-btn:hover, html body .custom-search-btn-search:hover { background: var(--ui-btn-hv) !important; }
html body .univ-search-box:focus-within, html body .chrome-find-popup:focus-within { border-color: var(--ui-btn) !important; box-shadow: 0 0 0 3px color-mix(in srgb, var(--ui-btn) 35%, transparent) !important; }

/* 5)  Save & Apply: the Settings pop-up and the Info Banner tab ("dirty" = something to save).  Greyed-out state = a faded tone of the theme. */
html body #st-save.st-abtn.go, html body .ib-topsave.dirty { background: var(--ui-btn) !important; border-color: var(--ui-btn-bd) !important; color: #ffffff !important; }
html body #st-save.st-abtn.go:not(.dim):not(:disabled):hover, html body .ib-topsave.dirty:hover { background: var(--ui-btn-hv) !important; }
html body .ib-topsave:not(.dirty) { background: var(--ui-btn-soft) !important; border-color: color-mix(in srgb, var(--ui-btn) 35%, #ffffff) !important; color: color-mix(in srgb, var(--ui-btn) 65%, #ffffff) !important; }

/* 6)  The two arrows (left AND right) that appear when the filter box is wider than the screen */
html body .univ-scroll-left, html body .univ-scroll-right { color: var(--ui-btn) !important; }
html body .univ-scroll-left:hover, html body .univ-scroll-right:hover { color: var(--ui-btn-hv) !important; }

/* 7)  Process Claim: download-options icon */
html body .btn-shining-dl { background: var(--ui-btn) !important; border-color: var(--ui-btn-bd) !important; color: #ffffff !important; }
html body .btn-shining-dl:hover { background: var(--ui-btn-hv) !important; }

/* 8)  Header (module-name) tabs: 2px lower than before (32px -> 30px), the SAME height and baseline as the hamburger tab, text exactly in the middle */
html body .module-tab, html body .gear-btn { height: 30px; box-sizing: border-box; }
html body .module-tab { line-height: 30px; padding-top: 0; padding-bottom: 0; }
html body .gear-btn { line-height: 30px; padding-top: 0; padding-bottom: 0; }
html body .gear-btn i { vertical-align: middle; }

/* 9)  Parallel slanted: the LAST tab has a straight right wall that touches the boundary.
   - header: the last tab is the hamburger tab (every module tab before it keeps both walls slanted and the hamburger tab overlaps the joint like the other tabs do)
   - the other strips (System Configuration sub tabs, Settings pop-up tabs): the tab-last class is put on the last VISIBLE tab by ui-polish.js
     (the old ":not(:has(~ tab))" test also counted hidden tabs, so a hidden last tab left the visible last tab slanted) */
html[data-tabs="para"] body .module-tab:not(:has(~ .module-tab)) {
  clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%);
  --ring: polygon(evenodd, 0 0, 100% 0, 100% 100%, 0 100%, 0 0, calc(10px + var(--tl)) var(--t), calc(100% + 20px) var(--t), calc(100% + 20px) calc(100% + 3px), var(--tl) calc(100% + 3px), calc(10px + var(--tl)) var(--t)); }
html[data-tabs="para"] body #drawer-container { margin-left: -10px !important; margin-right: 0 !important; }
html[data-tabs="para"] body .gear-btn { clip-path: polygon(10px 0, 100% 0, 100% 100%, 0 100%); }
html[data-stabs="para"] body .h-tab-btn.tab-last { --cp: polygon(9px 0, 100% 0, 100% 100%, 0 100%); }
html[data-stabs="para"] body .h-tab-btn.tab-first { margin-left: 0 !important; }
html[data-ptabs="para"] body .st-ctab.tab-last { clip-path: polygon(10px 0, 100% 0, 100% 100%, 0 100%); margin-right: 0; padding-right: 18px; }

/* 10) External links: sub tabs pop up beside their main tab (login page = right side, hamburger drawer = left side), exactly 1px apart */
  /* ---------- External link sub tabs (popup tabs next to a main tab: login page = right side, drawer = left side) ---------- */
  .hdr-sub-pop { position: fixed; z-index: 600000000; display: flex; flex-direction: column; gap: 1px; }
  .hdr-sub-pop .hsp-btn { display: flex; align-items: center; justify-content: space-between; gap: 12px; white-space: nowrap; min-width: 150px; text-align: left; cursor: pointer; border-radius: 8px; font-family: inherit; }
  .hdr-sub-pop.hsp-side .hsp-btn { padding: 12px 20px; border: 1px solid transparent; background: #1e3a8a; color: #f1f5f9; font-size: 13.5px; font-weight: 600; box-shadow: 0 4px 10px rgba(0,0,0,0.25); transition: 0.25s; }
  .hdr-sub-pop.hsp-side .hsp-btn:hover { background: #60a5fa; color: #ffffff; transform: translateX(4px); }
  .hdr-sub-pop.hsp-side .hsp-btn i { font-size: 15px; opacity: .8; }
  html:not([data-theme="royal"]) .hdr-sub-pop.hsp-side .hsp-btn { background: var(--ov-p, var(--primary)); }
  html:not([data-theme="royal"]) .hdr-sub-pop.hsp-side .hsp-btn:hover { background: color-mix(in srgb, var(--ov-a, var(--accent)) 65%, #ffffff); }
  .hdr-sub-pop.hsp-drawer .hsp-btn { margin-bottom: 0; box-shadow: 0 4px 12px rgba(0,0,0,0.35); }
  .hdr-sub-pop.hsp-drawer .hsp-btn:hover { transform: translateX(-5px); }
  html.ui-dark .hdr-sub-pop.hsp-drawer { filter: invert(1) hue-rotate(180deg); }


/* 11) the header tab strip never gets its own up/down scroll arrows (they appeared between the last module tab and the hamburger tab) */
html body .right-tabs-box { overflow-y: hidden; }

/* =====================================================================================================
   12) ONE CLASS GROUP for every control that wears the theme's dark tone.
   To make any new button follow the theme, just add the class  th-tone-btn  (solid dark-tone button, white text)  or  th-tone-ol  (outlined; filled when it has .on).
   The ids / classes listed here are the ones that already existed: + New (User Connect messages).  (View / Log / Search / Save & Apply / arrows / download icon are in the sections above and use the same --ui-btn.)
   ===================================================================================================== */
html body .th-tone-btn, html body .uc-new-btn {
  background: var(--ui-btn) !important; color: #ffffff !important; border-color: var(--ui-btn) !important; }
html body .th-tone-btn:hover, html body .uc-new-btn:hover { background: var(--ui-btn-hv) !important; }
html body .uc-new-btn:hover { box-shadow: 0 5px 12px color-mix(in srgb, var(--ui-btn) 45%, transparent) !important; }
html body .th-tone-ol { background: #ffffff; color: var(--ui-btn) !important; border-color: var(--ui-btn) !important; }
html body .th-tone-ol:hover { background: var(--ui-btn-soft) !important; }
html body .th-tone-ol.on { background: var(--ui-btn) !important; color: #ffffff !important; }
