/* ExaGuards page frame (Usr_WinPage): the Windows 11 look of a page inside a desktop window.
   One bar at the top (filter icon, refresh icon, title, the page's buttons, search at the far right) and the filter panel that slides in under it.
   Colours are the desktop tokens (exa-desktop.css, scoped to .wp-root as well), so light and dark follow the desktop.
   The second half re-colours the Agents list's own rules (the dv-* classes, written light-only inside the page) while they sit inside the frame; the rules are scoped to .wp-root,
   so the same page used without the frame (a picker inside a dialog) keeps the look it has always had. */

/* ───────────── frame ───────────── */
.wp-root {
    font-family: var(--fb);
    color: var(--inv-text);
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    background: var(--winbg);
    box-sizing: border-box;
    /* The inside of a window (DesktopShell, embedded) keeps 8px at each side of every page; the frame's bar must touch both window borders, so the frame takes that gutter back.
       The bar and the body keep their own padding, so nothing inside moves closer to the edge. Keep this equal to the padding of #kt_app_content_container in DesktopShell. */
    margin-left: -8px;
    margin-right: -8px;
}

.wp-root *, .wp-root *::before, .wp-root *::after { box-sizing: border-box; }

/* ───────────── bar ───────────── */
.wp-bar {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 48px;
    padding: 6px 10px;
    background: var(--inv-card);
    border-bottom: 1px solid var(--inv-line);
}

.wp-ib {
    position: relative;
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--inv-text);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    transition: background .12s, border-color .12s, color .12s;
}

.wp-ib:hover:not(:disabled) { background: var(--inv-hover); }
.wp-ib:active:not(:disabled) { background: var(--inv-soft); }
.wp-ib:disabled { opacity: .55; cursor: default; }
.wp-ib:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.wp-ib.wp-on {
    background: var(--sel);
    border-color: var(--selline);
    color: var(--accent);
}

.wp-ib-sm { width: 28px; height: 28px; font-size: 12px; border-radius: 6px; }

.wp-badge {
    position: absolute;
    top: 2px;
    right: 1px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    background: var(--btn);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    pointer-events: none;
}

.wp-sep { flex: 0 0 auto; width: 1px; height: 22px; margin: 0 4px; background: var(--inv-line); }

.wp-title {
    display: flex;
    align-items: baseline;
    gap: 8px;
    min-width: 0;
    margin: 0;
    font-family: var(--fh);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: .01em;
    color: var(--inv-text);
    white-space: nowrap;
}

.wp-title > i { align-self: center; color: var(--accent); font-size: 16px; }
.wp-title-text { overflow: hidden; text-overflow: ellipsis; }
.wp-sub { font-family: var(--fb); font-size: 12px; font-weight: 500; color: var(--inv-faint); }

.wp-chip {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 26px;
    padding: 0 10px;
    border: 1px solid var(--selline);
    border-radius: 13px;
    background: var(--sel);
    color: var(--accent);
    font-family: var(--fb);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.wp-chip i { font-size: 9px; }
.wp-chip:hover { filter: brightness(.96); }
.wp-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.wp-spacer { flex: 1 1 auto; min-width: 8px; }

.wp-actions { flex: 0 1 auto; display: flex; align-items: center; gap: 6px; min-width: 0; }

.wp-link {
    border: 0;
    background: transparent;
    padding: 4px 6px;
    color: var(--accent);
    font-family: var(--fb);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}
.wp-link:hover { text-decoration: underline; }

/* search, at the far top right */
.wp-search {
    position: relative;
    flex: 0 1 280px;
    min-width: 140px;
    display: flex;
    align-items: center;
    margin: 0;
}

.wp-search > i.bi-search {
    position: absolute;
    left: 10px;
    font-size: 12px;
    color: var(--inv-faint);
    pointer-events: none;
}

.wp-search-input {
    width: 100%;
    height: 34px;
    padding: 0 30px 0 30px;
    border: 1px solid var(--inv-line);
    border-bottom-color: var(--inv-faint);
    border-radius: 6px;
    background: var(--inv-soft);
    color: var(--inv-text);
    font-family: var(--fb);
    font-size: 13px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    transition: background .12s, border-color .12s;
}

.wp-search-input::placeholder { color: var(--inv-faint); }
.wp-search-input::-webkit-search-cancel-button,
.wp-search-input::-webkit-search-decoration { -webkit-appearance: none; appearance: none; display: none; }
.wp-search-input:hover { background: var(--inv-hover); }
.wp-search-input:focus { background: var(--inv-card); border-color: var(--inv-line); border-bottom: 2px solid var(--accent); padding-bottom: 0; }

.wp-search-x {
    position: absolute;
    right: 4px;
    width: 26px;
    height: 26px;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: var(--inv-faint);
    font-size: 11px;
    cursor: pointer;
}

.wp-search-input:not(:placeholder-shown) ~ .wp-search-x { display: inline-flex; }
.wp-search-x:hover { background: var(--inv-hover); color: var(--inv-text); }

.wp-spin { display: inline-block; animation: wp-spin .8s linear infinite; }
@keyframes wp-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
    .wp-spin { animation: none; }
    .wp-body, .wp-panel { transition: none !important; }
}

