/*
 * SportsHub styles - every page and view uses this one file (linked from html/index.html and the
 * pages built in utils/SessionFunc.prg: company selection, error pages - utils/ViewFunc.prg).
 *
 *  1. Palette & Bootstrap overrides
 *  2. App shell: sidebar, content area
 *  3. Busy spinner & confirm popup (files/uhttpd2/uhttpd2.js)
 *  4. Account editor header & tabs (html/account/account_edit.html)
 *  5. Account tabs
 *  6. Pages outside the app shell (company selection, error pages)
 *  7. Phones / narrow screens
 */

/* ===== 1. Palette & Bootstrap overrides =====
   Official palette - header/sidebar and headings: primary; buttons and active navigation:
   primary-variant; page background: secondary; text on dark backgrounds: white */
:root {
  --color-primary: #00354B;
  --color-primary-variant: #004158;
  --color-secondary: #F8F9FA;

  /* neutrals and effects shared by every part of the app (Bootstrap's greys) */
  --sh-surface: #FFFFFF;          /* cards, panels, dropdowns */
  --sh-on-primary: #FFFFFF;       /* text on primary backgrounds */
  --sh-text: #212529;
  --sh-muted: #6C757D;
  --sh-border: #DEE2E6;
  --sh-border-input: #CED4DA;
  --sh-subtle: #EEF1F4;           /* table heads, separators, ID chips */
  --sh-hover: #EEF4F7;            /* highlighted list items */
  --sh-row-hover: #F3F7FA;        /* table rows under the mouse */
  --sh-shadow: 0 1px 3px rgba(0,53,75,.06);
  --sh-shadow-lg: 0 8px 24px rgba(0,53,75,.18);
  --sh-focus-ring: 0 0 0 3px rgba(0,65,88,.15);

  --sh-qs-h: 52px;                /* the quick search bar above every page */
}

/* One text size for the whole app: Bootstrap and these styles size everything in rem, so the app's
   root size sets body text, fields, labels, buttons, tables, menus and dialogs alike - headings and
   small print scale with it. (The company selection and error pages keep their own larger type.) */
html:not(.sh-page) { font-size: 13px; }
body { overflow-x: hidden; background: var(--color-secondary); }
.tabulator { font-size: 1rem; }                 /* Tabulator lists size themselves in px */
/* TWeb's "sm" forms (cSizing "sm") keep their tighter padding but not a smaller text size */
.form-control-sm, .custom-select-sm, .btn-sm, .input-group-sm > .form-control, .input-group-sm > .input-group-append > .btn,
.input-group-sm > .input-group-prepend > .input-group-text { font-size: 1rem; }
.badge { font-size: .85em; }
.table td, .table th { padding: .35rem .5rem; vertical-align: middle; }
label { margin-bottom: .2rem; }
h1, h2, h3, h4, h5, h6, .h6 { color: var(--color-primary); }
a { color: var(--color-primary-variant); }
a:hover { color: var(--color-primary); }
.text-primary { color: var(--color-primary-variant) !important; }
.bg-light { background-color: var(--color-secondary) !important; }
.btn-primary { background-color: var(--color-primary-variant); border-color: var(--color-primary-variant); color: var(--sh-on-primary); }
.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
  background-color: var(--color-primary) !important; border-color: var(--color-primary) !important; color: var(--sh-on-primary) !important; }
.btn-outline-dark, .btn-outline-primary { color: var(--color-primary-variant); border-color: var(--color-primary-variant); }
.btn-outline-dark:hover, .btn-outline-dark:focus, .btn-outline-dark:active,
.btn-outline-primary:hover, .btn-outline-primary:focus, .btn-outline-primary:active {
  background-color: var(--color-primary-variant) !important; border-color: var(--color-primary-variant) !important; color: var(--sh-on-primary) !important; }
.btn-link { color: var(--color-primary-variant); }
.btn-link.active { color: var(--color-primary-variant); font-weight: 600; border-bottom: 2px solid var(--color-primary-variant); }
.card { background-color: var(--sh-surface); }
.card-header { background-color: var(--color-secondary); }


/* ===== 2. App shell (html/index.html) =====
   Full window height: the sidebar stays put, only the content area scrolls (vertically) */
html, body { height: 100%; overflow: hidden; }
.sh-layout { display: flex; height: 100vh; overflow: hidden; }

.sh-sidebar { width: 210px; flex: 0 0 210px; height: 100vh; display: flex; flex-direction: column; background: var(--color-primary);
              color: rgba(255,255,255,.85); transition: width .2s, flex-basis .2s; overflow: hidden; }
.sh-sidebar.collapsed { width: 56px; flex-basis: 56px; }
.sh-brand { display: flex; align-items: center; height: 52px; padding: 0 8px; border-bottom: 1px solid rgba(255,255,255,.15); white-space: nowrap; }
.sh-toggle { background: none; border: 0; color: rgba(255,255,255,.8); width: 40px; height: 40px; font-size: 1.1rem; flex: 0 0 40px; cursor: pointer; }
.sh-toggle:hover, .sh-toggle:focus { color: var(--sh-on-primary); outline: none; }
.sh-title { font-weight: 600; margin-left: 6px; color: var(--sh-on-primary); }
.sh-db { display: block; font-size: .8rem; color: rgba(255,255,255,.6); margin-left: 6px; }

.sh-menu { list-style: none; padding: 8px 0; margin: 0; }
.sh-menu-main { flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; }
.sh-menu-bottom { flex: 0 0 auto; border-top: 1px solid rgba(255,255,255,.15); }
.sh-menu a { display: flex; align-items: center; padding: 10px 16px; color: rgba(255,255,255,.8); text-decoration: none;
             white-space: nowrap; border-left: 3px solid transparent; }
.sh-menu a i { width: 24px; text-align: center; font-size: 1.05rem; flex: 0 0 24px; }
.sh-menu a span { margin-left: 12px; }
.sh-menu a:hover { background: var(--color-primary-variant); color: var(--sh-on-primary); }
.sh-menu a.active { background: var(--color-primary-variant); color: var(--sh-on-primary); border-left-color: var(--sh-on-primary); }
.sh-menu a.disabled { opacity: .45; pointer-events: none; }
.sh-sidebar.collapsed .sh-title, .sh-sidebar.collapsed .sh-db, .sh-sidebar.collapsed .sh-menu span { display: none; }
.sh-sidebar.collapsed .sh-menu a { padding: 10px 16px; }

/* content sits flush against the sidebar: no padding/margin on the main area, the parent form's
   container-fluid (#index) or its content column - the views inside keep their own spacing */
.sh-main { flex: 1 1 auto; min-width: 0; height: 100vh; overflow-y: auto; overflow-x: hidden; padding: 0; margin: 0; }
#index.container-fluid { padding: 0; margin: 0; max-width: none; }
#index > [data-group="index-content"] { padding: 0; margin: 0; }

/* PHQ and other full-page frames - the window less the quick search bar */
.sh-fullframe { display: block; width: 100%; height: calc(100vh - var(--sh-qs-h)); height: calc(100dvh - var(--sh-qs-h)); border: 0; }

/* Dropdowns (Bootstrap .dropdown-menu / .dropdown-item - the quick search list, the quick actions menu)
   in the palette: the highlighted item is the hover tint, not Bootstrap's blue */
.dropdown-menu { border-color: var(--sh-border); border-radius: .4rem; box-shadow: var(--sh-shadow-lg); }
.dropdown-item { color: var(--sh-text); }
.dropdown-item:hover, .dropdown-item:focus, .dropdown-item.active, .dropdown-item:active { background: var(--sh-hover); color: var(--sh-text); }
.dropdown-header { font-size: .78rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--sh-muted); }

/* Quick merchant search above every page (html/index.html, ShQs*) - as tall as the sidebar's brand row */
.sh-qs-bar { height: var(--sh-qs-h); display: flex; align-items: center; padding: 0 12px; background: var(--sh-surface);
             border-bottom: 1px solid var(--sh-border); position: sticky; top: 0; z-index: 1020; }    /* stays on top while the page scrolls */
.sh-qs { position: relative; flex: 0 1 560px; min-width: 0; }
.sh-qs-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--sh-muted); pointer-events: none; }
.sh-qs-input { width: 100%; height: 34px; padding: 0 64px 0 34px; border: 1px solid var(--sh-border-input); border-radius: 17px; background: var(--color-secondary);
               color: var(--sh-text); outline: none; transition: border-color .15s, box-shadow .15s, background-color .15s; }
.sh-qs-input::-webkit-search-cancel-button { display: none; }
.sh-qs-input:focus { background: var(--sh-surface); border-color: var(--color-primary-variant); box-shadow: var(--sh-focus-ring); }
.sh-qs-kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-size: .75rem; padding: 1px 6px;
             background: var(--sh-surface); color: var(--sh-muted); border: 1px solid var(--sh-border-input); border-radius: 4px; box-shadow: none; pointer-events: none; }
.sh-qs-input:focus ~ .sh-qs-kbd, .sh-qs.busy .sh-qs-kbd { display: none; }
.sh-qs-spin { position: absolute; right: 12px; top: 50%; margin-top: -.5rem; color: var(--color-primary-variant); display: none; }
.sh-qs.busy .sh-qs-spin { display: inline-block; }
.sh-qs-list { top: calc(100% + 6px); right: 0; max-height: min(420px, 70vh); overflow-y: auto; }
.sh-qs.open .sh-qs-list { display: block; }
.sh-qs-list .sh-qs-item { display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "id name st" "id dlr st"; column-gap: 10px;
                          align-items: center; padding: 7px 12px; white-space: normal; cursor: pointer; }
.sh-qs-id { grid-area: id; font-family: SFMono-Regular, Menlo, Consolas, monospace; font-size: .9rem; font-weight: 600; color: var(--color-primary);
            background: var(--sh-subtle); border-radius: 4px; padding: 2px 6px; }