/* ───────────── body: the filter panel and the page ───────────── */
.wp-body {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
    grid-template-columns: 0 minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    gap: 0;
    padding: 10px;
    transition: grid-template-columns .22s cubic-bezier(.2, .8, .2, 1);
}

.wp-root[data-open="1"] > .wp-body { grid-template-columns: 280px minmax(0, 1fr); }

.wp-panel {
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    padding-right: 10px;
    opacity: 1;
    visibility: visible;
    transition: opacity .16s, visibility .22s;
}

.wp-root[data-open="0"] .wp-panel { opacity: 0; visibility: hidden; padding-right: 0; }

.wp-panel-card {
    width: 270px;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--inv-card);
    border: 1px solid var(--inv-line);
    border-radius: 10px;
    overflow: hidden;
}

.wp-panel-head {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px 6px 12px;
    border-bottom: 1px solid var(--inv-line);
    background: var(--inv-soft);
}

.wp-panel-title {
    flex: 1 1 auto;
    font-family: var(--fh);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .02em;
    color: var(--inv-text);
}

.wp-panel-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding: 8px;
}

.wp-main {
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
}

.wp-main > .h-100 { flex: 1 1 0; min-height: 0; }

.wp-scrim { display: none; }

/* narrow windows: the panel floats over the page instead of pushing it */
@media (max-width: 820px) {
    .wp-body, .wp-root[data-open="1"] > .wp-body { grid-template-columns: minmax(0, 1fr); }
    .wp-panel, .wp-root[data-open="0"] .wp-panel {
        position: absolute;
        top: 10px;
        left: 10px;
        bottom: 10px;
        width: min(320px, 86vw);
        padding-right: 0;
        z-index: 5;
        box-shadow: var(--shadow);
        border-radius: 10px;
    }
    .wp-panel-card { width: 100%; }
    .wp-scrim {
        display: block;
        position: absolute;
        inset: 0;
        z-index: 4;
        border: 0;
        padding: 0;
        background: rgba(0, 0, 0, .28);
        cursor: default;
    }
}

@media (max-width: 560px) {
    .wp-title, .wp-sep { display: none; }
    .wp-search { flex: 1 1 140px; }
    .wp-bar { flex-wrap: wrap; }
}

/* ═════════════ the Agents list inside the frame: its own rules, on the desktop tokens ═════════════ */

/* the page's buttons in the bar (Waiting for approval, Actions, New agent, View) */
.wp-root .wp-actions .dv-btn-new,
.wp-root .wp-actions .e-btn.dv-btn-actions,
.wp-root .wp-actions .e-dropdown-btn.dv-btn-actions {
    height: 34px;
    padding: 0 14px !important;
    border-radius: 8px !important;
    font-family: var(--fb) !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    letter-spacing: 0 !important;
    background: var(--btn) !important;
    color: #fff !important;
    border: 0 !important;
    box-shadow: none !important;
}

.wp-root .wp-actions .dv-btn-new:hover,
.wp-root .wp-actions .e-btn.dv-btn-actions:hover {
    opacity: 1 !important;
    filter: brightness(1.08);
    box-shadow: none !important;
}

.wp-root .wp-actions .e-btn.dv-btn-view,
.wp-root .wp-actions .e-dropdown-btn.dv-btn-view {
    height: 34px;
    padding: 0 12px !important;
    border-radius: 8px !important;
    font-family: var(--fb) !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    background: transparent !important;
    color: var(--inv-text) !important;
    border: 1px solid var(--inv-line) !important;
    box-shadow: none !important;
}

.wp-root .wp-actions .e-btn.dv-btn-view:hover,
.wp-root .wp-actions .e-dropdown-btn.dv-btn-view:hover {
    background: var(--inv-hover) !important;
    box-shadow: none !important;
}