.sh-qs-name { grid-area: name; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sh-qs-dlr { grid-area: dlr; font-size: .85rem; color: var(--sh-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sh-qs-dlr:empty { display: none; }
.sh-qs-st { grid-area: st; }

/* Quick actions - the round button at the bottom right (html/index.html, ShFab*): goes to the merchant
   search, or with a merchant open shows its actions (a Bootstrap dropdown menu above the button).
   Under dialogs (z-index 1050) and the busy overlay. */
.sh-fab { position: fixed; right: 22px; bottom: 22px; z-index: 1035; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.sh-fab-btn { width: 52px; height: 52px; border-radius: 50%; border: 0; background: var(--color-primary-variant); color: var(--sh-on-primary);
              font-size: 1.25rem; box-shadow: var(--sh-shadow-lg); cursor: pointer; display: flex; align-items: center; justify-content: center;
              transition: transform .15s, background-color .15s, box-shadow .15s; }
.sh-fab-btn:hover { background: var(--color-primary); transform: translateY(-1px); }
.sh-fab-btn:focus { outline: none; box-shadow: var(--sh-focus-ring), var(--sh-shadow-lg); }
.sh-fab-x, .sh-fab.open .sh-fab-ico { display: none; }
.sh-fab.open .sh-fab-x { display: inline-block; }
.sh-fab .sh-fab-menu { position: static; float: none; min-width: 240px; max-width: calc(100vw - 44px); margin: 0; }
.sh-fab.open .sh-fab-menu { display: block; animation: sh-fab-in .14s ease-out; }
@keyframes sh-fab-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.sh-fab-head { display: flex; flex-direction: column; text-transform: none; letter-spacing: 0; font-size: 1rem; }
.sh-fab-head span:first-child { font-weight: 600; color: var(--color-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sh-fab-id { font-size: .82rem; font-weight: 400; color: var(--sh-muted); font-family: SFMono-Regular, Menlo, Consolas, monospace; }
.sh-fab-menu .dropdown-item { display: flex; align-items: center; gap: 10px; }
.sh-fab-menu .dropdown-item i { width: 18px; text-align: center; color: var(--color-primary-variant); }

/* a short notice at the bottom of the window (ShToast) */
.sh-toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 12px); z-index: 1060; padding: 8px 16px; border-radius: 18px;
            background: var(--sh-text); color: var(--sh-on-primary); font-size: .95rem; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.sh-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* phone-only parts (section 7) */
.sh-topbar, .sh-backdrop { display: none; }


/* ===== 3. Busy spinner & confirm popup (files/uhttpd2/uhttpd2.js) ===== */
.ut-busy { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 20000;
           background: rgba(255,255,255,.45); cursor: progress; }
.ut-busy-box { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); text-align: center; }
.ut-busy-spinner { width: 3rem; height: 3rem; }

.ut-confirm { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 21000; background: rgba(0,53,75,.45); }
.ut-confirm-box { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); width: 92%; max-width: 440px;
                  background: var(--sh-surface); border-radius: .4rem; box-shadow: 0 .5rem 1.5rem rgba(0,0,0,.3); overflow: hidden; }
.ut-confirm-title { background: var(--color-primary); color: var(--sh-on-primary); padding: .75rem 1rem; font-weight: 600; }
.ut-confirm-msg { padding: 1.25rem 1rem; color: var(--color-primary); white-space: pre-wrap; }
.ut-confirm-foot { padding: .75rem 1rem; background: var(--color-secondary); text-align: right; }
.ut-confirm-no { color: var(--color-primary-variant); border: 1px solid var(--color-primary-variant); background: var(--sh-surface); }
.ut-confirm-yes { color: var(--sh-on-primary); background: var(--color-primary-variant); border: 1px solid var(--color-primary-variant); }
.ut-confirm-yes:hover, .ut-confirm-yes:focus { color: var(--sh-on-primary); background: var(--color-primary); border-color: var(--color-primary); }

/* every other popup looks like the confirm popup: messages and errors (UModal) and form dialogs
   (bootbox, SetDialog) - title bar, body, buttons on the light footer */
.modal-backdrop { background-color: #00354B; }
.modal-backdrop.show { opacity: .45; }
.sh-modal .modal-content { border: 0; border-radius: .4rem; overflow: hidden; box-shadow: 0 .5rem 1.5rem rgba(0,0,0,.3); }
.sh-modal .modal-header { background: var(--color-primary); color: var(--sh-on-primary); padding: .75rem 1rem; border-bottom: 0; border-radius: 0; align-items: center; }
.sh-modal .modal-title, .sh-modal .bootbox-title { color: var(--sh-on-primary); font-size: 1.1rem; font-weight: 600; margin: 0; line-height: 1.5; }
.sh-modal .modal-header .close, .sh-modal .bootbox-close-button { color: var(--sh-on-primary); opacity: .8; text-shadow: none; padding: .5rem 1rem; margin: -.5rem -1rem -.5rem auto; font-size: 1.4rem; font-weight: 400; }
.sh-modal .modal-header .close:hover, .sh-modal .bootbox-close-button:hover { color: var(--sh-on-primary); opacity: 1; }
.sh-modal .modal-body { padding: 1.25rem 1rem; color: var(--color-primary); }
.sh-modal .modal-footer { background: var(--color-secondary); padding: .75rem 1rem; border-top: 0; }
.sh-modal .modal-footer > * { margin: 0 0 0 .5rem; }
.sh-modal-error .modal-header { background: #8A1C1C; }
.sh-modal-info .modal-body, .sh-modal-error .modal-body { word-wrap: break-word; }

/* form dialogs: TWeb puts the buttons in the form - the last row of buttons gets the footer look */
.sh-modal-dialog .modal-body { padding-bottom: 0; color: inherit; }
.sh-modal-dialog .modal-body form, .sh-modal-dialog .modal-body > div > .container-fluid { padding-left: 0; padding-right: 0; }
.sh-modal-dialog .sh-dlg-buttons { display: flex; justify-content: flex-end; gap: .5rem; margin: 1rem -1rem 0; padding: .75rem 1rem;
                                   background: var(--color-secondary); }
.sh-modal-dialog .sh-dlg-buttons .btn { margin: 0; }
.sh-modal-dialog .sh-dlg-buttons > [class*="col"] { flex: 0 0 auto; max-width: none; width: auto; padding: 0; }


/* ===== 4. Account editor header & tabs (html/account/account_edit.html) =====
   TWeb ROWGROUP/DIV/SAY/BUTTON elements laid out with flex instead of the col-n grid */
.sh-acct-head.row, .sh-acct-tabsrow.row { margin: 0; }
.sh-acct-head { display: flex; flex-wrap: nowrap; align-items: center; justify-content: space-between; gap: 16px;
                padding: 18px 20px 14px; background: var(--sh-surface); }
.sh-acct-id { display: flex; align-items: center; gap: 14px; min-width: 0; flex: 1 1 auto; }
.sh-acct-avatar, .sh-acct-name, .sh-acct-meta { padding: 0; }
.sh-acct-avatar { flex: 0 0 auto; }
.sh-acct-logo { flex: 0 0 48px; width: 48px; height: 48px; border-radius: 8px; object-fit: contain; border: 1px solid #E2E6EA; background: var(--sh-surface); }
.sh-acct-initials { display: flex; align-items: center; justify-content: center; background: var(--color-primary-variant);
                    color: var(--sh-on-primary); font-weight: 600; font-size: 1.1rem; border: 0; }
.sh-acct-text { min-width: 0; }
.sh-acct-name { margin: 0 0 4px; font-size: 1.35rem; font-weight: 600; line-height: 1.2; color: var(--color-primary);
                white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sh-acct-meta { font-size: .9rem; color: var(--sh-muted); }
.sh-acct-meta > span { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.sh-meta-item i { opacity: .7; margin-right: 2px; }
/* who else has the merchant open / last update (account_edit.html) */
.sh-acct-presence { margin-top: 2px; }
.sh-presence-busy { color: #8A5A00; font-weight: 600; }

/* chips: SportsPay ID and status */
.sh-chip { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .85rem; font-weight: 600; line-height: 1.5; }
.sh-chip-id { font-family: SFMono-Regular, Menlo, Consolas, monospace; background: var(--color-secondary); color: var(--color-primary);
              border: 1px solid #D6DCE1; letter-spacing: .03em; }
.sh-st-active { background: #E3F4EA; color: #1E7B45; }
.sh-st-classa { background: #E2EEF6; color: #1D5F8A; }
.sh-st-app    { background: #FFF4DB; color: #8A5A00; }
.sh-st-cancel { background: #ECEEF0; color: #5A6268; }

.sh-acct-actions { display: flex; gap: 8px; flex: 0 0 auto; }

/* tab bar: one line, scrolls sideways when it doesn't fit */
.sh-acct-tabs { width: 100%; padding: 0 12px; background: var(--sh-surface); border-bottom: 1px solid var(--sh-border); margin-bottom: 12px;
                overflow-x: auto; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
.sh-acct-tabs .sh-tabgroup { display: flex; flex-wrap: nowrap; gap: 2px; white-space: nowrap; }
.sh-acct-tabs .btn.sh-tab { flex: 0 0 auto; background: none; border: 0; border-radius: 0; border-bottom: 3px solid transparent;
                            padding: 10px 14px 9px; font-size: 1rem; line-height: 1.4; color: #5A6268; box-shadow: none; }
.sh-acct-tabs .btn.sh-tab:hover { color: var(--color-primary-variant); background: none; }
.sh-acct-tabs .btn.sh-tab:focus { outline: none; box-shadow: inset 0 0 0 2px rgba(0,65,88,.25); }
.sh-acct-tabs .btn.sh-tab.active { color: var(--color-primary); font-weight: 600; border-bottom-color: var(--color-primary-variant); background: none; }


/* Report site tab (logged in as the merchant) and the email view dialog (account_edit.prg) */
.sh-webframe { display: block; width: 100%; height: 80vh; border: 0; }
.sh-mail-frame { width: 100%; height: 380px; border: 0; }
.sh-mail-body { max-height: 400px; overflow-y: auto; }


/* ===== 5. Account tabs ===== */
/* section headings in the tabs (card headers) */
#account_edit-merch_tab_content .h6 { font-weight: 600; }
/* Logs, Files and Users use the full width */
#acct_logs_edit.container, #acct_files_edit.container, #acct_users_edit.container { max-width: 100%; padding-left: 0; padding-right: 0; }
/* Finance: one time charges list */
.acct-fin-scroll { max-height: 400px; overflow-y: auto; }
/* scrolling lists (Logs audit/email, Settings terminal IDs) and clickable rows */
.sh-scroll-400 { max-height: 400px; overflow-y: auto; }
.sh-scroll-300 { max-height: 300px; overflow-y: auto; }
.sh-row-link { cursor: pointer; }
/* Users: square icon buttons, right aligned in the last column (UserMerchUsersTableHtml) */
.sh-users td { vertical-align: middle; }
.sh-icon-btns { display: flex; justify-content: flex-end; gap: 4px; flex-wrap: nowrap; }
.sh-icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 30px; padding: 0; flex: 0 0 32px; }
.sh-icon-btn.disabled, .sh-icon-btn:disabled { opacity: .35; pointer-events: none; }
/* Dashboard (html/dashboard.html) - InterPayAdm's main window: two panels filling the screen (Tasks &
   Notes, Activity Log), each with its filters on the left and its list on the right */
.sh-dash { display: flex; flex-direction: column; gap: 10px; height: calc(100vh - var(--sh-qs-h)); height: calc(100dvh - var(--sh-qs-h));
           padding: 10px; box-sizing: border-box; }
.sh-dash-panel { flex: 1 1 0; min-height: 0; display: flex; background: var(--sh-surface); border: 1px solid var(--sh-border); border-radius: .4rem;
                 overflow: hidden; box-shadow: var(--sh-shadow); }
.sh-dash-side { flex: 0 0 220px; display: flex; flex-direction: column; gap: 6px; padding: 12px 0; overflow-y: auto;
                background: var(--color-secondary); border-right: 1px solid var(--sh-border); }
.sh-dash-side > div { flex: 0 0 auto; max-width: none; width: 100%; padding: 0 12px; margin: 0; }
.sh-dash-side .form-group { margin-bottom: 0; }
.sh-dash-side > .sh-dash-push { margin-top: auto; padding-top: 10px; }
.sh-dash-title { font-weight: 700; color: var(--color-primary); font-size: 1.1rem; margin-bottom: 2px; }
.sh-dash-title i { opacity: .75; margin-right: 4px; }
.sh-dash-hint { font-size: .85rem; color: var(--sh-muted); text-align: right; }
.sh-dash-brand { text-align: center; }
.sh-dash-region { font-size: 1.35rem; font-weight: 600; color: #03405C; }
.sh-dash-brand img { max-width: 150px; max-height: 50px; margin-top: 4px; }
.sh-dash-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.sh-dash-main > .sh-dash-fill { flex: 1 1 auto; min-height: 0; max-width: none; padding: 0; }
.sh-dash-fill > span { display: block; height: 100%; }
.sh-dash-list { height: 100%; overflow: auto; }
.sh-dash-table { margin: 0; }
.sh-dash-table thead th { position: sticky; top: 0; z-index: 1; background: var(--sh-subtle); color: var(--color-primary);
                          border-bottom: 1px solid #D6DCE1; border-top: 0; font-weight: 600; white-space: nowrap; }
.sh-dash-table td { border-top: 1px solid #F0F2F4; }
.sh-dash-table tbody tr:hover td { background: var(--sh-row-hover); }
/* task rows coloured as InterPayAdm: green ready, red late/urgent, blue waiting or a reminder,
   black not yours/notes/done */
.sh-task-green, .sh-task-green td { color: #1E7B45; }
.sh-task-red, .sh-task-red td { color: #B42318; }
.sh-task-blue, .sh-task-blue td { color: #1D5F8A; }
.sh-task-special td { color: var(--color-primary); font-weight: 600; background: #FFF8E1; }
@media (max-width: 767.98px) {
  .sh-dash { height: auto; }
  .sh-dash-panel { flex: 0 0 auto; flex-direction: column; }
  .sh-dash-side { flex: 0 0 auto; border-right: 0; border-bottom: 1px solid var(--sh-border); }
  .sh-dash-side > .sh-dash-push { display: none; }
  .sh-dash-list { height: auto; max-height: 60vh; }
}/* Users page (html/users.html) - the user list (InterPayAdm's tree) on the left, the user window on the right */
.sh-users-page .sh-dash-panel { flex: 1 1 auto; }
.sh-users-side { flex: 0 0 340px; }
.sh-users-side > .sh-users-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 0; margin-top: 4px; border-top: 1px solid var(--sh-border); background: var(--sh-surface); }
.sh-users-list > span { display: block; }
.sh-ulist-sec { position: sticky; top: 0; z-index: 2; padding: 6px 12px; background: var(--color-primary); color: var(--sh-on-primary); font-weight: 600; }
.sh-ulist-grp { padding: 5px 12px 3px; font-weight: 600; color: var(--color-primary); background: var(--sh-subtle); border-top: 1px solid #E2E6EA; }
.sh-ulist-item { padding: 5px 12px 5px 20px; cursor: pointer; border-top: 1px solid #F3F4F6; }
.sh-ulist-item:hover { background: var(--sh-row-hover); }
.sh-ulist-item.active { background: var(--color-primary-variant); color: var(--sh-on-primary); }
.sh-ulist-item.active .sh-ulist-id { color: rgba(255,255,255,.75); }
.sh-ulist-item.disabled-user .sh-ulist-name { text-decoration: line-through; opacity: .7; }
.sh-ulist-id { color: var(--sh-muted); font-family: SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; }
.sh-users-main { overflow-y: auto; }
.sh-users-editor { padding: 16px 20px; }
.sh-users-empty { height: 100%; min-height: 240px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #8A949E; gap: 8px; }
.sh-users-empty i { font-size: 3rem; opacity: .5; }
.sh-user-access { background: var(--color-secondary); height: auto; min-height: calc(1.5em + .5rem + 2px); }
.sh-user-perms { max-height: 260px; overflow-y: auto; }
.sh-users-editor .sh-dlg-buttons { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1rem; }
@media (max-width: 767.98px) {
  .sh-users-side { flex: 0 0 auto; }
  .sh-users-side > .sh-users-list { max-height: 50vh; }
}

/* the task window (html/task.prg) - wider than the other dialogs */
/* (pop-up widths: see the end of this file) */
/* the task and user windows fit the screen: title bar fixed, the window's content scrolls inside */
#dlg_task.modal-dialog, #dlg_user.modal-dialog { margin-top: 1rem; margin-bottom: 1rem; min-height: 0; }
#dlg_task .modal-content, #dlg_user .modal-content { max-height: calc(100vh - 2rem); max-height: calc(100dvh - 2rem); }
#dlg_task .modal-body, #dlg_user .modal-body { overflow-y: auto; }
#dlg_task .sh-scroll-300 { max-height: 30vh; }
.sh-task .sh-dlg-buttons { margin-top: 1rem; }
.sh-task-side { border-left: 1px solid #E9ECEF; }
@media (max-width: 767.98px) { .sh-task-side { border-left: 0; border-top: 1px solid #E9ECEF; padding-top: .75rem; margin-top: .75rem; } }
/* note text, email text: keep the line breaks */
.sh-pre { white-space: pre-wrap; }


/* ===== 6. Pages outside the app shell: company selection (utils/SessionFunc.prg), error pages ===== */
html.sh-page, html.sh-page body { height: auto; min-height: 100%; overflow: auto; margin: 0;
                                 font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
.sh-co-wrap, .sh-co-wrap div, .sh-co-btn { box-sizing: border-box; }
.sh-co-wrap { display: flex; min-height: 100vh; }
.sh-co-brand { flex: 1 1 50%; background: var(--color-primary); color: var(--sh-on-primary); display: flex; flex-direction: column; justify-content: center; padding: 5vw; }
.sh-co-brand h2 { margin: 0 0 .5rem; font-size: 1.6rem; font-weight: 400; text-transform: uppercase; letter-spacing: .05em; color: var(--sh-on-primary); }
.sh-co-brand h1 { margin: 0; font-size: 3rem; line-height: 1; color: var(--sh-on-primary); }
.sh-co-pick { flex: 1 1 50%; background: var(--color-secondary); display: flex; align-items: center; justify-content: center; padding: 5vw; }
.sh-co-box { width: 100%; max-width: 400px; }
.sh-co-box h3 { color: var(--color-primary); margin: 0 0 1.5rem; font-size: 1.6rem; }
.sh-co-btn { display: block; width: 100%; padding: .9rem 1rem; margin-bottom: 1rem; text-align: center; font-size: 1.15rem;
             color: var(--sh-on-primary); background: var(--color-primary-variant); border: 1px solid var(--color-primary-variant);
             border-radius: .4rem; text-decoration: none; box-shadow: 0 .125rem .25rem rgba(0,0,0,.1); }
.sh-co-btn:hover, .sh-co-btn:focus { color: var(--sh-on-primary); background: var(--color-primary); border-color: var(--color-primary); outline: none; text-decoration: none; }
.sh-co-btn-test { background: var(--sh-surface); color: var(--color-primary-variant); }


/* error pages: 404, 500, not logged in, unknown company (ErrorPage, utils/ViewFunc.prg) */
.sh-err-page { background: var(--color-secondary); color: #343A40; }
.sh-err { box-sizing: border-box; min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 16px; }
.sh-err-brand { color: var(--color-primary); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; font-size: .85rem; margin-bottom: 16px; }
.sh-err-card { box-sizing: border-box; width: 100%; max-width: 520px; background: var(--sh-surface); border-top: 4px solid var(--color-primary);
               border-radius: .5rem; box-shadow: 0 .5rem 1.5rem rgba(0,53,75,.12); padding: 36px 32px 28px; text-align: center; }
.sh-err-code { font-size: 4.5rem; font-weight: 700; line-height: 1; color: var(--color-primary-variant); opacity: .9; letter-spacing: .02em; }
.sh-err-title { margin: 12px 0 8px; font-size: 1.5rem; font-weight: 600; color: var(--color-primary); }
.sh-err-msg { margin: 0 auto 24px; max-width: 400px; color: #5A6268; line-height: 1.5; }
.sh-err-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.sh-err-btn { display: inline-block; padding: .6rem 1.2rem; border-radius: .4rem; text-decoration: none; font-weight: 500;
              color: var(--sh-on-primary); background: var(--color-primary-variant); border: 1px solid var(--color-primary-variant); }
.sh-err-btn:hover, .sh-err-btn:focus { color: var(--sh-on-primary); background: var(--color-primary); border-color: var(--color-primary); text-decoration: none; }
.sh-err-btn-alt { color: var(--color-primary-variant); background: var(--sh-surface); }
.sh-err-ref { margin: 20px 0 0; font-size: .8rem; color: var(--sh-muted); }
.sh-err-ref code { color: var(--color-primary); background: var(--color-secondary); padding: 1px 6px; border-radius: 4px; }
.sh-err-detail { margin-top: 20px; text-align: left; font-size: .85rem; }
.sh-err-detail summary { cursor: pointer; color: var(--color-primary-variant); }
.sh-err-detail iframe { display: block; width: 100%; height: 360px; margin-top: 8px; border: 1px solid var(--sh-border); border-radius: 4px; background: var(--sh-surface); }
@media (max-width: 767.98px) {
  .sh-err-card { padding: 28px 18px 22px; }
  .sh-err-code { font-size: 3.5rem; }
  .sh-err-title { font-size: 1.25rem; }
  .sh-err-btn { flex: 1 1 100%; }
}

/* ===== 7. Phones / narrow screens ===== */
@media (max-width: 767.98px) {

  /* top bar with the menu button; the sidebar becomes a slide-in drawer */
  .sh-topbar { display: flex; align-items: center; position: fixed; top: 0; left: 0; right: 0; height: 52px; z-index: 1030;
               background: var(--color-primary); color: var(--sh-on-primary); padding: 0 8px; }
  .sh-topbar .sh-db { display: inline; }
  .sh-layout { display: block; height: auto; }
  .sh-sidebar { position: fixed; top: 0; left: 0; bottom: 0; z-index: 1050; width: 260px; height: 100vh; height: 100dvh;
                transform: translateX(-100%); transition: transform .25s; box-shadow: 0 0 1rem rgba(0,0,0,.35); }
  .sh-sidebar.open { transform: translateX(0); }
  .sh-sidebar.collapsed { width: 260px; }
  .sh-sidebar.collapsed .sh-title, .sh-sidebar.collapsed .sh-db, .sh-sidebar.collapsed .sh-menu span { display: inline; }
  .sh-sidebar .sh-db { display: block; }
  .sh-menu a { padding: 13px 16px; }
  .sh-backdrop { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 1040; background: rgba(0,53,75,.45); }
  .sh-backdrop.open { display: block; }
  .sh-main { margin-top: 52px; height: calc(100vh - 52px); height: calc(100dvh - 52px); }
  .sh-fullframe, .sh-dash { height: calc(100vh - 52px - var(--sh-qs-h)); height: calc(100dvh - 52px - var(--sh-qs-h)); }
  .sh-qs-bar { padding: 0 8px; }
  .sh-qs { flex: 1 1 auto; }
  .sh-qs-input { font-size: 16px; }                 /* no iOS zoom on focus */
  .sh-qs-kbd { display: none; }
  .sh-qs-list .sh-qs-item { grid-template-columns: auto 1fr; grid-template-areas: "id name" "st dlr"; row-gap: 3px; }
  .sh-qs-st { justify-self: start; }
  .sh-fab { right: 14px; bottom: 14px; }
  .sh-fab-menu .dropdown-item { padding: 11px 14px; }       /* bigger touch targets */

  /* TWeb lays fields out as fixed col-1..col-11 - stack them full width instead */
  .sh-main .col-1, .sh-main .col-2, .sh-main .col-3, .sh-main .col-4, .sh-main .col-5, .sh-main .col-6,
  .sh-main .col-7, .sh-main .col-8, .sh-main .col-9, .sh-main .col-10, .sh-main .col-11,
  .modal .col-1, .modal .col-2, .modal .col-3, .modal .col-4, .modal .col-5, .modal .col-6,
  .modal .col-7, .modal .col-8, .modal .col-9, .modal .col-10, .modal .col-11 { flex: 0 0 100%; max-width: 100%; }
  .sh-main .w-50 { width: 100% !important; }

  /* 16px inputs: smaller text makes iOS zoom in on focus */
  .sh-main .form-control, .modal .form-control, .sh-main select, .modal select { font-size: 16px; }

  /* wide tables scroll sideways instead of overflowing the screen */
  .sh-main table.table { display: block; width: 100%; overflow-x: auto; white-space: nowrap; }

  .sh-main .text-right { text-align: left !important; }
  .sh-main h4 { font-size: 1.2rem; }

  /* account editor header */
  .sh-acct-head { padding: 14px 12px 10px; gap: 10px; }
  .sh-acct-logo { flex-basis: 40px; width: 40px; height: 40px; }
  .sh-acct-name { font-size: 1.1rem; }
  .sh-btn-label { display: none; }
  .sh-acct-actions .btn { width: 36px; height: 36px; padding: 0; }
  .sh-acct-tabs { padding: 0 4px; }
  .sh-acct-tabs .btn.sh-tab { padding: 10px 12px 9px; }

  /* company selection page */
  .sh-co-wrap { flex-direction: column; }
  .sh-co-brand, .sh-co-pick { flex: 0 0 auto; }
}

/* who else has a user/task window open, and its last change (PresenceHtml, utils/SessionFunc.prg) */
.sh-presence { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--sh-muted); }
.sh-presence i { opacity: .7; margin-right: 2px; }
.sh-presence .sh-presence-busy { color: #8A5A00; font-weight: 600; }

/* no sideways scrolling in any popup (dialogs, messages, task and user windows): the content fits the
   window's width - long words/emails/links wrap, tables and frames shrink to fit, grid rows don't spill */
/* pop-ups are as wide as their content - at least a third and at most three quarters of the screen
   (phones: the screen width) */
.modal-dialog { width: fit-content; width: -moz-fit-content; min-width: 33vw; max-width: 75vw; }
@media (max-width: 767.98px) { .modal-dialog { width: auto; min-width: 0; max-width: calc(100vw - 1rem); } }
.modal-content, .modal-body { max-width: 100%; }
.modal-body { overflow-x: hidden; overflow-wrap: anywhere; word-break: break-word; }
.modal-body .row { margin-left: 0; margin-right: 0; }
.modal-body .row > [class*="col"] { min-width: 0; }
.modal-body img, .modal-body iframe, .modal-body video, .modal-body pre, .modal-body textarea { max-width: 100%; }
.modal-body pre, .modal-body .sh-pre { white-space: pre-wrap; }
.modal-body .table-responsive { overflow-x: visible; }
.modal-body table { width: 100%; table-layout: auto; }
.modal-body table td, .modal-body table th { white-space: normal; overflow-wrap: anywhere; }
.modal-body .form-control, .modal-body select { max-width: 100%; min-width: 0; }
.modal-body .d-flex > * { min-width: 0; }
.ut-confirm-msg { overflow-wrap: anywhere; }

/* Dealer maintenance editor (html/dealers.prg): the account editor's header and tabs, then the tab panes */
.sh-dlr .sh-presence { margin: 4px 0 0; }
.sh-dlr-body { padding: 0 20px 20px; }
.sh-dlr-pane { max-width: 980px; }
.sh-dlr-sub { font-weight: 600; color: var(--color-primary); margin: 6px 0 8px; }
.sh-dlr-resrow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-bottom: 8px; }
.sh-dlr-reslabel { flex: 0 0 150px; color: #5A6268; }
.sh-num { width: auto; flex-wrap: nowrap; }      /* a number with its unit (UiNum) */
.sh-num .form-control { width: 80px; flex: 0 0 80px; }
.sh-dlr-tiers { padding-left: 12px; border-left: 3px solid #E2EEF6; margin: 4px 0 10px; }
@media (max-width: 767.98px) {
  .sh-dlr-body { padding: 0 12px 16px; }
  .sh-dlr-reslabel { flex-basis: 100%; }
}
.sh-dealer-link { color: inherit; text-decoration: none; }
.sh-dealer-link:hover, .sh-dealer-link:focus { color: var(--color-primary-variant); text-decoration: underline; }

/* list pages (Merchants, Users, Dealers): a header with the title and what the page is for on the
   left and its main action on the right, spaced from the top and from the table */
.sh-page-head.row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
                    margin: 0 0 14px; padding: 22px 4px 14px; border-bottom: 1px solid var(--sh-border); }
.sh-page-head .sh-page-titlebox { flex: 1 1 auto; min-width: 0; padding: 0; max-width: none; }
.sh-page-title { margin: 0; font-size: 1.55rem; font-weight: 600; color: var(--color-primary); line-height: 1.25; }
.sh-page-title i { color: var(--color-primary-variant); opacity: .85; margin-right: 6px; font-size: .9em; }
.sh-page-sub { margin-top: 3px; color: var(--sh-muted); font-size: .95rem; }
.sh-page-actions { display: flex; gap: 8px; flex: 0 0 auto; }
.sh-page-actions .btn { padding: .4rem .9rem; }
#merchsel .tabulator, #users .tabulator, #dealers .tabulator { border: 1px solid var(--sh-border); border-radius: .4rem; overflow: hidden;
                                                              box-shadow: var(--sh-shadow); margin-bottom: 16px; }
@media (max-width: 767.98px) {
  .sh-page-head.row { padding-top: 14px; }
  .sh-page-title { font-size: 1.25rem; }
  .sh-page-actions { flex: 1 1 100%; }
  .sh-page-actions .btn { flex: 1 1 auto; }
}

/* who else has it open / last change - pills that stand out: amber when someone else has it open,
   green when only you do, blue for the last change */
.sh-presence, .sh-acct-presence > span { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.sh-presence-busy, .sh-presence-none, .sh-presence-last {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .9rem; line-height: 1.4; }
.sh-presence-busy { background: #FFF1CC; color: #7A4B00; border: 1px solid #F2C14E; font-weight: 600;
                    box-shadow: 0 0 0 3px rgba(242,193,78,.18); }
.sh-presence-busy i { color: #C27C00; opacity: 1; }
.sh-presence-none { background: #E6F4EC; color: #1E6B40; border: 1px solid #BFE3CC; }
.sh-presence-last { background: #E8F1F8; color: #1D4F72; border: 1px solid #C7DCEC; }
.sh-presence-nolog { background: #F1F3F5; color: var(--sh-muted); border-color: var(--sh-border); }
.sh-presence-busy i, .sh-presence-none i, .sh-presence-last i { margin: 0; opacity: .9; }