.wp-root .wp-actions .e-btn.dv-btn-view .e-btn-icon,
.wp-root .wp-actions .e-btn.dv-btn-actions .e-btn-icon { color: inherit !important; }

/* Several dropdown buttons were given the icon class me-n3 (margin-right -0.75rem) under the old layout; on a button that has a label the negative margin pulls the label over the icon ("Actions" lost its A). A button with a label keeps a small gap instead. */
.e-btn:not(.e-icon-btn) .e-btn-icon.me-n3 {
    margin-right: 6px !important;
}

.wp-root .wp-actions button.dv-btn-refresh {
    height: 34px;
    padding: 0 12px;
    border-radius: 8px;
    background: transparent;
    color: var(--inv-text);
    border: 1px solid var(--inv-line);
    font-family: var(--fb);
    font-size: 13px;
    font-weight: 600;
    box-shadow: none;
}

.wp-root .wp-actions button.dv-btn-refresh:hover { background: var(--inv-hover); box-shadow: none; }

.wp-root .wp-actions button.dv-btn-refresh.dv-btn-on {
    background: var(--btn);
    color: #fff;
    border-color: transparent;
}

/* category cards */
.wp-root .dv-cat-card {
    background: var(--inv-card);
    border-color: var(--inv-line);
    color: var(--inv-text);
}

.wp-root .dv-cat-card:hover { background: var(--inv-hover); border-color: var(--selline); }
.wp-root .dv-cat-name { color: var(--inv-muted); }

.wp-root .dv-cat-card.dv-cat-selected,
.wp-root .dv-cat-selected {
    background: var(--sel) !important;
    border-color: var(--selline) !important;
}

.wp-root .dv-cat-selected .dv-cat-name { color: var(--accent) !important; }
.wp-root .dv-cat-selected::after { background: var(--accent); }

/* the table */
.wp-root .dv-table-wrap {
    background: var(--inv-card);
    border-color: var(--inv-line);
}

.wp-root .dv-table { font-family: var(--fb); color: var(--inv-text); }

.wp-root .dv-table thead th {
    background: var(--inv-soft);
    border-bottom: 2px solid var(--inv-line);
    color: var(--inv-faint);
}

.wp-root button.dv-sort { color: var(--inv-faint); }
.wp-root button.dv-sort:hover { color: var(--inv-text); }
.wp-root button.dv-sort:focus-visible { outline-color: var(--accent); }
.wp-root button.dv-sort.dv-sort--on { color: var(--accent); }
.wp-root button.dv-sort.dv-sort--on i { color: var(--accent); }

.wp-root .dv-th-before { box-shadow: inset 3px 0 0 var(--accent); }
.wp-root .dv-th-after { box-shadow: inset -3px 0 0 var(--accent); }

.wp-root .dv-row td { border-bottom-color: var(--inv-line); color: var(--inv-text); }
.wp-root .dv-row:hover td { background: var(--inv-hover); }
.wp-root .dv-row.dv-row--sel td { background: var(--sel); }

/* the frozen right-hand columns have to stay opaque, in both themes, or the columns scrolling under them show through */
.wp-root .dv-table th.dv-frozen,
.wp-root .dv-table td.dv-frozen { background: var(--inv-card); }

.wp-root .dv-table thead th.dv-frozen { background: var(--inv-soft); }

.wp-root .dv-row:hover td.dv-frozen { background: var(--inv-hover); }
.wp-root .dv-row.dv-row--sel td.dv-frozen { background: linear-gradient(var(--sel), var(--sel)), var(--inv-card); }

.wp-root .dv-frozen--prev { box-shadow: -7px 0 7px -7px rgba(0, 0, 0, .35); }

/* cell text and status */
.wp-root .dv-clock i { color: var(--inv-faint); }
.wp-root .dv-clock--wrong { color: var(--inv-warn); }
.wp-root .dv-cell-primary { color: var(--inv-text); }
.wp-root .dv-cell-muted { color: var(--inv-faint); }
.wp-root .dv-empty { color: var(--inv-faint); }
.wp-root .dv-user i { color: var(--accent); }
.wp-root .dv-user__dom,
.wp-root .dv-user--old { color: var(--inv-faint); }
.wp-root .dv-sec-sub { color: var(--inv-faint); }
.wp-root .dv-th-flag { color: var(--inv-amber); }

/* group-by-client rows */
.wp-root .dv-grouprow td { background: var(--inv-soft); border-color: var(--inv-line); }
.wp-root .dv-grouprow:hover td { background: var(--inv-hover); }
.wp-root .dv-grouprow-name { color: var(--inv-text); }
.wp-root .dv-grouprow-count { background: var(--inv-card); color: var(--inv-muted); }
.wp-root .dv-grouprow i { color: var(--inv-faint) !important; }

/* row icon buttons */
.wp-root a.dv-icon-btn {
    background: var(--inv-accent-soft);
    border-color: var(--inv-line);
    color: var(--accent);
}

.wp-root a.dv-icon-btn.dv-icon-btn-disabled,
.wp-root a.dv-icon-btn-disabled {
    background: var(--inv-soft);
    border-color: var(--inv-line);
    color: var(--inv-faint);
}

.wp-root a.dv-btn-view,
.wp-root button.dv-btn-view:not(.e-btn) {
    background: var(--sel);
    border-color: var(--selline);
    color: var(--accent);
}

.wp-root button.dv-btn-approve { background: var(--btn); color: #fff; }

/* status chips */
.wp-root .dv-exp--bad { background: var(--inv-warn-soft); color: var(--inv-warn); }
.wp-root .dv-exp--warn { background: var(--inv-amber-soft); color: var(--inv-amber); }
.wp-root .dv-exp--info { background: var(--inv-accent-soft); color: var(--blue); }
.wp-root .dv-exp--good { background: var(--inv-good-soft); color: var(--inv-good); }
.wp-root .dv-exp--muted { background: var(--inv-soft); color: var(--inv-faint); }
.wp-root .dv-pill { background: rgba(255, 255, 255, .24); }
.wp-root .dv-note--info { background: var(--inv-accent-soft); color: var(--inv-text); }
.wp-root .dv-note--good { background: var(--inv-good-soft); color: var(--inv-text); }
.wp-root .dv-note--bad { background: var(--inv-warn-soft); color: var(--inv-text); }
.wp-root select.dv-expiry-days { background: var(--inv-card); color: var(--inv-text); border-color: var(--inv-line); }

/* the select boxes and the selection bar */
.wp-root .dv-chk { background: var(--inv-card); border-color: var(--inv-faint); }
.wp-root .dv-chk.dv-chk--on,
.wp-root .dv-chk.dv-chk--some { background: var(--btn); border-color: transparent; color: #fff; }

.wp-root .dv-bulkbar { background: var(--inv-card); border-color: var(--inv-line); color: var(--inv-muted); }
.wp-root .dv-bulkbar.dv-bulkbar--on { background: var(--sel); border-color: var(--selline); color: var(--inv-text); }
.wp-root .dv-bulkbar-count strong { color: var(--inv-text); }
.wp-root a.dv-link { color: var(--accent); }

/* the pager */
.wp-root .dv-pager { background: var(--inv-soft); border-color: var(--inv-line); }
.wp-root .dv-pager-info { color: var(--inv-faint); }
.wp-root .dv-pager-btn { background: var(--inv-card); border-color: var(--inv-line); color: var(--inv-muted); }
.wp-root .dv-pager-btn:hover:not(:disabled) { background: var(--inv-hover); border-color: var(--selline); color: var(--inv-text); }
.wp-root .dv-pager-btn.dv-pager-active { background: var(--btn) !important; border-color: transparent !important; color: #fff !important; }

/* ───────────── the filter panel's controls (Usr_Devices) ───────────── */
.wp-root .dv-andor-label { color: var(--inv-faint); }
.wp-root .dv-andor-btns { background: var(--inv-card); border-color: var(--inv-line); }
.wp-root .dv-andor-btns button { color: var(--inv-muted); }
.wp-root .dv-andor-btns button.is-on { background: var(--btn); color: #fff; }
.wp-root .dv-opt-check { color: var(--inv-text); accent-color: var(--accent); }
.wp-root select.dv-opt-select { background: var(--inv-card); border-color: var(--inv-line); color: var(--inv-text); }
.wp-root select.dv-opt-select:focus { border-color: var(--accent); }
.wp-root .dv-opt-hint { color: var(--inv-faint); }
.wp-root .dv-opt-count { background: var(--inv-soft); color: var(--inv-muted); }
.wp-root .dv-filter-label { color: var(--inv-faint); }
.wp-root .dv-filter-clear { color: var(--accent); }
.wp-root .dv-sep { background: var(--inv-line); }

.wp-root .dv-side,
.wp-root .dv-side.card { background: transparent !important; border: 0 !important; box-shadow: none !important; }
.wp-root .dv-filter-head { background: transparent !important; }

/* the accordion of filters: Syncfusion's own colours, replaced */
.wp-root .e-accordion,
.wp-root .e-accordion .e-acrdn-item,
.wp-root .e-accordion .e-acrdn-panel { background: transparent !important; }

.wp-root .e-accordion .e-acrdn-item > .e-acrdn-header,
.wp-root .e-accordion .e-acrdn-item .e-acrdn-header {
    background: var(--inv-card) !important;
    border-color: var(--inv-line) !important;
    color: var(--inv-muted) !important;
}

.wp-root .e-accordion .e-acrdn-header .e-acrdn-header-content { color: var(--inv-muted) !important; }
.wp-root .e-accordion .e-acrdn-header .e-toggle-icon,
.wp-root .e-accordion .e-acrdn-header .e-tgl-collapse-icon { color: var(--inv-faint) !important; }

.wp-root .e-accordion .e-acrdn-item > .e-acrdn-header:hover { background: var(--inv-hover) !important; }

.wp-root .e-accordion .e-acrdn-item.e-selected > .e-acrdn-header,
.wp-root .e-accordion .e-acrdn-item.e-expand-state > .e-acrdn-header {
    background: var(--sel) !important;
    border-left: 2px solid var(--accent) !important;
}

.wp-root .e-accordion .e-acrdn-item.e-expand-state > .e-acrdn-header .e-acrdn-header-content,
.wp-root .e-accordion .e-acrdn-item.e-expand-state > .e-acrdn-header .e-toggle-icon { color: var(--accent) !important; }

/* ---- "open in a new window" button on its own (Usr_ViewWin, not joined) ---- */
.exa-winbtn:not(.exa-winbtn--joined) {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; flex: 0 0 auto; margin-left: 4px; padding: 0;
    border: 1px solid transparent; border-radius: 7px;
    background: transparent; color: inherit; opacity: .7;
    text-decoration: none !important; cursor: pointer; vertical-align: middle;
    transition: background-color .12s, opacity .12s, border-color .12s;
}
.exa-winbtn:not(.exa-winbtn--joined) i { font-size: 14px; line-height: 1; }
.exa-winbtn:not(.exa-winbtn--joined):hover, .exa-winbtn:not(.exa-winbtn--joined):focus-visible { opacity: 1; background: rgba(128,128,128,.16); border-color: rgba(128,128,128,.3); color: inherit; }
.exa-winbtn:not(.exa-winbtn--joined):focus-visible { outline: 2px solid var(--accent, #0067c0); outline-offset: 1px; }

/* ---- the View button and the open-in-a-new-window button, joined into one split button ----
   <span class="exa-split"> holds the View button first and the Usr_ViewWin (Joined) second. The right half wears the same classes as the View half (the call
   site passes them as Class), so it has the same colours, border and height; the rules below only join the two: no gap, square inner corners, no double
   border, and one thin vertical divider that is drawn in the text colour (so it follows the theme, light or dark, and any family of View button). */
.exa-split { display: inline-flex; align-items: stretch; flex: 0 0 auto; vertical-align: middle; white-space: nowrap; }
.exa-split > * { margin-top: 0 !important; margin-bottom: 0 !important; }
/* the View half: square on the right, the outer gap moves to the wrapper (the call site puts me-1 on the span) */
.exa-split > :first-child { margin-right: 0 !important; }
.exa-split > :first-child:not(:last-child) {
    border-top-right-radius: 0 !important; border-bottom-right-radius: 0 !important; border-right-width: 0 !important;
}
/* the open half */
.exa-split > .exa-winbtn--joined {
    position: relative; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
    margin-left: 0 !important; margin-right: 0 !important;
    border-top-left-radius: 0 !important; border-bottom-left-radius: 0 !important; border-left-width: 0 !important;
    text-decoration: none !important; cursor: pointer; opacity: 1; box-sizing: border-box;
}
.exa-split > .exa-winbtn--joined:not(.prd-act):not(.ord-act-btn) { padding-left: 9px !important; padding-right: 9px !important; }
.exa-split > .exa-winbtn--joined > i { margin: 0 !important; padding: 0 !important; font-size: 1em !important; line-height: 1 !important; }
/* the divider between the two halves */
.exa-split > .exa-winbtn--joined::before {
    content: ""; position: absolute; left: 0; top: 22%; bottom: 22%; width: 1px;
    background: currentColor; opacity: .28; pointer-events: none;
}
.exa-split > .exa-winbtn--joined:focus-visible { outline: 2px solid var(--accent, #0067c0); outline-offset: -2px; }
