﻿/* ================================================================
   managedevice-page.css — Device Inventory Page
   Design system: ops-* tokens (identical to dashboard-page.css)
   ================================================================ */

/* ── Design tokens ── */
:root {
    --ops-bg:           #f6f7f9;
    --ops-surface:      #ffffff;
    --ops-surface-2:    #f8fafc;
    /* เคยเขียนเป็น var(--ops-border, #e6e8ec) คือให้ตัวแปรอ้างถึงชื่อตัวเอง ซึ่งสเปกถือเป็นวงวน
       ตัวแปรจึงกลายเป็น guaranteed-invalid และค่าสำรองก็ไม่ถูกใช้ เพราะวงวนถูกตรวจก่อนถึงค่าสำรอง
       ผลคือ var(--ops-border) ทุกจุดคืนค่าว่าง และ declaration ที่ใช้มันถูกทิ้งทั้งบรรทัด —
       เส้นขอบหายไปเงียบ ๆ ทั้งหน้าโดยไม่มี error ให้เห็น */
    --ops-border:       #e6e8ec;
    --ops-border-soft:  #eef0f3;
    --ops-text:         #0b1220;
    --ops-text-2:       #3b4252;
    --ops-muted:        #5b6577;
    --ops-muted-2:      #8b94a3;
    --ops-primary:      #4f46e5;
    --ops-primary-50:   #eef2ff;
    --ops-primary-100:  #e0e7ff;
    --ops-success:      #15803d;
    --ops-warning:      #b45309;
    --ops-danger:       #b91c1c;
    --ops-sh-1: 0 1px 2px rgba(15,23,42,.04), 0 0 0 1px rgba(15,23,42,.04);
    --ops-sh-2: 0 4px 14px rgba(15,23,42,.06), 0 0 0 1px rgba(15,23,42,.04);
    --ops-r: 10px;
    --ops-font: var(--sc-font-sans);
    --ops-font-mono: var(--sc-font-mono);
}

@keyframes dv-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
@keyframes dv-spin {
    to { transform: rotate(360deg); }
}

/* ── Metronic wrapper reset ── */
#kt_app_content:has(.dv-page) {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

/* ================================================================
   PAGE
   ================================================================ */
.dv-page {
    display: flex;
    height: calc(100vh - var(--sc-header-h, 51px));
    overflow: hidden;
    background: var(--ops-bg);
    font-family: var(--ops-font);
    color: var(--ops-text);
}

/* ── Resizer ── */
.dv-resizer {
    width: 0;
    flex-shrink: 0;
    background: transparent;
    cursor: col-resize;
    position: relative;
    z-index: 1;
}
/* แถบนี้ไม่กินที่ในแถวเลย (width: 0) แผงสองข้างจึงชิดกันสนิท
   ของเดิมกว้าง 5px และระบายสีขอบเต็มทั้ง 5px กลายเป็นแถบเทาหนาคั่นกลางหน้า
   พอทำให้โปร่งแล้วก็ยังเหลือช่องว่าง 5px ที่พื้นหลังหน้าโผล่ขึ้นมาแทน

   ตอนอยู่เฉย ๆ ไม่วาดเส้นเลย เพราะแผงที่อยู่ซ้ายของ resizer ทั้งสองตัว
   (.rr-rail กับ .dv-sidebar) มี border-right ของตัวเองอยู่แล้ว
   ถ้าวาดอีกเส้นจะกลายเป็นสองเส้นห่างกัน 2px ซึ่งอ่านเป็นแถบหนา ไม่ใช่เส้นคั่น
   เส้นจะโผล่มาตอนชี้หรือลากเท่านั้น ทำหน้าที่บอกว่าตรงนี้จับได้ */
.dv-resizer::before {
    content: '';
    position: absolute; top: 0; bottom: 0; left: -1px; width: 3px;
    background: transparent;
    transition: background .15s;
}
.dv-resizer:hover::before, .dv-resizer.dragging::before { background: var(--ops-primary); }
.dv-resizer::after {
    content: '';
    position: absolute; top: 0; bottom: 0; left: -4px; right: -4px;
}

/* ================================================================
   MAIN AREA
   ================================================================ */
.dv-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* ================================================================
   HEADER
   ================================================================ */
.dv-hdr {
    background: var(--ops-surface);
    border-bottom: 1px solid var(--ops-border-soft);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
}
.dv-hdr-title {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--ops-text);
    line-height: 1.25;
    margin: 0;
}
.dv-hdr-sub {
    font-size: 12px;
    color: var(--ops-muted);
    margin: 2px 0 0;
    display: flex;
    align-items: center;
    gap: 6px;
}
.dv-hdr-group {
    font-size: 11px;
    color: var(--ops-primary);
    background: var(--ops-primary-50);
    padding: 1px 6px;
    border-radius: 99px;
    font-weight: 500;
}
.dv-hdr-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.dv-hdr-sep {
    width: 1px;
    height: 20px;
    background: var(--ops-border-soft);
    flex-shrink: 0;
}

/* ── Buttons ── */
.dv-btn {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 5px 10px;
    border: 1px solid var(--ops-border);
    border-radius: 7px;
    background: var(--ops-surface);
    color: var(--ops-muted);
    font: 500 12px var(--ops-font);
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background .12s, color .12s;
}
.dv-btn:hover { background: var(--ops-surface-2); color: var(--ops-text-2); }
.dv-btn svg { width: 12px; height: 12px; flex-shrink: 0; }
.dv-chevron { width: 9px; height: 9px; opacity: .5; }
.dv-btn--disabled {
    opacity: .4;
    cursor: not-allowed;
    pointer-events: none;
}

.dv-icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px;
    border: 1px solid var(--ops-border);
    border-radius: 7px;
    background: var(--ops-surface);
    color: var(--ops-muted);
    cursor: pointer;
    flex-shrink: 0;
    transition: background .12s, color .12s;
}
.dv-icon-btn:hover { background: var(--ops-surface-2); color: var(--ops-text-2); }
.dv-icon-btn svg { width: 13px; height: 13px; }

/* ── Dropdown ── */
.dv-dropdown { position: relative; }
.dv-dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 210px;
    background: var(--ops-surface);
    border: 1px solid var(--ops-border);
    border-radius: 9px;
    box-shadow: var(--ops-sh-2);
    z-index: 1000;
    padding: 4px;
}
.dv-dropdown-item {
    display: flex; align-items: center; gap: 7px;
    width: 100%;
    padding: 7px 9px;
    border: none; border-radius: 6px;
    background: transparent;
    color: var(--ops-text-2);
    font: 400 12.5px var(--ops-font);
    cursor: pointer;
    text-align: left;
    transition: background .1s;
}
.dv-dropdown-item:hover { background: var(--ops-surface-2); color: var(--ops-text); }
/* Controls ▸ Transfer … entries are labels (they open a file picker through `for=`), so they shed the
   margin a label carries and otherwise look exactly like the buttons around them. */
label.dv-dropdown-item { margin: 0; }
.dv-dropdown-item svg { width: 12px; height: 12px; flex-shrink: 0; opacity: .6; }
.dv-dropdown-item i   { font-size: 12px; opacity: .6; flex-shrink: 0; }
.dv-dropdown-sep      { height: 1px; background: var(--ops-border-soft); margin: 3px 0; }
/* หัวข้อกลุ่มในเมนู — บอกว่าสิ่งที่อยู่ใต้มันเป็นคนละชนิดกับที่อยู่เหนือมัน ไม่ใช่รายการต่อ ๆ กันไป */
.dv-dropdown-lbl      { padding: 4px 12px 2px; font-size: 10px; font-weight: 600; letter-spacing: .06em;
                        text-transform: uppercase; color: var(--ops-muted-2); user-select: none; }
/* MA-204 — names the short mobile command list so it is not mistaken for a truncated Windows one. */
.dv-dropdown-head     { padding: 6px 12px 4px; font-size: 11px; font-weight: 600; letter-spacing: .04em;
                        text-transform: uppercase; color: var(--ops-text-muted, #6b7280); }
/* บอกเหตุผลที่รายการในเมนูเป็นสีเทา — เมนูที่กดไม่ได้โดยไม่บอกอะไรเลยคือสิ่งที่ทำให้คนเสียเวลา
   หาสาเหตุเอง โดยเฉพาะเมื่อเครื่องที่ขวางอยู่ไม่ได้อยู่บนจอ */
.dv-dropdown-warn     { padding: 7px 12px; margin: 2px 4px 4px; border-radius: 6px;
                        font-size: 11.5px; line-height: 1.45;
                        color: var(--ops-c-amb-1, #92400e);
                        background: var(--ops-c-amb-5, #fef3c7); }
/* Shown in place of the list when a menu has nothing to offer — an empty menu reads as broken. */
.dv-dropdown-empty    { padding: 8px 12px; font-size: 12px; color: var(--ops-text-3, #94a3b8); }
.dv-dropdown-item--sel {
    background: var(--ops-primary-50);
    color: var(--ops-primary);
    font-weight: 600;
}
.dv-dropdown-item--sel:hover { background: var(--ops-primary-50); color: var(--ops-primary); }
/* Filter-bar menus are narrower than the toolbar action menus */
.dv-filter-menu { min-width: 140px; }

/* An entry with a second level — Inventory ▸ Save PDF File, StarCat11's Data menu. The level opens under
   its entry, indented, rather than beside it: dv-toolbar.js places these menus as fixed boxes that scroll
   (overflow-y: auto) and pushes them against the window's edge, so a level drawn beside the box would be
   clipped by it, or fall off the screen. */
.dv-dropdown-subwrap > .dv-dropdown-item .dv-sub-chevron {
    margin-left: auto; width: 10px; height: 10px; opacity: .55; transition: transform .12s;
}
.dv-dropdown-subwrap.open > .dv-dropdown-item { background: var(--ops-surface-2); color: var(--ops-text); }
.dv-dropdown-subwrap.open > .dv-dropdown-item .dv-sub-chevron { transform: rotate(90deg); }
.dv-dropdown-sub { padding: 2px 0 2px 18px; }

/* ── Column picker ── */
/* ปุ่มคอลัมน์ในหัวตาราง — ทรงเดียวกับ .csp-colbtn ของระบบตารางกลาง
   โปร่งตอนพัก มีกรอบตอนชี้ จะได้ไม่แย่งสายตากับหัวคอลัมน์ที่อยู่ข้าง ๆ */
.dv-colbtn {
    width: 26px; height: 26px; margin: -4px -4px -4px 0;
    display: inline-grid; place-items: center;
    border: 1px solid transparent; border-radius: 6px;
    background: transparent; color: var(--ops-muted-2);
    cursor: pointer; transition: color .12s, border-color .12s, background .12s;
}
.dv-colbtn:hover { color: var(--ops-primary); border-color: var(--ops-border); background: var(--ops-surface); }
.dv-colbtn svg { width: 15px; height: 15px; }

/* เมนูที่กางจากหัวตาราง อ้างอิงกับการ์ด ไม่ใช่กับปุ่ม
   ต้องเขียนสองคลาสซ้อนกัน เพราะกฎ .dv-col-menu อยู่ถัดลงไปในไฟล์นี้
   ถ้าใช้คลาสเดียว specificity เท่ากันแล้วตัวที่อยู่ทีหลังจะทับค่า top/right นี้ */
.dv-col-menu.dv-col-menu-table { top: 40px; right: 8px; }
.dv-col-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    width: 220px;
    background: var(--ops-surface);
    border: 1px solid var(--ops-border);
    border-radius: 9px;
    box-shadow: var(--ops-sh-2);
    z-index: 1000;
    overflow: hidden;
}
.dv-col-menu-hdr {
    display: flex; align-items: center; justify-content: space-between;
    padding: 9px 12px 8px;
    border-bottom: 1px solid var(--ops-border-soft);
    font: 600 12px var(--ops-font);
    color: var(--ops-text);
}
.dv-col-menu-hdr button {
    font: 500 11px var(--ops-font);
    color: var(--ops-primary);
    background: none; border: none; cursor: pointer; padding: 0;
}
.dv-col-menu-hdr button:hover { text-decoration: underline; }
.dv-col-list { max-height: 270px; overflow-y: auto; padding: 4px; }
.dv-col-item {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background .1s;
    user-select: none;
}
.dv-col-item:hover { background: var(--ops-surface-2); }
.dv-col-item label { font: 400 12.5px var(--ops-font); color: var(--ops-text-2); cursor: pointer; flex: 1; }
.dv-col-item label.disabled { color: var(--ops-muted-2); }

/* Toggle switch */
.dv-toggle {
    width: 30px; height: 16px; border-radius: 99px;
    background: var(--ops-border);
    position: relative; flex-shrink: 0;
    transition: background .15s;
}
.dv-toggle.on { background: var(--ops-primary); }
.dv-toggle::after {
    content: '';
    position: absolute; top: 2px; left: 2px;
    width: 12px; height: 12px; border-radius: 50%;
    background: var(--ops-surface, #fff);
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
    transition: left .15s;
}
.dv-toggle.on::after { left: 16px; }

/* ================================================================
   KPI STRIP
   ================================================================ */
.dv-kpi-strip {
    display: flex;
    gap: 10px;
    padding: 10px 20px;
    flex-shrink: 0;
}
.dv-kpi {
    flex: 1;
    background: var(--ops-surface);
    border: 1px solid var(--ops-border-soft);
    border-radius: var(--ops-r);
    box-shadow: var(--ops-sh-1);
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.dv-kpi-eyebrow {
    font: 600 10px var(--ops-font);
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--ops-muted-2);
    margin-bottom: 3px;
}
.dv-kpi-val {
    font: 600 26px var(--ops-font-mono);
    letter-spacing: -0.02em;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}
.dv-kpi-sub { font: 400 11.5px var(--ops-font); color: var(--ops-muted); }

.dv-val--primary { color: var(--ops-primary); }
.dv-val--success { color: var(--ops-success); }
.dv-val--danger  { color: var(--ops-danger); }
.dv-val--warning { color: var(--ops-warning); }

/* KPI skeleton */
.dv-kpi--skel .dv-skel--val {
    height: 26px; width: 55%; border-radius: 5px; margin-bottom: 5px;
    background: linear-gradient(90deg, var(--ops-border-soft, #edf0f4) 25%, var(--ops-surface-2, #f8f9fb) 37%, var(--ops-border-soft, #edf0f4) 63%);
    background-size: 200% 100%;
    animation: dv-shimmer 1.4s infinite;
}
.dv-kpi--skel .dv-skel--sub {
    height: 10px; width: 42%; border-radius: 4px;
    background: linear-gradient(90deg, var(--ops-border-soft, #edf0f4) 25%, var(--ops-surface-2, #f8f9fb) 37%, var(--ops-border-soft, #edf0f4) 63%);
    background-size: 200% 100%;
    animation: dv-shimmer 1.4s infinite;
}

/* ================================================================
   FILTER BAR
   ================================================================ */
.dv-filter-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    row-gap: 8px;
    flex-wrap: wrap;
    padding: 8px 20px;
    border-bottom: 1px solid var(--ops-border-soft);
    background: var(--ops-surface);
    flex-shrink: 0;
}
/* Device-management actions: a distinct band that sits inline on the SAME row as the filters,
   right after them — visually separated by its own background + border. */
.dv-filter-bar .dv-hdr-actions {
    /* Scrolls sideways rather than being cut off. The row is wider than a narrow window, and the
       page body clips it — the buttons past the edge could not be reached at all. Shrinking to the
       bar's width (min-width:0 is what actually lets a flex item shrink below its content) turns the
       overflow into a scroll. The children keep their own size so they scroll instead of squeezing.
       Menus opened from here are pinned to the viewport by dv-toolbar.js; a scroll container clips
       both axes, and without that they would be cut to the height of the row. */
    flex-shrink: 1;
    min-width: 0;
    overflow-x: auto;
    gap: 6px;
    margin-left: 2px;
    padding: 4px 8px;
    background: var(--ops-surface-2);
    border: 1px solid var(--ops-border-soft);
    border-radius: 9px;
}
/* Buttons keep the lighter surface so they stand out against the band; hover accents the border. */
.dv-filter-bar .dv-hdr-actions > * { flex-shrink: 0; }
.dv-filter-bar .dv-hdr-actions::-webkit-scrollbar { height: 5px; }
.dv-filter-bar .dv-hdr-actions::-webkit-scrollbar-thumb { background: var(--ops-border-soft); border-radius: 3px; }

/* An edge shade on whichever side has more behind it. Overlay scrollbars are invisible until
   something moves, so without this the row reads as cut off rather than scrollable.
   An inset shadow rather than a mask or a gradient overlay: those paint over — or clip — the
   dropdown menus, which are pinned to the viewport and would vanish. This paints on the
   background, behind the buttons, and cannot swallow anything. */
.dv-filter-bar .dv-hdr-actions--more-right { box-shadow: inset -14px 0 10px -10px rgba(15, 23, 42, .35); }
.dv-filter-bar .dv-hdr-actions--more-left  { box-shadow: inset  14px 0 10px -10px rgba(15, 23, 42, .35); }
.dv-filter-bar .dv-hdr-actions--more-left.dv-hdr-actions--more-right {
    box-shadow: inset 14px 0 10px -10px rgba(15, 23, 42, .35),
                inset -14px 0 10px -10px rgba(15, 23, 42, .35);
}

.dv-filter-bar .dv-hdr-actions .dv-btn:hover,
.dv-filter-bar .dv-hdr-actions .dv-icon-btn:hover {
    background: var(--ops-surface);
    border-color: var(--ops-primary);
    color: var(--ops-text-2);
}
/* Endpoint count + current group — right end of the toolbar (moved from the removed title header). */
.dv-filter-bar .dv-count {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    flex-shrink: 0;
    font-size: 12px;
    color: var(--ops-muted);
}
.dv-count-num { font-weight: 700; color: var(--ops-text); }
.dv-count-group {
    font-size: 11px;
    color: var(--ops-primary);
    background: var(--ops-primary-50);
    padding: 1px 8px;
    border-radius: 99px;
    font-weight: 500;
}
.dv-count-selected {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    color: #ffffff;
    background: var(--ops-primary);
    padding: 1px 4px 1px 8px;
    border-radius: 99px;
}
.dv-count-selected-x {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 15px; height: 15px;
    border: 0; border-radius: 50%;
    background: rgba(255,255,255,.2);
    color: #ffffff;
    font-size: 9px;
    line-height: 1;
    cursor: pointer;
}
.dv-count-selected-x:hover { background: rgba(255,255,255,.35); }

/* The count opens "show only these"; CSV and Save as group sit beside it, on the same pill. */
.dv-count-selected-show {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 0; border: 0; background: none;
    font: inherit; color: inherit; cursor: pointer;
}
.dv-count-selected-show:hover,
.dv-count-selected-show.on { text-decoration: underline; text-underline-offset: 2px; }
.dv-count-offpage { font-weight: 500; opacity: .85; }
.dv-count-selected-act {
    padding: 1px 7px; border: 0; border-radius: 99px;
    background: rgba(255,255,255,.2); color: #ffffff;
    font: inherit; font-size: 10.5px; cursor: pointer;
}
.dv-count-selected-act:hover { background: rgba(255,255,255,.35); }

/* "All 50 on this page are selected · Select all 2,425 that match" — above the table. */
.dv-select-banner {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 10px;
    padding: 7px 12px;
    font-size: 12.5px; color: var(--ops-text-2);
    background: var(--ops-primary-50, #eef2ff);
    border-bottom: 1px solid var(--ops-border-soft);
}
.dv-select-banner-btn {
    padding: 0; border: 0; background: none;
    font: inherit; font-weight: 600; color: var(--ops-primary); cursor: pointer;
}
.dv-select-banner-btn:hover { text-decoration: underline; }
.dv-select-banner-btn:disabled { opacity: .6; cursor: progress; text-decoration: none; }
.dv-select-banner-note { font-size: 11.5px; color: var(--ops-muted); }

/* The row the arrow keys are on: a bar on its left edge, so it reads apart from "selected". */
.dv-table tbody tr.dv-row--cursor > td:first-child { box-shadow: inset 3px 0 0 var(--ops-primary); }

/* The row menu opened on a selection says how many it will act on. */
.dv-dropdown-head {
    padding: 6px 12px 4px;
    font-size: 11px; font-weight: 600; letter-spacing: .02em;
    color: var(--ops-muted);
}

.dv-bulk-count { width: 140px; margin-top: 8px; font-variant-numeric: tabular-nums; }
.dv-modal-hint--err { color: var(--ops-danger); margin-top: 6px; }
.dv-search {
    display: flex; align-items: center; gap: 6px;
    background: var(--ops-surface-2);
    border: 1px solid var(--ops-border);
    border-radius: 7px;
    padding: 5px 9px;
    min-width: 200px;
    transition: border-color .12s;
}
.dv-search:focus-within { border-color: var(--ops-primary); }
.dv-search svg { flex-shrink: 0; opacity: .45; width: 13px; height: 13px; }
.dv-search input {
    flex: 1; border: none; background: transparent;
    font: 400 12.5px var(--ops-font); color: var(--ops-text);
    outline: none; min-width: 0;
}
.dv-search input::placeholder { color: var(--ops-muted-2); }
/* × clear button inside the search box — shows only while there is text. */
.dv-search-clear {
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0; width: 16px; height: 16px;
    padding: 0; border: none; border-radius: 4px;
    background: transparent; color: var(--ops-muted-2); cursor: pointer;
    transition: background .12s, color .12s;
}
.dv-search-clear:hover { color: var(--ops-danger, #b91c1c); background: var(--ops-surface); }
.dv-search .dv-search-clear svg { width: 12px; height: 12px; opacity: 1; }

.dv-filter-btn {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 5px 10px;
    border: 1px solid var(--ops-border);
    border-radius: 7px;
    background: var(--ops-surface);
    color: var(--ops-muted);
    font: 400 12px var(--ops-font);
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background .12s, border-color .12s;
}
.dv-filter-btn:hover { background: var(--ops-surface-2); color: var(--ops-text-2); }
.dv-filter-btn--active {
    border-color: var(--ops-primary);
    color: var(--ops-primary);
    background: var(--ops-primary-50);
}
.dv-flabel {
    font: 600 10.5px var(--ops-font);
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--ops-muted-2);
}
.dv-filter-btn--active .dv-flabel { color: var(--ops-primary); opacity: .75; }
.dv-filter-btn svg { width: 9px; height: 9px; opacity: .5; }

/* Clear-all-filters button — shows only while a toolbar filter is active. */
.dv-filter-clear {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 5px 10px;
    border: 1px solid transparent;
    border-radius: 7px;
    background: transparent;
    color: var(--ops-muted);
    font: 500 12px var(--ops-font);
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background .12s, color .12s;
}
.dv-filter-clear:hover { background: var(--ops-surface-2); color: var(--ops-danger, #b91c1c); }
.dv-filter-clear svg { width: 12px; height: 12px; opacity: .8; }

/* Advanced search: the sliders icon beside the search box, and the chip that says it is in force. */
.dv-adv-btn svg { width: 15px; height: 15px; }
.dv-adv-btn--on {
    border-color: var(--ops-primary);
    color: var(--ops-primary);
    background: var(--ops-primary-50);
}

.dv-adv-chip {
    display: inline-flex; align-items: stretch;
    border: 1px solid var(--ops-primary);
    border-radius: 7px;
    background: var(--ops-primary-50);
    color: var(--ops-primary);
    flex-shrink: 0;
    overflow: hidden;
}
.dv-adv-chip button {
    border: 0; background: transparent; color: inherit; cursor: pointer;
    font: 500 12px var(--ops-font);
}
.dv-adv-chip-main { padding: 4px 4px 4px 10px; white-space: nowrap; }
.dv-adv-chip-main:hover { text-decoration: underline; }
.dv-adv-chip-x { padding: 0 8px; font-size: 10px !important; opacity: .7; }
.dv-adv-chip-x:hover { opacity: 1; background: var(--ops-primary-100); }

/* The panel hangs off the bottom of the filter bar and slides down over the list. The bar gets
   position:relative but no z-index — a z-index would make it a stacking context and trap the
   panel under the table's row menu (1200) — so the panel's own 1300 reaches the page level, still
   below the detail drawer (1500+). The backdrop dims only the list: .dv-main-body clips it. */
.dv-filter-bar { position: relative; }
.dv-adv-backdrop {
    position: absolute; left: 0; right: 0; top: 100%; height: 100vh;
    z-index: 1250;
    background: rgba(15, 23, 42, .18);
    opacity: 0; visibility: hidden;
    transition: opacity .18s ease, visibility 0s linear .18s;
}
.dv-adv-backdrop.is-open { opacity: 1; visibility: visible; transition: opacity .18s ease; }
/* A slate wash barely shows on a slate page — darker themes get a black one. */
html:is([data-theme="dark"], [data-theme="claude-dark"], [data-theme="indigo-dark"],
        [data-theme="royal-dark"], [data-theme="green-eco-dark"], [data-theme="colorful-dark"]) .dv-adv-backdrop {
    background: rgba(0, 0, 0, .45);
}
.dv-adv-pop {
    position: absolute; left: 12px; top: calc(100% + 6px);
    z-index: 1300;
    width: min(800px, calc(100% - 24px));
    max-height: calc(100vh - 220px);
    overflow-y: auto;
    border-radius: var(--ops-r, 10px);
    opacity: 0; visibility: hidden;
    transform: translateY(-14px);
    transition: transform .2s ease, opacity .16s ease, visibility 0s linear .2s;
}
.dv-adv-pop.is-open {
    opacity: 1; visibility: visible; transform: none;
    transition: transform .22s cubic-bezier(.2, .8, .2, 1), opacity .16s ease;
}
@media (prefers-reduced-motion: reduce) {
    .dv-adv-pop, .dv-adv-pop.is-open { transition: none; transform: none; }
}
/* On a phone the filter bar wraps to ~165px, so the panel starts lower; anything taller than what
   is left would be cut off by .dv-main-body with Search underneath. It scrolls inside instead. */
@media (max-width: 720px) {
    .dv-adv-pop { max-height: calc(100dvh - 340px); min-height: 0; }
}

.dv-page-info {
    font: 500 11.5px var(--ops-font-mono);
    color: var(--ops-muted-2);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ================================================================
   BODY
   ================================================================ */
/* ตารางกินพื้นที่เต็มกรอบ ไม่มีขอบเว้นรอบการ์ด */
.dv-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
}
/* ไม่ใช่การ์ดอีกแล้ว — ไม่มีเส้นขอบ ไม่มีมุมมน ไม่มีเงา
   เงาต้องเอาออกด้วยไม่ใช่แค่ border เพราะ --ops-sh-1 ของหน้านี้มีชั้น 0 0 0 1px
   ซึ่งเป็นวงแหวนซ้อนนอกขอบพอดี ลบแต่ border แล้วจะยังเห็นเส้นอยู่เหมือนเดิม */
.dv-table-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--ops-surface);
    /* จุดอ้างอิงของเมนูคอลัมน์ ซึ่งต้องอยู่นอกกล่องที่เลื่อนได้ */
    position: relative;
}
.dv-table-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: auto;
    position: relative;
}
/* แถบเลื่อนของตาราง — จางมากตอนพัก เข้มขึ้นตอนเอาเมาส์เข้า
   ต้องมี !important เพราะ starcat-theme.css ตั้ง scrollbar-color ใส่ div ทุกตัวทั้งเว็บ
   ด้วย !important อยู่แล้ว ตัวเลือกที่ specificity สูงกว่าจึงจะชนะได้
   (นั่นคือเหตุผลที่ก่อนหน้านี้ทุกคนสรุปว่าปรับสีแถบเลื่อนไม่ได้ — มันถูกทับอยู่เงียบ ๆ)
   ใช้โทเคนของหน้านี้ ธีมมืดจึงปรับตามเอง ไม่ต้องเขียนซ้ำ
   หมายเหตุ: scrollbar-color คุมทั้งสองแกน แยกเฉพาะแกนนอนไม่ได้ */
.dv-table-scroll {
    scrollbar-width: thin;
    scrollbar-color: var(--ops-border-soft) transparent !important;
}
.dv-table-scroll:hover {
    scrollbar-color: var(--ops-muted-2) transparent !important;
}

.dv-table-scroll::-webkit-scrollbar { width: 6px; height: 6px; }
.dv-table-scroll::-webkit-scrollbar-thumb { background: var(--ops-border-soft); border-radius: 3px; }
.dv-table-scroll::-webkit-scrollbar-corner { background: transparent; }

/* Loading overlay */
.dv-loading-overlay {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    background: rgba(248,250,252,.75);
    z-index: 10;
    font: 13px var(--ops-font);
    color: var(--ops-muted);
    gap: 8px;
}
.dv-loading-spinner {
    width: 14px; height: 14px;
    border: 2px solid var(--ops-border-soft);
    border-top-color: var(--ops-primary);
    border-radius: 50%;
    animation: dv-spin .8s linear infinite;
    flex-shrink: 0;
}

/* ================================================================
   TABLE
   ================================================================ */
.dv-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.dv-table thead th {
    position: sticky; top: 0; z-index: 2;
    background: var(--ops-surface-2);
    border-bottom: 1px solid var(--ops-border-soft);
    padding: 8px 12px;
    text-align: left;
    font: 600 10.5px var(--ops-font);
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--ops-muted);
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    transition: color .1s;
}
.dv-table thead th:hover:not(.dv-th-check) { color: var(--ops-text-2); }
.dv-table thead th.dv-sorted { color: var(--ops-primary); }
.dv-th-check { width: 40px; cursor: default !important; padding: 8px 10px !important; }

.dv-table tbody tr {
    border-bottom: 1px solid var(--ops-border-soft);
    cursor: pointer;
    transition: background .08s;
}
.dv-table tbody tr:last-child { border-bottom: none; }
.dv-table tbody tr:hover { background: var(--ops-surface-2); }
.dv-row--active   { background: var(--ops-primary-50) !important; }
.dv-row--selected { background: var(--ops-primary-50, #f0f4ff); }

.dv-table td {
    padding: 9px 12px;
    vertical-align: middle;
    color: var(--ops-text-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}
.dv-table td:first-child { padding: 9px 10px; max-width: none; }
.dv-table td.mono     { font-family: var(--ops-font-mono); font-size: 12px; }
.dv-td-muted  { font-size: 12px; color: var(--ops-muted) !important; }
.dv-td-sm     { font-size: 11px !important; }

/* ── Checkbox ──
   --ops-border alone is too subtle here — it's tuned for plain dividers, and in dark mode it sits only
   one shade off the row background (#334155 on #1e293b/#172033), so an unchecked box all but disappears.
   A stronger border plus a faint fill makes it read as a distinct shape on any surface/theme. */
.dv-checkbox {
    width: 16px; height: 16px;
    border: 1.5px solid var(--ops-border-strong, #d3d7df);
    border-radius: 4px;
    background: var(--ops-surface-2, #f8fafc);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: border-color .12s, background .12s;
    flex-shrink: 0;
}
.dv-checkbox:hover { border-color: var(--ops-primary); }
.dv-checkbox.checked {
    background: var(--ops-primary);
    border-color: var(--ops-primary);
}
.dv-checkbox.checked::after {
    content: '';
    width: 4px; height: 7px;
    border: 1.5px solid var(--ops-surface, #fff);
    border-top: none; border-left: none;
    transform: rotate(45deg) translate(-1px, -1px);
    display: block;
}

/* ── Device cell ── */
.dv-device-cell {
    display: flex; align-items: center; gap: 9px;
}
.dv-device-icon {
    width: 28px; height: 28px; border-radius: 7px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.dv-device-icon.online  { background: rgba(21,128,61,.1); }
.dv-device-icon.offline { background: rgba(185,28,28,.08); }
.dv-device-name { font: 500 13px var(--ops-font); color: var(--ops-text); line-height: 1.3; }
.dv-device-sub  { font: 400 11px var(--ops-font); color: var(--ops-muted-2); line-height: 1.3; }

/* ── Badges ── */
.dv-badge {
    display: inline-block;
    padding: 1px 7px; border-radius: 99px;
    font: 600 10.5px var(--ops-font);
    letter-spacing: .03em;
    white-space: nowrap;
}
.dv-badge-notebook { background: rgba(79,70,229,.1); color: var(--ops-primary, #4f46e5); }
.dv-badge-desktop  { background: rgba(91,101,119,.1); color: var(--ops-muted); }
/* "behind the published build" — a note beside the version, not an alarm: an out-of-date agent
   still works, it just has not been updated yet. */
.dv-badge-warn {
    margin-left: .4em;
    padding: 0 .4em;
    border-radius: 4px;
    font-size: 10px;
    background: rgba(217,119,6,.12);
    color: var(--ops-warning, #b45309);
}

/* ── OS tag ── */
.dv-os-tag {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 12px; color: var(--ops-text-2);
}

/* ── Owner ── */
.dv-owner-tag {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 12px; color: var(--ops-text-2);
}
.dv-owner-avatar {
    width: 20px; height: 20px; border-radius: 50%;
    background: var(--ops-primary-100);
    color: var(--ops-primary);
    font: 600 9px var(--ops-font);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
/* ค่าที่แปลว่า "ยังไม่ได้กำหนด" ไม่ว่าจะมาจาก UI เขียนเอง (เจ้าของ) หรือเป็นข้อมูลจริง (หน่วยงาน สถานที่)
   จางกว่าและเอียง เพื่อให้ต่างจากชื่อจริงของหน่วยงานหรือสถานที่ที่อยู่แถวข้าง ๆ กัน */
.dv-owner-unassigned,
.dv-unassigned { font-size: 12px; color: var(--ops-muted-2); font-style: italic; }

/* ================================================================
   PAGINATION
   ================================================================ */
.dv-pager {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 8px 12px;
    border-top: 1px solid var(--ops-border-soft);
    flex-shrink: 0;
    background: var(--ops-surface);
    border-radius: 0 0 var(--ops-r) var(--ops-r);
}
.dv-page-btn {
    min-width: 28px; height: 28px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--ops-muted);
    font: 500 12px var(--ops-font-mono);
    cursor: pointer;
    padding: 0 5px;
    font-variant-numeric: tabular-nums;
    transition: background .1s, color .1s, border-color .1s;
}
.dv-page-btn:hover:not(:disabled) {
    background: var(--ops-surface-2);
    color: var(--ops-text);
    border-color: var(--ops-border);
}
.dv-page-btn.active  { background: var(--ops-primary); color: #fff; border-color: var(--ops-primary); }
.dv-page-btn:disabled { opacity: .35; cursor: not-allowed; }
.dv-page-sep { font-size: 12px; color: var(--ops-muted-2); padding: 0 2px; }

.dv-pager-right {
    margin-left: auto;
    display: flex; align-items: center; gap: 10px;
}
.dv-per-page {
    display: flex; align-items: center; gap: 6px;
    font: 400 12px var(--ops-font); color: var(--ops-muted);
}
.dv-per-page select {
    border: 1px solid var(--ops-border); border-radius: 6px;
    padding: 2px 6px; font: 500 12px var(--ops-font);
    color: var(--ops-text); background: var(--ops-surface);
    cursor: pointer; outline: none;
}
.dv-total-label {
    font: 500 11.5px var(--ops-font-mono);
    color: var(--ops-muted-2);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* ================================================================
   SKELETON TABLE
   ================================================================ */
.dv-skel-table { flex: 1; }
.dv-skel-thead {
    display: flex; gap: 12px;
    padding: 10px 12px;
    background: var(--ops-surface-2);
    border-bottom: 1px solid var(--ops-border-soft);
}
.dv-skel-th {
    height: 9px; border-radius: 4px; flex: 1;
    background: linear-gradient(90deg, var(--ops-border-soft, #edf0f4) 25%, var(--ops-surface-2, #f8f9fb) 37%, var(--ops-border-soft, #edf0f4) 63%);
    background-size: 200% 100%;
    animation: dv-shimmer 1.4s infinite;
}
.dv-skel-row {
    display: flex; gap: 12px;
    padding: 11px 12px;
    border-bottom: 1px solid var(--ops-border-soft);
}
.dv-skel-cell {
    height: 12px; border-radius: 4px; flex: 1;
    background: linear-gradient(90deg, var(--ops-border-soft, #edf0f4) 25%, var(--ops-surface-2, #f8f9fb) 37%, var(--ops-border-soft, #edf0f4) 63%);
    background-size: 200% 100%;
    animation: dv-shimmer 1.4s infinite;
}
.dv-skel-pager {
    display: flex; align-items: center; gap: 6px;
    padding: 9px 12px;
    border-top: 1px solid var(--ops-border-soft);
}
.dv-skel-page-btn {
    width: 28px; height: 28px; border-radius: 6px;
    background: linear-gradient(90deg, var(--ops-border-soft, #edf0f4) 25%, var(--ops-surface-2, #f8f9fb) 37%, var(--ops-border-soft, #edf0f4) 63%);
    background-size: 200% 100%;
    animation: dv-shimmer 1.4s infinite;
}
.dv-skel-page-info {
    height: 14px; width: 120px; border-radius: 4px;
    margin-left: auto;
    background: linear-gradient(90deg, var(--ops-border-soft, #edf0f4) 25%, var(--ops-surface-2, #f8f9fb) 37%, var(--ops-border-soft, #edf0f4) 63%);
    background-size: 200% 100%;
    animation: dv-shimmer 1.4s infinite;
}

/* ================================================================
   MODALS
   ================================================================ */
.dv-modal-overlay {
    position: fixed; inset: 0;
    background: rgba(11,18,32,.35);
    display: flex; align-items: center; justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(2px);
}
.dv-modal {
    background: var(--ops-surface);
    border: 1px solid var(--ops-border);
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(11,18,32,.15);
    width: 420px;
    max-width: calc(100vw - 32px);
    overflow: hidden;
}
.dv-modal-hdr {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--ops-border-soft);
    font: 600 14px var(--ops-font);
    color: var(--ops-text);
}
.dv-modal-close {
    width: 26px; height: 26px; border-radius: 6px;
    border: none; background: transparent;
    cursor: pointer; font-size: 14px; color: var(--ops-muted);
    display: flex; align-items: center; justify-content: center;
    transition: background .12s;
}
.dv-modal-close:hover { background: var(--ops-surface-2); color: var(--ops-text); }
.dv-modal-body {
    padding: 16px 18px;
    display: flex; flex-direction: column; gap: 10px;
}
.dv-modal-footer {
    padding: 12px 18px;
    border-top: 1px solid var(--ops-border-soft);
    display: flex; justify-content: flex-end; gap: 8px;
}
.dv-form-label { font: 500 12px var(--ops-font); color: var(--ops-text-2); }

/* Tabs inside a settings dialog. Only drawn when there is a second tab to go to, so a dialog with
   nothing but its settings looks exactly as it did before. */
.dv-tabstrip {
    display: flex; gap: 2px; margin: -4px 0 10px;
    border-bottom: 1px solid var(--ops-border-soft, #e8ebf4);
}
.dv-tab {
    padding: 7px 14px; cursor: pointer;
    font: 500 12px var(--ops-font); color: var(--ops-text-2, #4b5565);
    background: none; border: none; border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}
.dv-tab:hover { color: var(--ops-text, #1f2937); }
.dv-tab.is-on {
    color: var(--ops-accent, #3b62f6);
    border-bottom-color: var(--ops-accent, #3b62f6);
}

/* The USB allow-list inside a device or group's settings: which registered sticks this scope may
   use. Capped in height and scrolled rather than allowed to grow, because the list is as long as
   the organisation's register and the Save button has to stay reachable without hunting for it. */
.dv-usb-allow-bar {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px;
}
.dv-usb-allow-bar .dv-form-input { flex: 1 1 180px; min-width: 140px; }
.dv-usb-allow-list {
    max-height: 240px; overflow: auto;
    border: 1px solid var(--ops-border, #dde1ee); border-radius: 6px;
    background: var(--ops-surface, #fff);
}
.dv-usb-allow-table { width: 100%; border-collapse: collapse; font: 400 12px var(--ops-font); }
.dv-usb-allow-table th {
    position: sticky; top: 0; z-index: 1;
    padding: 7px 10px; text-align: left; white-space: nowrap;
    font-weight: 600; color: var(--ops-text-2, #4b5565);
    background: var(--ops-surface-2, #f6f7fb);
    border-bottom: 1px solid var(--ops-border-soft, #e8ebf4);
}
.dv-usb-allow-table td {
    padding: 6px 10px; color: var(--ops-text, #1f2937);
    border-bottom: 1px solid var(--ops-border-soft, #e8ebf4);
}
.dv-usb-allow-table tr:last-child td { border-bottom: none; }
.dv-usb-allow-table tbody tr:hover td { background: var(--ops-surface-2, #f6f7fb); }
.dv-usb-allow-tick { width: 34px; text-align: center; }
.dv-usb-allow-state { white-space: nowrap; color: var(--ops-text-2, #4b5565); }

/* Command groups: how many commands are about to run, and the name box that saves them. */
.dv-form-label-note { margin-left: 8px; font-weight: 400; color: var(--ops-text-3, #94a3b8); }
.dv-cmd-grouprow    { display: flex; gap: 8px; align-items: center; }
.dv-cmd-savename    { width: auto; flex: 1 1 180px; min-width: 140px; }

/* Scheduling a resource: label / control pairs, and the two-time row. */
.dv-sched-grid  { display: grid; grid-template-columns: 90px 1fr; gap: 8px 10px; align-items: center; }
.dv-sched-times { display: flex; align-items: center; gap: 8px; }

/* Day-of-week toggles: seven small targets, so the whole week reads at a glance. */
.dv-sched-days { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.dv-sched-day {
    min-width: 46px; padding: 5px 8px; cursor: pointer;
    font: 500 12px var(--ops-font); color: var(--ops-text-2, #4b5565);
    background: var(--ops-surface, #fff);
    border: 1px solid var(--ops-border, #dde1ee); border-radius: 6px;
}
.dv-sched-day:hover { border-color: var(--ops-accent, #3b62f6); }
.dv-sched-day.is-on {
    color: #fff; background: var(--ops-accent, #3b62f6); border-color: var(--ops-accent, #3b62f6);
}
.dv-sched-times input { width: auto; flex: 0 1 120px; }
.dv-sched-times span  { font-size: 12px; color: var(--ops-text-3, #94a3b8); }
.dv-form-input, .dv-form-textarea, .dv-form-select {
    width: 100%;
    border: 1px solid var(--ops-border);
    border-radius: 7px;
    padding: 7px 10px;
    font: 400 13px var(--ops-font);
    color: var(--ops-text);
    background: var(--ops-surface);
    outline: none;
    box-sizing: border-box;
    transition: border-color .12s;
}
.dv-form-input:focus,
.dv-form-textarea:focus,
.dv-form-select:focus { border-color: var(--ops-primary); }
.dv-form-textarea { resize: vertical; min-height: 90px; }
/* A locked field must look locked. In the Setting dialogs every field locks while "inherit from the
   parent group" is ticked, and they used to look exactly like live ones: a click did nothing, and
   nothing pointed at the checkbox at the top of the dialog as the reason. */
.dv-form-input:disabled,
.dv-form-textarea:disabled,
.dv-form-select:disabled {
    color: var(--ops-muted, #94a3b8);
    background: var(--ops-surface-2, #f1f5f9);
    border-style: dashed;
    cursor: not-allowed;
}

.dv-modal-btn {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 7px 14px;
    border-radius: 7px;
    font: 500 13px var(--ops-font);
    cursor: pointer;
    border: 1px solid var(--ops-border);
    background: var(--ops-surface);
    color: var(--ops-text-2);
    transition: background .12s;
}
.dv-modal-btn:hover { background: var(--ops-surface-2); }
.dv-modal-btn--primary {
    background: var(--ops-primary);
    border-color: var(--ops-primary);
    color: #fff;
}
/* Each variant has to restate its background on hover.
   The plain rule above is ".dv-modal-btn:hover" — a class AND a pseudo-class — which outranks the bare
   ".dv-modal-btn--primary" that sets the colour. So on hover the base rule won and painted a filled button
   pale, while its text stayed white: the label vanished under the pointer. Specificity here matches the
   base hover and these come later, so the variant keeps its colour and only dims. */
.dv-modal-btn--primary:hover { background: var(--ops-primary); opacity: .88; }

.dv-modal-btn--danger {
    background: var(--ops-danger);
    border-color: var(--ops-danger);
    color: #fff;
}
.dv-modal-btn--danger:hover { background: var(--ops-danger); opacity: .88; }
.dv-modal-btn:disabled { opacity: .5; cursor: not-allowed; }

/* A toggle that is currently on — the Preview button while the preview is what the pane below shows. It
   has to read as pressed, not as another action waiting to be taken. */
.dv-modal-btn--active {
    background: var(--ops-primary-50, #eef2ff);
    border-color: var(--ops-primary, #4f46e5);
    color: var(--ops-primary, #4f46e5);
}
.dv-modal-btn--active:hover { background: var(--ops-primary-100, #e0e7ff); }

/* A dialog with one question in it. 420px is right for a form; for a single field it is a lot of empty
   space around a small ask, so this narrows it and tightens the body. */
.dv-modal--narrow { width: 360px; }
.dv-modal--narrow .dv-modal-body { padding: 14px 16px; gap: 8px; }

/* The field in such a dialog.
   Not .rs-newfolder-input / .rr-newfolder-input: those belong to the inline "new folder" ROW, where
   "flex: 0 1 260px" sets a WIDTH because that row is horizontal. Reused inside a modal body — which is a
   vertical flex — the same 260px became a HEIGHT, and the dialog grew a box a quarter of the screen tall
   with the placeholder floating in the middle of it. A field needs its own rule, with no flex in it. */
.rs-dialog-input {
    width: 100%; box-sizing: border-box; padding: 8px 10px;
    font: 400 13px var(--ops-font, sans-serif);
    color: var(--ops-text, #191c28); background: var(--ops-surface, #fff);
    border: 1px solid var(--ops-border, #dde1ee); border-radius: 7px; outline: none;
}
.rs-dialog-input:focus { border-color: var(--ops-primary, #4f46e5); }
.rs-dialog-input::placeholder { color: var(--ops-muted-2, #8a90a6); }
/* A name that cannot be used, red while it is typed — the reason is the line under the field. */
.rs-dialog-input.is-invalid,
.rs-dialog-input.is-invalid:focus { border-color: var(--ops-danger, #dc2626); }

/* A one-of-a-few choice under that field — "New script" asks which language to start in. One row: the
   choices are short words, and stacking them would make the dialog taller than the question is. */
.rs-dialog-choices { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.rs-dialog-choices-label { font: 400 12px var(--ops-font, sans-serif); color: var(--ops-muted, #5b6178); }

/* ── Manage dialogs (Set Location / Assign Owner / Custom Info / Setting) ── */
.dv-modal--wide { width: 640px; }
.dv-modal--wide .dv-modal-body { max-height: min(70vh, 620px); overflow-y: auto; }

.dv-modal-hint   { font: 400 12px var(--ops-font); color: var(--ops-muted); }
.dv-modal-toolbar{ display: flex; align-items: center; gap: 10px; }
.dv-modal-status {
    font: 500 12px var(--ops-font);
    padding: 7px 10px;
    border-radius: 7px;
}
.dv-modal-status.warn { background: rgba(180,83,9,.10); color: var(--ops-warning); margin-bottom: 8px; }
/* In a footer the line sits to the left of the buttons, which keep their place on the right. */
.dv-modal-footer > .dv-modal-status { margin-right: auto; align-self: center; }
.dv-modal-status.ok  { background: var(--ops-primary-50); color: var(--ops-primary); }
.dv-modal-status.err { background: var(--ops-danger-50, rgba(239,68,68,.10)); color: var(--ops-danger); }
/* A send under way: the step and its clock, with a small spinner so the line reads as live rather
   than as a message left behind. Tabular figures keep the line from shifting as the seconds tick. */
.dv-modal-status.busy {
    display: flex; align-items: center; gap: 8px;
    background: var(--ops-surface-2); color: var(--ops-text-2);
    font-variant-numeric: tabular-nums;
}
.dv-modal-status.busy::before {
    content: ""; flex-shrink: 0;
    width: 12px; height: 12px;
    border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
    opacity: .7;
    animation: dv-spin .8s linear infinite;
}
@media (prefers-reduced-motion: reduce) {
    .dv-modal-status.busy::before { animation: none; border-right-color: currentColor; opacity: .35; }
}

/* Discover Clients dialog — the IP textbox in its own monospace with tabular figures, so a column
   of digits lines up instead of sitting in the body's proportional font. */
.disc-range-select { font-family: var(--ops-font-mono); font-size: 12.5px; font-variant-numeric: tabular-nums; }

/* The saved-range list — rows instead of a native <select>, so the address a click landed on gets
   its own highlighted row and a checkmark, the same picker language the rest of the app uses,
   instead of the OS's own (and every browser's slightly different) listbox chrome. */
.disc-range-list {
    display: flex; flex-direction: column; gap: 2px;
    max-height: 150px; overflow-y: auto;
    border: 1px solid var(--ops-border); border-radius: 8px; padding: 4px;
}
.disc-range-list--disabled { opacity: .55; }
.disc-range-item {
    display: flex; align-items: center; gap: 8px; width: 100%;
    padding: 6px 8px; border: 0; border-radius: 6px;
    background: none; text-align: left; cursor: pointer;
    color: var(--ops-text);
}
.disc-range-item:hover:not(:disabled) { background: var(--ops-surface-2); }
.disc-range-item.is-selected { background: var(--ops-primary-50); color: var(--ops-primary); }
.disc-range-item:disabled { cursor: not-allowed; }
.disc-range-icon { width: 14px; height: 14px; flex-shrink: 0; color: var(--ops-muted-2, #8a90a6); }
.disc-range-item.is-selected .disc-range-icon { color: var(--ops-primary); }
.disc-range-text {
    flex: 1; font-family: var(--ops-font-mono); font-size: 12.5px; font-variant-numeric: tabular-nums;
}
.disc-range-check { width: 14px; height: 14px; flex-shrink: 0; color: var(--ops-primary); }

/* Remote Configuration — StarCat11's tree of three tasks down the left, the chosen one's form beside it. */
.dv-modal--rc { width: 780px; }
.dv-modal--rc .dv-modal-body { max-height: min(74vh, 660px); overflow-y: auto; }
.dv-rc-layout { display: grid; grid-template-columns: 196px minmax(0, 1fr); gap: 16px; align-items: start; }
.dv-rc-nav {
    display: flex; flex-direction: column; gap: 2px;
    padding-right: 12px; border-right: 1px solid var(--ops-border-soft);
}
.dv-rc-nav-item {
    display: flex; align-items: center; gap: 8px; width: 100%;
    padding: 8px 10px; border: 0; border-radius: 7px;
    background: none; text-align: left; cursor: pointer;
    font: 500 13px var(--ops-font); color: var(--ops-text-2);
}
.dv-rc-nav-item:hover { background: var(--ops-surface-2); }
.dv-rc-nav-item.is-active { background: var(--ops-primary-50); color: var(--ops-primary); }
.dv-rc-form { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.dv-rc-fields { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 8px 10px; align-items: center; padding-left: 23px; }
.dv-rc-fields .dv-modal-hint { grid-column: 2; margin-top: -4px; }
.dv-rc-addr { font-family: var(--ops-font-mono, ui-monospace, monospace); font-variant-numeric: tabular-nums; }
@media (max-width: 720px) {
    .dv-rc-layout { grid-template-columns: 1fr; }
    .dv-rc-nav { flex-direction: row; flex-wrap: wrap; padding: 0 0 8px; border-right: 0; border-bottom: 1px solid var(--ops-border-soft); }
    .dv-rc-nav-item { width: auto; }
    .dv-rc-fields { grid-template-columns: 1fr; padding-left: 0; }
    .dv-rc-fields .dv-modal-hint { grid-column: 1; }
}

.dv-form-grid { display: flex; flex-direction: column; gap: 8px; }
.dv-form-row  { display: grid; grid-template-columns: 210px 1fr; gap: 10px; align-items: center; }
.dv-form-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dv-form-input--label { font-weight: 600; }

.dv-map {
    height: 340px; width: 100%;
    border: 1px solid var(--ops-border-soft);
    border-radius: 8px;
    overflow: hidden;
}

/* -- Owner picker (AssignOwnerModal) --
   A list of people is only scannable if each row says who the person is. The
   raw candidate list is mostly numeric ids, so every row here carries an
   initials chip, the name with the typed text marked, and a meta line of
   id / department / contact. Keyboard and mouse share one highlight:
   --active is where the arrows are, --sel is what Assign will write. */
.dv-modal--owner { width: 560px; }
.dv-modal--owner .dv-modal-body { gap: 8px; }

.dv-own-search {
    display: flex; align-items: center; gap: 8px;
    padding: 0 10px;
    border: 1px solid var(--ops-border);
    border-radius: 9px;
    background: var(--ops-surface);
    transition: border-color .12s, box-shadow .12s;
}
.dv-own-search:focus-within {
    border-color: var(--ops-primary);
    box-shadow: 0 0 0 3px var(--ops-primary-50);
}
.dv-own-search-ico { flex: none; color: var(--ops-muted-2, #8b94a3); }
.dv-own-input {
    flex: 1; min-width: 0;
    border: none; outline: none; background: transparent;
    padding: 9px 0;
    font: 400 13px var(--ops-font);
    color: var(--ops-text);
}
.dv-own-input::placeholder { color: var(--ops-muted-2, #8b94a3); }
.dv-own-clear {
    flex: none;
    width: 20px; height: 20px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    border: none; background: var(--ops-surface-2);
    color: var(--ops-muted); font-size: 10px; line-height: 1;
    cursor: pointer; transition: background .12s, color .12s;
}
.dv-own-clear:hover { background: var(--ops-border); color: var(--ops-text); }

.dv-own-meta {
    display: flex; align-items: baseline; gap: 10px;
    font: 500 11.5px var(--ops-font);
    color: var(--ops-muted);
}
.dv-own-meta-r { margin-left: auto; font-weight: 400; color: var(--ops-muted-2, #8b94a3); }

.dv-picker-list {
    max-height: 320px; overflow-y: auto; overscroll-behavior: contain;
    border: 1px solid var(--ops-border);
    border-radius: 10px;
    padding: 4px;
    background: var(--ops-surface);
    display: flex; flex-direction: column; gap: 2px;
    scrollbar-width: thin;
    scrollbar-color: var(--ops-border) transparent;
}
.dv-picker-list::-webkit-scrollbar       { width: 9px; }
.dv-picker-list::-webkit-scrollbar-track { background: transparent; }
.dv-picker-list::-webkit-scrollbar-thumb {
    background: var(--ops-border);
    border: 3px solid transparent; background-clip: content-box;
    border-radius: 99px;
}
.dv-picker-list::-webkit-scrollbar-thumb:hover { background: var(--ops-muted-2, #8b94a3); background-clip: content-box; }

.dv-picker-item {
    display: flex; align-items: center; gap: 10px;
    width: 100%;
    text-align: left;
    padding: 7px 9px;
    border: none; border-radius: 8px;
    background: transparent;
    cursor: pointer;
    /* the selected row grows a left bar; reserving it here stops the 2px shift */
    box-shadow: inset 2px 0 0 transparent;
    transition: background .1s, box-shadow .1s;
}
.dv-picker-item--active { background: var(--ops-surface-2); }
.dv-picker-item:hover   { background: var(--ops-surface-2); }
.dv-picker-item--sel,
.dv-picker-item--sel:hover {
    background: var(--ops-primary-50);
    box-shadow: inset 2px 0 0 var(--ops-primary);
}

/* Initials chip. The hue is picked in C# from the user id and handed over as
   --dv-av-h, so neighbouring rows differ; white on 42% lightness holds its
   contrast on the light surface and on the dark one, no theme override. */
.dv-picker-avatar {
    flex: none;
    width: 30px; height: 30px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font: 600 11px var(--ops-font);
    letter-spacing: .02em;
    color: #fff;
    background: hsl(var(--dv-av-h, 212) 42% 42%);
}

.dv-picker-txt {
    /* min-width:0 is what lets the two lines below actually ellipsis inside flex */
    flex: 1; min-width: 0;
    display: flex; flex-direction: column; gap: 1px;
}
.dv-picker-name,
.dv-picker-meta {
    display: block; max-width: 100%;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dv-picker-name { font: 500 13px var(--ops-font); color: var(--ops-text); }
.dv-picker-meta { font: 400 11.5px var(--ops-font-mono); color: var(--ops-muted); }
.dv-picker-hit {
    background: var(--ops-primary-100);
    color: var(--ops-primary);
    border-radius: 3px;
    padding: 0 1px;
}

.dv-picker-badge {
    flex: none;
    font: 600 9.5px var(--ops-font);
    text-transform: uppercase; letter-spacing: .04em;
    padding: 2px 7px; border-radius: 99px;
    background: var(--ops-surface-2);
    color: var(--ops-muted);
    border: 1px solid var(--ops-border);
}
.dv-picker-check { flex: none; color: var(--ops-primary); }

.dv-own-empty {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 34px 16px;
    color: var(--ops-muted-2, #8b94a3);
    text-align: center;
}
.dv-own-empty-t { font: 600 13px var(--ops-font); color: var(--ops-text-2); }
.dv-own-empty-s { font: 400 12px var(--ops-font); color: var(--ops-muted); }

.dv-own-skeleton { display: flex; flex-direction: column; gap: 8px; padding: 4px 0; }
.dv-own-skeleton-row {
    height: 34px; border-radius: 8px;
    background: linear-gradient(90deg, var(--ops-border-soft, #edf0f4) 25%, var(--ops-surface-2, #f8f9fb) 37%, var(--ops-border-soft, #edf0f4) 63%);
    background-size: 200% 100%;
    animation: dv-shimmer 1.4s infinite;
}

/* Set Organisation — the path the machine sits in today, above the picker that changes it. */
.dv-org-now {
    display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
    padding: 9px 11px;
    border: 1px solid var(--ops-border);
    border-radius: 9px;
    background: var(--ops-surface-2);
}
.dv-org-now-lbl {
    flex: none;
    font: 600 10px var(--ops-font);
    text-transform: uppercase; letter-spacing: .05em;
    color: var(--ops-muted-2, #8b94a3);
}
.dv-org-now-val { font: 500 12.5px var(--ops-font); color: var(--ops-text); word-break: break-word; }
.dv-org-now-val.is-empty { font-weight: 400; color: var(--ops-muted-2, #8b94a3); }

/* Controls: entries whose backend is not hosted in this build */
/* จางอย่างเดียวยังกดได้อยู่ — เมาส์ยังเป็นรูปมือและยังมีไฮไลต์ตอนชี้ ซึ่งอ่านว่า "กดได้"
   สวนทางกับสีที่บอกว่ากดไม่ได้ ตัวที่ disabled จริงต้องหยุดทั้งสามอย่าง */
.dv-dropdown-item--off { opacity: .5; }
.dv-dropdown-item--off:disabled,
.dv-dropdown-item:disabled { cursor: not-allowed; pointer-events: auto; }
.dv-dropdown-item:disabled:hover { background: transparent; }

/* Execute Command output */
.dv-output {
    margin: 0;
    max-height: 260px;
    overflow: auto;
    padding: 10px 12px;
    border: 1px solid var(--ops-border-soft);
    border-radius: 8px;
    background: var(--ops-surface-2);
    font: 400 12px var(--ops-font-mono);
    color: var(--ops-text-2);
    white-space: pre-wrap;
    word-break: break-word;
}

/* Execute Command — per-device result rows */
.dv-cmd-result { margin-top: 10px; }
.dv-cmd-result-hdr {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}
.dv-cmd-result-name { font: 600 12px var(--ops-font); color: var(--ops-text); }
.dv-cmd-result-badge {
    font: 600 10px var(--ops-font);
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: 1px 7px;
    border-radius: 99px;
}
.dv-cmd-result-badge.ok    { background: var(--ops-primary-50); color: var(--ops-primary); }
.dv-cmd-result-badge.muted { background: var(--ops-surface-2); color: var(--ops-muted); }
.dv-cmd-result-badge.done  { background: color-mix(in srgb, var(--ops-success, #15803d) 12%, transparent); color: var(--ops-success); }
.dv-cmd-result-badge.err   { background: color-mix(in srgb, var(--ops-danger, #dc2626) 10%, transparent); color: var(--ops-danger); }
/* Why a dropped script failed, in the place its output would have gone — a status line, deliberately
   not dressed as output. */
.dv-cmd-result-note     { font: 400 12px var(--ops-font); color: var(--ops-muted); }
.dv-cmd-result-note.err { color: var(--ops-danger); }
/* What a failure most likely means, between the reason and the output (PythonFailureHint). */
.dv-cmd-hint { display: flex; gap: 8px; margin: 10px 0 12px; }
.dv-cmd-hint-icon { flex: 0 0 auto; width: 16px; height: 16px; margin-top: 2px; color: var(--ops-muted); }
.dv-cmd-hint-body { min-width: 0; }
.dv-cmd-hint-title { font: 600 13px var(--ops-font); color: var(--ops-text); margin-bottom: 4px; }
.dv-cmd-hint-body p { margin: 0 0 3px; font: 400 12px/1.55 var(--ops-font); color: var(--ops-text-2); }
.dv-cmd-hint-body code {
    font: 400 11.5px var(--ops-font-mono);
    padding: 1px 5px;
    border: 1px solid var(--ops-border-soft);
    border-radius: 4px;
    background: var(--ops-surface-2);
    color: var(--ops-text);
}
/* The output under a suggestion, labelled as what the machine itself said. */
.dv-output-frame {
    padding: 8px 12px 10px;
    border: 1px solid var(--ops-border-soft);
    border-radius: 8px;
    background: var(--ops-surface-2);
}
.dv-output-label { font: 600 11px var(--ops-font); color: var(--ops-text-2); margin-bottom: 4px; }
.dv-output-frame > .dv-output { padding: 0; border: 0; border-radius: 0; background: transparent; }

/* ── Capture Screen ──
   Rail of machines on the left, the one being looked at filling the rest. Sized off the viewport
   rather than the content so the stage keeps its shape while shots arrive one by one. */
.dv-cap-layout {
    display: flex;
    gap: 12px;
    flex: 1;
    min-height: 0;
}
/* Inside a workspace tab the height comes down the chain from .dv-worktab-body, so the stage is
   exactly the room that is left. It used to be calc(100vh - …), which guessed — and guessed short on
   a tall window, letting the picture run off the bottom of the page. */
.dv-embed-inner > .dv-modal-body { flex: 1; min-height: 0; overflow-y: auto; }
/* …and the row of buttons under it keeps its own height instead of being squeezed by that body.
   Without the overflow above, a body that is taller than the tab simply spilled out of its box —
   flex clamps the BOX, not what is painted — so long command output ran straight over the footer
   and the tab grew a scrollbar that carried Send away with it. */
.dv-embed-inner > .dv-modal-footer { flex: 0 0 auto; }
/* As a modal there is no such chain: the body is a scroll box, so the stage needs a size of its own. */
.dv-modal--wide .dv-modal-body .dv-cap-layout { height: 58vh; }
.dv-cap-rail {
    flex: 0 0 208px;
    display: flex; flex-direction: column; gap: 10px;
    overflow-y: auto;
    padding-right: 4px;
}
.dv-cap-item {
    display: flex; flex-direction: column; gap: 4px;
    padding: 6px; border-radius: 9px;
    border: 1px solid transparent;
}
.dv-cap-item.is-active {
    border-color: var(--ops-primary);
    background: var(--ops-primary-50, #eef0ff);
}
.dv-cap-item.is-locked .dv-shot-frame { border-color: var(--ops-warning-bd, #f5dca6); }
.dv-cap-thumb {
    display: block; width: 100%; padding: 0;
    border: none; background: none; cursor: pointer;
}

.dv-cap-stage {
    flex: 1; min-width: 0; min-height: 0;
    display: flex; flex-direction: column; gap: 8px;
}
.dv-cap-stage-bar {
    flex-shrink: 0; display: flex; align-items: center; gap: 8px;
}
.dv-cap-stage-name {
    font: 600 13px var(--ops-font, sans-serif); color: var(--ops-text, #191c28);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dv-cap-stage-age { flex: 1; font-size: 11.5px; color: var(--ops-muted-2, #8a90a6); }
.dv-cap-stage-btn {
    flex-shrink: 0; padding: 4px 10px; border-radius: 6px; cursor: pointer;
    border: 1px solid var(--ops-border); background: var(--ops-surface, #fff);
    color: var(--ops-text-2, #545a70);
    font: 500 12px var(--ops-font, sans-serif); text-decoration: none;
}
.dv-cap-stage-btn:hover { border-color: var(--ops-primary); color: var(--ops-primary); }
.dv-cap-stage-btn.is-on {
    border-color: var(--ops-primary); color: var(--ops-primary);
    background: var(--ops-primary-50, #eef0ff);
}

.dv-cap-stage-body {
    flex: 1; min-height: 0;
    display: flex; align-items: center; justify-content: center;
    border: 1px solid var(--ops-border-soft); border-radius: 10px;
    background: var(--ops-surface-2, #f6f7fb);
    overflow: hidden;
}
/* Fit is the default and is stated as width/height rather than max-*: a max against a flex parent
   whose height is only implied does not always bind, and when it slips the picture grows to its own
   2560px and pushes the page open. object-fit does the letterboxing. */
.dv-cap-big {
    display: block; width: 100%; height: 100%;
    padding: 0; border: none; background: none; cursor: zoom-in;
}
.dv-cap-big img { display: block; width: 100%; height: 100%; object-fit: contain; }

/* 100%: the picture at its own size, scrolled inside the stage — for reading what is actually on
   the remote screen without leaving the page. */
.dv-cap-stage-body.is-zoom { overflow: auto; align-items: flex-start; justify-content: flex-start; }
.dv-cap-stage-body.is-zoom .dv-cap-big { width: auto; height: auto; }
.dv-cap-stage-body.is-zoom .dv-cap-big img {
    width: auto; height: auto; max-width: none; max-height: none; object-fit: none;
}
.dv-cap-stage-empty {
    display: flex; align-items: center; gap: 8px; padding: 20px; text-align: center;
    font: 400 12.5px var(--ops-font, sans-serif); color: var(--ops-muted);
}

/* เหตุผลที่เครื่องตอบกลับมาว่าถ่ายไม่ได้ — สีของความผิดพลาด ไม่ใช่สีของข้อความว่าง ๆ เพราะมันคือ
   คำตอบจริงจากเครื่อง ไม่ใช่ "ยังไม่มีอะไร" */
.dv-cap-err {
    color: var(--ops-c-rose-2, #be123c);
    font: 400 12.5px var(--ops-font, sans-serif);
    max-width: 60ch;
}

/* Repeat control. The live pill is deliberately loud: this keeps taking pictures of someone's
   screen until it is switched off, and that should not be easy to forget about. */
.dv-cap-auto {
    display: inline-flex; align-items: center; gap: 6px;
    font: 500 12px var(--ops-font, sans-serif); color: var(--ops-muted);
}
.dv-cap-auto select {
    padding: 4px 6px; border-radius: 6px;
    border: 1px solid var(--ops-border); background: var(--ops-surface, #fff);
    color: var(--ops-text, #191c28); font: 500 12px var(--ops-font, sans-serif);
}
.dv-cap-auto-on {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 9px; border-radius: 99px;
    background: var(--ops-danger-soft, #fdeaea); color: var(--ops-danger, #b42318);
    font: 600 10.5px var(--ops-font, sans-serif); text-transform: uppercase; letter-spacing: .06em;
}
.dv-cap-dot {
    width: 6px; height: 6px; border-radius: 50%; background: currentColor;
    animation: dv-cap-pulse 1.4s ease-in-out infinite;
}
@keyframes dv-cap-pulse { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .dv-cap-dot { animation: none; } }

/* Capture Screen results */
.dv-shot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 10px;
}
.dv-shot { margin: 0; display: flex; flex-direction: column; gap: 4px; }

/* The frame keeps every card the same height whether it holds a picture, a spinner or a
   "nothing came back" line, so a wall of machines does not jump around while they answer. */
.dv-shot-frame {
    position: relative;
    aspect-ratio: 16 / 10;
    border: 1px solid var(--ops-border-soft);
    border-radius: 8px;
    overflow: hidden;
    background: var(--ops-surface-2, #f6f7fb);
}
/* contain, not cover: a cropped thumbnail hides exactly the corner of the screen someone is
   usually looking for. The whole desktop is shown, letterboxed on the frame's own background. */
.dv-shot-frame img { width: 100%; height: 100%; object-fit: contain; display: block; }
.dv-cap-thumb:hover .dv-shot-frame,
.dv-cap-thumb:focus-visible .dv-shot-frame { border-color: var(--ops-primary); }

.dv-shot-empty {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px; text-align: center;
    font: 400 11.5px var(--ops-font, sans-serif); color: var(--ops-muted);
}
/* A newer shot is on the way for a card that already has one. */
.dv-shot-busy {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255, 255, 255, .55);
    background: color-mix(in srgb, var(--ops-surface, #fff) 62%, transparent);
    color: var(--ops-text, #191c28);
}

.dv-shot-meta {
    display: flex; align-items: center; gap: 6px;
    font: 400 11.5px var(--ops-font-mono);
    color: var(--ops-muted);
}
.dv-shot-name {
    flex: 1; min-width: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font: 500 12px var(--ops-font, sans-serif); color: var(--ops-text, #191c28);
}
.dv-shot-age { flex-shrink: 0; font-size: 11px; color: var(--ops-muted-2, #8a90a6); }
.dv-shot-again {
    flex-shrink: 0; width: 20px; height: 20px; padding: 0; line-height: 1;
    border: 1px solid var(--ops-border); border-radius: 5px;
    background: var(--ops-surface, #fff); color: var(--ops-muted); cursor: pointer;
}
.dv-shot-again:hover:not(:disabled) { color: var(--ops-primary); border-color: var(--ops-primary); }
.dv-shot-again:disabled { opacity: .45; cursor: default; }

/* ── Enlarged shot ──
   Fixed to the viewport rather than to the tab: the point of enlarging is to use the whole window,
   and this component also renders inside a workspace tab that is only part of the page. */
.dv-lightbox {
    position: fixed; inset: 0; z-index: 3000;
    display: flex; flex-direction: column;
    background: rgba(12, 14, 22, .88);
    outline: none;
}
/* Opaque, unlike the stage: the page's own header sits directly behind this strip and would
   otherwise read through the backdrop and tangle with the device name. */
.dv-lightbox-bar {
    flex-shrink: 0; display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; color: #f2f3f7;
    background: #14171f;
    border-bottom: 1px solid rgba(255, 255, 255, .12);
    font: 500 13px var(--ops-font, sans-serif);
}
.dv-lightbox-title {
    flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dv-lightbox-count { flex-shrink: 0; font: 400 12px var(--ops-font-mono, monospace); opacity: .75; }
.dv-lightbox-btn {
    flex-shrink: 0; padding: 4px 10px; border-radius: 6px; cursor: pointer;
    border: 1px solid rgba(255, 255, 255, .28);
    background: rgba(255, 255, 255, .08); color: #f2f3f7;
    font: 500 12px var(--ops-font, sans-serif); text-decoration: none;
}
.dv-lightbox-btn:hover { background: rgba(255, 255, 255, .18); color: #fff; }
.dv-lightbox-close { font-size: 13px; line-height: 1; }

.dv-lightbox-stage {
    position: relative; flex: 1; min-height: 0;
    display: flex; align-items: center; justify-content: center;
    padding: 0 14px 16px;
    overflow: auto;
}
.dv-lightbox-stage img {
    max-width: 100%; max-height: 100%;
    object-fit: contain; cursor: zoom-in;
    border-radius: 6px; background: #000;
}
/* Full size: let it overflow and be scrolled, for reading what is actually on the screen. */
.dv-lightbox-stage.is-zoom { align-items: flex-start; justify-content: flex-start; }
.dv-lightbox-stage.is-zoom img { max-width: none; max-height: none; cursor: zoom-out; }

.dv-lightbox-nav {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 40px; height: 56px; border-radius: 8px; cursor: pointer;
    border: 1px solid rgba(255, 255, 255, .22);
    background: rgba(20, 23, 34, .62); color: #f2f3f7;
    font-size: 26px; line-height: 1;
}
.dv-lightbox-nav:hover { background: rgba(20, 23, 34, .88); }
.dv-lightbox-nav.prev { left: 10px; }
.dv-lightbox-nav.next { right: 10px; }
/* ── Resource library (StarCat11's Resources panel) ── */
.rs-panel { display: flex; height: 100%; min-height: 0; }

.rs-cats {
    width: 208px; flex-shrink: 0; display: flex; flex-direction: column;
    border-right: 1px solid var(--ops-border, #dde1ee); background: var(--ops-surface-2, #f6f7fb);
    overflow-y: auto;
}
.rs-cats-hdr {
    padding: 12px 14px 8px; font: 600 11px var(--ops-font-mono, monospace);
    letter-spacing: .1em; text-transform: uppercase; color: var(--ops-muted-2, #8a90a6);
}
.rs-cat {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 8px 14px; border: none; background: transparent; cursor: pointer; text-align: left;
    font: 500 12.5px var(--ops-font, sans-serif); color: var(--ops-text-2, #545a70);
    border-left: 2px solid transparent;
}
.rs-cat:hover { background: var(--ops-surface, #fff); color: var(--ops-text, #191c28); }
.rs-cat.is-active {
    background: var(--ops-surface, #fff); color: var(--ops-primary, #4f46e5);
    border-left-color: var(--ops-primary, #4f46e5); font-weight: 600;
}
.rs-cat-count {
    font: 500 10.5px var(--ops-font-mono, monospace); color: var(--ops-muted-2, #8a90a6);
    font-variant-numeric: tabular-nums;
}
.rs-empty-note { padding: 10px 14px; font-size: 12px; color: var(--ops-muted-2, #8a90a6); }

.rs-files { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.rs-toolbar {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    padding: 10px 14px; border-bottom: 1px solid var(--ops-border, #dde1ee);
}
.rs-toolbar-title { font: 600 13.5px var(--ops-font, sans-serif); color: var(--ops-text, #191c28); margin-right: 4px; }

/* Breadcrumb — a category is a tree (File Transfer holds AGENT, TOOLS, TRANSFER …), so the toolbar
   title is the trail into it. The last crumb is where you are, so it reads as text, not a link. */
.rs-crumbs { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-right: 4px; min-width: 0; }
.rs-crumbs-label { font: 600 11px var(--ops-font, sans-serif); color: var(--ops-muted-2, #8a90a6); margin-right: 2px; }
.rs-crumb {
    background: none; border: 0; padding: 0;
    font: 600 13.5px var(--ops-font, sans-serif); color: var(--ops-text, #191c28);
}
.rs-crumbs .rs-crumb:last-of-type { color: var(--ops-accent, #3457d5); }
.rs-crumb-sep { font-size: 12px; color: var(--ops-muted-2, #8a90a6); }

/* Tree — folders expand in place under the row that opened them, the way the Group tree does, instead
   of replacing the list with the folder's contents. */
.rs-tree-chevron {
    width: 13px; height: 13px; flex-shrink: 0; vertical-align: -2px; margin-right: 2px;
    color: var(--ops-muted-2, #8a90a6); transition: transform .15s;
}
.rs-tree-chevron.open { transform: rotate(90deg); }
.rs-tree-chevron-ph { display: inline-block; width: 13px; height: 13px; margin-right: 2px; }
.rs-file-icon { width: 14px; height: 14px; flex-shrink: 0; vertical-align: -3px; margin-right: 4px; }

.rs-newfolder {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 14px; border-bottom: 1px solid var(--ops-border, #dde1ee);
}
.rs-newfolder-input {
    flex: 0 1 260px; padding: 5px 8px; font-size: 12.5px;
    border: 1px solid var(--ops-border, #dde1ee); border-radius: 4px;
    background: var(--ops-surface, #fff); color: var(--ops-text, #191c28);
}

.rs-moving {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    padding: 8px 14px; border-bottom: 1px solid var(--ops-border, #dde1ee);
    background: var(--ops-surface-2, #f6f7fb);
}
.rs-moving-what { font-size: 12.5px; color: var(--ops-text, #191c28); }
.rs-hint--inline { padding: 0; }

.rs-row-folder { cursor: pointer; }
.rs-row-folder td { color: var(--ops-text, #191c28); font-weight: 500; }
.rs-toolbar-gap { flex: 1; }
.rs-upload { cursor: pointer; }
.rs-hint, .rs-empty {
    padding: 10px 14px; font-size: 12.5px; color: var(--ops-muted-2, #8a90a6);
}

.rs-list-wrap { flex: 1; min-height: 0; overflow: auto; }

/* Dropping a file from the desktop onto the list — rs-dropzone.js reads it and hands the bytes to
   ReceiveDroppedFile, the same upload path OnUpload uses. */
.rs-dropzone { position: relative; }
.rs-dropzone-overlay {
    display: none;
    position: absolute; inset: 0; z-index: 2;
    align-items: center; justify-content: center;
    font: 600 13px var(--ops-font, sans-serif);
    color: var(--ops-primary, #4f46e5);
    background: var(--ops-primary-50, #eef2ff);
    border: 2px dashed var(--ops-primary, #4f46e5);
    pointer-events: none;
}
.rs-dropzone--over .rs-dropzone-overlay { display: flex; }
.rs-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.rs-table thead th {
    position: sticky; top: 0; z-index: 1; text-align: left;
    padding: 8px 14px; background: var(--ops-surface-2, #f6f7fb);
    border-bottom: 1px solid var(--ops-border, #dde1ee);
    font: 600 10.5px var(--ops-font-mono, monospace); letter-spacing: .07em;
    text-transform: uppercase; color: var(--ops-muted-2, #8a90a6);
}
.rs-table tbody td { padding: 8px 14px; border-bottom: 1px solid var(--ops-border, #dde1ee); color: var(--ops-text-2, #545a70); }
.rs-table tbody tr { cursor: pointer; }
.rs-table tbody tr:hover { background: var(--ops-surface-2, #f6f7fb); }
.rs-table tbody tr.is-selected { background: var(--ops-accent-soft, #e8e9fd); }

/* A heading over the script library's rows, the same as the rail's (.rr-group), in the table header's
   letters. Not a row to open, so no hover and no line under it. Written out in full against MudBlazor's
   button{justify-content:center} and app.css's faded button[disabled]. */
.rs-table tbody tr.rs-group-row { cursor: default; }
.rs-table tbody tr.rs-group-row:hover { background: none; }
.rs-table tbody tr.rs-group-row td { padding: 0; border-bottom: 0; }
.rs-group {
    display: flex; align-items: center; justify-content: flex-start; gap: 5px;
    width: 100%;
    padding: 12px 14px 4px;
    border: 0;
    background: none;
    cursor: pointer;
    text-align: left;
    font: 600 10.5px var(--ops-font-mono, monospace);
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--ops-muted-2, #8a90a6);
}
.rs-group:hover:not(:disabled) { color: var(--ops-text-2, #545a70); }
.rs-group:disabled { cursor: default; opacity: 1; }
.rs-group .rs-tree-chevron { color: inherit; }
.rs-name { font: 500 12.5px var(--ops-font-mono, monospace); color: var(--ops-text, #191c28); }
.rs-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rs-when { white-space: nowrap; font-variant-numeric: tabular-nums; }
.rs-badge {
    margin-left: 6px; padding: 1px 6px; border-radius: 99px;
    background: var(--ops-surface-3, #e5e8f4); color: var(--ops-muted-2, #8a90a6);
    font: 600 9.5px var(--ops-font, sans-serif); text-transform: uppercase; letter-spacing: .04em;
}
.rs-row-actions { white-space: nowrap; text-align: right; }
.rs-link {
    border: none; background: none; padding: 0 6px; cursor: pointer;
    font: 500 12px var(--ops-font, sans-serif); color: var(--ops-primary, #4f46e5); text-decoration: none;
}
.rs-link:hover { text-decoration: underline; }
.rs-link--danger { color: var(--ops-danger, #b91c1c); }

/* The send actions, kept together on the right. As a group they wrap as one block when the window is
   narrow; loose in the toolbar they used to be pushed past the right edge one at a time, which is how
   "Send and run" ended up off screen. */
.rs-toolbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-left: auto; }

/* A row's own actions are noise until that row is the one being acted on — every line carried three
   coloured links competing with the file names. Shown on hover, on the open file, and whenever one of
   them has keyboard focus, so nothing becomes unreachable without a mouse. */
.rs-table .rs-row-actions { visibility: hidden; }
.rs-table tbody tr:hover .rs-row-actions,
.rs-table tbody tr.is-selected .rs-row-actions,
.rs-table .rs-row-actions:focus-within { visibility: visible; }
@media (hover: none) { .rs-table .rs-row-actions { visibility: visible; } }

/* The open file, marked down the side as well as behind: the tint alone was easy to lose against a
   hovered row, and this list IS the editor's file picker. */
.rs-table tbody tr.is-selected td:first-child { box-shadow: inset 3px 0 0 0 var(--ops-primary, #4f46e5); }
.rs-table tbody tr.is-selected .rs-name { color: var(--ops-primary, #4f46e5); font-weight: 600; }

/* ── The library beside the editor ──
   Two panes in a row: the list has a width the splitter moves, the editor takes what is left. A script is
   long and thin and the list is short names, so this is the shape that gives each the axis it needs. */
.rs-work { flex: 1; min-height: 0; display: flex; }
.rs-side {
    width: 280px; flex-shrink: 0; min-width: 0;
    display: flex; flex-direction: column;
    border-right: 1px solid var(--ops-border, #dde1ee);
    background: var(--ops-surface, #fff);
}

/* Search over the list. The magnifier and the clear cross sit inside the field rather than beside it, so
   the row stays one object at this width. */
.rs-side-search {
    display: flex; align-items: center; gap: 6px;
    padding: 8px 10px; border-bottom: 1px solid var(--ops-border-soft, #eef0f7);
}
.rs-side-search svg { width: 13px; height: 13px; flex-shrink: 0; color: var(--ops-muted-2, #8a90a6); }
.rs-side-search input {
    flex: 1; min-width: 0; border: none; outline: none; background: transparent;
    font: 400 12.5px var(--ops-font, sans-serif); color: var(--ops-text, #191c28);
}
.rs-side-clear {
    border: none; background: none; cursor: pointer; padding: 0 2px; line-height: 1;
    font-size: 12px; color: var(--ops-muted-2, #8a90a6);
}
.rs-side-clear:hover { color: var(--ops-danger, #b91c1c); }

.rs-side .rs-table thead th { padding: 6px 12px; }
.rs-side .rs-table tbody td { padding: 7px 12px; }

/* A name too long for the column ends in "…" on its own line rather than wrapping: wrapped, the icon
   stayed on the first line and the name dropped to the next, which reads as two rows. max-width: 0 with
   width: 100% is what lets a cell in an auto-width table give up its width and clip — without it the
   table grows to fit the name instead. The whole name is on the row's hover. */
.rs-side .rs-table tbody td.rs-name {
    max-width: 0; width: 100%;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Nothing open yet. The editor column stays on screen so the page does not rearrange itself the moment a
   script is picked; this is what fills it in the meantime. */
.rs-editor-empty {
    flex: 1; display: grid; place-items: center; padding: 24px;
    font: 400 12.5px var(--ops-font, sans-serif); color: var(--ops-muted-2, #8a90a6);
    text-align: center;
}

/* The splitter, now between two columns rather than two rows: it moves the list's width, and the grip is
   turned on its side to say so. Same reasoning as before — a line alone does not read as draggable. */
.rs-split {
    flex-shrink: 0; width: 10px; height: auto; position: relative; cursor: col-resize;
    background: transparent; touch-action: none;
}
.rs-split::before {
    content: ''; position: absolute; top: 0; bottom: 0; left: 4px; width: 1px; right: auto; height: auto;
    background: var(--ops-border, #dde1ee); transition: background .15s;
}
.rs-split::after {
    content: ''; position: absolute; top: 50%; left: 2px; transform: translateY(-50%);
    width: 5px; height: 40px; border-radius: 3px;
    background: var(--ops-border-2, #cfd4e4);
    border: 1px solid var(--ops-surface, #fff);
    transition: background .15s, height .15s;
}
.rs-split:hover::before, .rs-split.dragging::before { background: var(--ops-primary, #4f46e5); }
.rs-split:hover::after, .rs-split.dragging::after {
    background: var(--ops-primary, #4f46e5); height: 56px;
}

.rs-editor {
    /* Takes what the list leaves. The width is the list's (the splitter sets it inline); the editor just
       fills the rest, so there is no second number to keep in step with the first. */
    flex: 1; min-width: 0; display: flex; flex-direction: column;
    /* Nothing in this column may be drawn outside it. min-width:0 lets the column shrink, but a header
       wider than the column still PAINTED past its right edge — over the function list next to it, which
       is what a browser zoomed far in used to show. */
    overflow: hidden;
}
.rs-editor-hdr {
    display: flex; align-items: center; gap: 8px;
    /* Two lines rather than one line that does not fit. The name and the kind keep the left of the first
       line; the buttons take the right of whichever line they land on. */
    flex-wrap: wrap;
    padding: 8px 14px; background: var(--ops-surface-2, #f6f7fb);
    font: 600 12px var(--ops-font-mono, monospace); color: var(--ops-text, #191c28);
}
/* Pushed right on its own, not by a spacer element: a spacer holds the line it is on, so the buttons
   landing on a second line would have been pushed back to the left of it. */
.rs-editor-actions {
    display: flex; align-items: center; gap: 8px;
    margin-left: auto; flex-shrink: 0;
}
.rs-editor-actions .dv-modal-btn { white-space: nowrap; }
.rs-editor-text {
    flex: 1; min-height: 0; resize: none; border: none; outline: none; padding: 12px 14px;
    font: 400 12.5px/1.55 var(--ops-font-mono, monospace);
    color: var(--ops-text, #191c28); background: var(--ops-surface, #fff);
    tab-size: 4; white-space: pre; overflow: auto;
}

/* ── The .rms editor, with the script's own words coloured ──
   Two layers, exactly on top of each other: .rs-editor-hl draws the colours and .rs-editor-text sits over
   it with transparent text, doing the typing (see rs-editor.js). Every property that decides where a
   character lands — font, size, line height, padding, tab size, wrapping — MUST be identical in both, or
   the words drift off their colours as soon as a line gets long. */
.rs-editor-wrap {
    flex: 1; min-height: 0; position: relative; display: flex;
    /* The ground is painted here, once, so the colour layer itself can be completely transparent — see
       the reset below, which is only safe if the layer is not the thing holding the background. */
    background: var(--ops-surface, #fff);
}
.rs-editor-hl {
    position: absolute; inset: 0; margin: 0; padding: 12px 14px; overflow: hidden;
    font: 400 12.5px/1.55 var(--ops-font-mono, monospace);
    tab-size: 4; white-space: pre; word-wrap: normal;
    color: var(--ops-text, #191c28);
    pointer-events: none;   /* the textarea above is what receives clicks, selection and the caret */
    /* And it must never be part of a selection either. pointer-events stops a drag from STARTING here,
       but it does not keep this text out of a selection the page makes another way — a Ctrl+A, or a drag
       begun outside the editor. This layer is decoration, not content. */
    user-select: none; -webkit-user-select: none;
}
.rs-editor-hl::selection { background: transparent; }
.rs-editor-hl ::selection { background: transparent; }

/* Inside the colour layer, NOTHING paints but the glyphs.
   This layer is a second copy of the text sitting under a transparent textarea, so anything with a
   surface of its own — a stray global rule on <code>, a library's inline-code styling, a rounded chip
   behind a <span> — does not read as styling: it reads as a grey plate under each line, because the
   words a person sees are the ones drawn HERE. Colour comes from the token classes further down and
   from nothing else, and !important is deliberate: the point is that no stylesheet loaded later can put
   a background back. */
.rs-editor-hl, .rs-editor-hl * {
    background: none !important;
    box-shadow: none !important;
    text-shadow: none !important;
    border: 0 !important;
    border-radius: 0 !important;
    outline: none !important;
}
/* A block, because rs-editor.js moves it with a transform to follow the textarea's scrolling, and a
   transform does nothing to an inline box. */
.rs-editor-hl code { font: inherit; padding: 0; margin: 0; color: inherit; display: block; }
/* No colour here — that is the token classes' job, and a rule this specific would silently win. */
.rs-editor-hl span { font: inherit; padding: 0; margin: 0; }
/* What decides a character's width besides the font, set the same on both layers rather than left to
   inheritance — because the two do not inherit alike. The browser's own stylesheet resets letter-spacing,
   word-spacing, text-transform and text-indent on a textarea, while the <pre> takes the page's; and
   .dv-page sets letter-spacing: -0.005em. Every coloured character came out a sixteenth of a pixel
   narrower than the textarea's, so the words fell further behind the caret along every line — half a
   character by column 60 — and a selection, a Delete or a Backspace landed beside the character it
   appeared to be on. Ligatures and features off too: a ligature can form in the textarea's one run of
   text and not across the colour layer's spans. Placed after both rules' font shorthand, which would
   otherwise reset the font-* ones. */
.rs-editor-hl, .rs-editor-text {
    letter-spacing: normal; word-spacing: normal; text-transform: none; text-indent: 0;
    text-rendering: auto; font-kerning: none; font-variant-ligatures: none; font-feature-settings: normal;
}
.rs-editor-text--lit {
    position: relative; z-index: 1; flex: 1;
    background: transparent;
    /* The text is drawn by the layer below; only the caret and the selection come from here. */
    color: transparent; caret-color: var(--ops-text, #191c28);
}
/* The selection: flat, quiet, and see-through.
   See-through because the words on screen are painted by the layer UNDERNEATH this textarea — anything
   opaque here covers them. Flat and grey rather than a saturated accent because a strong tint over each
   line reads as a raised block sitting on the page instead of as selected text. No shadow, no rounding:
   a selection is a mark on the text, not an object of its own. */
.rs-editor-text--lit::selection {
    background: rgba(120, 130, 155, .20);
    color: transparent;
}
.rs-editor-text--lit::-moz-selection {
    background: rgba(120, 130, 155, .20);
    color: transparent;
}

/* Find in page (Ctrl+F) — the same problem as the selection, but the browser's own colours.
   It paints each match on the textarea, solid yellow (orange for the current one), and the words are
   drawn by the layer UNDER the textarea: a match came out as a yellow block with nothing in it
   (2026-11-16). Two answers, because no single one reaches every browser and theme:
   1. Multiply the textarea onto the layer below. A dark word under yellow stays dark, the white ground
      turns yellow — whatever the browser paints there, and in every browser. Light themes only: on a
      dark ground multiply blackens the mark, so the dark themes keep the normal blend.
   2. Where the browser lets a page colour its find marks (::search-text), make them see-through, as
      the selection is. That one works on a dark ground too. A browser that does not know the selector
      drops just these rules, which is why they stand on their own. */
.rs-editor-wrap { isolation: isolate; }   /* the blend reaches the colour layer and stops at the editor */
.rs-editor-text--lit { mix-blend-mode: multiply; }
:is([data-theme="dark"], [data-theme="claude-dark"], [data-theme="indigo-dark"], [data-theme="royal-dark"],
    [data-theme="green-eco-dark"], [data-theme="colorful-dark"]) .rs-editor-text--lit { mix-blend-mode: normal; }
.rs-editor-text--lit::search-text {
    background: rgba(250, 204, 21, .45);
    color: transparent;
}
.rs-editor-text--lit::search-text:current {
    background: rgba(249, 115, 22, .50);
    color: transparent;
}

.rs-hl-rem  { color: var(--ops-muted-2, #8a90a6); font-style: italic; }   /* REM — a note to a person */
.rs-hl-verb { color: #3457d5; font-weight: 600; }                         /* CMD:, DELAY:, DOWNLOADR: … */
.rs-hl-arg  { color: var(--ops-text, #191c28); }                          /* what the verb acts on */
.rs-hl-num  { color: #0f766e; }                                           /* a wait, in milliseconds */
.rs-hl-at   { color: #8b5cf6; font-weight: 600; }                         /* @BACKGROUND and its kind */

/* The editor's header line: what is open, what kind of thing it is, whether it still needs saving. */
.rs-editor-title {
    font: 600 12.5px var(--ops-font-mono, monospace); color: var(--ops-text, #191c28);
    /* A file name with no spaces in it can be longer than the column. It gives way before the buttons do,
       and says so with an ellipsis; the whole name is still on its row in the list. */
    min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rs-editor-kind {
    padding: 1px 7px; border-radius: 99px;
    background: var(--ops-surface-3, #e5e8f4); color: var(--ops-muted-2, #8a90a6);
    font: 600 9.5px var(--ops-font, sans-serif); text-transform: uppercase; letter-spacing: .04em;
    /* Squeezed, it broke into two lines and made the whole header taller for nothing. */
    white-space: nowrap; flex-shrink: 0;
}
/* The name box in the editor header — a heading you can type in.
   It used to be drawn as plain title text and to grow a border only under the pointer, on the grounds
   that a form control does not belong where a heading goes. That hid the thing it was protecting: this
   is the ONLY place in the console that can rename a script, and nobody hovers a title to find out it is
   a field. So at rest it now carries the two marks that say "typed in here" — a dashed outline and a
   pencil beside it — and still firms up into a real field on hover and focus, which keeps the header from
   reading as a form the rest of the time. */
.rs-editor-namebox {
    display: inline-flex; align-items: center; gap: 4px; cursor: text;
    /* margin-bottom: 0 — Bootstrap gives every <label> one, which would drop the name off the header line. */
    margin: 0;
    /* The first thing to give way when the header runs short of room: a name box narrower than the name
       still scrolls to show it, whereas a Save button narrower than "Save" says nothing. */
    min-width: 0; flex: 0 1 auto;
}
.rs-editor-name {
    min-width: 80px; max-width: 320px; padding: 2px 6px;
    /* Dashed at rest, solid under the pointer: the border is 1px wide in every state, so nothing on the
       header line moves when it changes. */
    border: 1px dashed var(--ops-border-strong, #c7cddf); border-radius: 5px; background: transparent;
    font: 600 12.5px var(--ops-font-mono, monospace); color: var(--ops-text, #191c28);
    cursor: text;
}
.rs-editor-namebox:hover .rs-editor-name {
    border-style: solid; border-color: var(--ops-border, #dde1ee);
    background: var(--ops-surface, #fff);
}
.rs-editor-name:focus {
    outline: none; background: var(--ops-surface, #fff);
    border-style: solid; border-color: var(--ops-primary, #4f46e5);
}
.rs-editor-name-pen {
    width: 12px; height: 12px; flex-shrink: 0;
    color: var(--ops-muted-2, #8a90a6);
    pointer-events: none;   /* the <label> around it is the target; the icon itself swallows nothing */
}
.rs-editor-namebox:hover .rs-editor-name-pen { color: var(--ops-primary, #4f46e5); }
/* While typing, the mark has done its job and the caret says the rest. */
.rs-editor-namebox:focus-within .rs-editor-name-pen { opacity: 0; }
.rs-editor-dirty {
    display: inline-flex; align-items: center; gap: 5px; flex-shrink: 0; white-space: nowrap;
    font: 500 11px var(--ops-font, sans-serif); color: var(--ops-warning, #b45309);
}
.rs-editor-dot {
    width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0;
}

/* Pascal — the other kind of .rms. Keywords, strings and calls carry a program's shape, which is what
   makes one readable at a glance; the comment and number colours are shared with the command dialect so
   the same thing never means two colours in one editor. */
.rs-hl-kw   { color: #9333ea; font-weight: 600; }
.rs-hl-str  { color: #b45309; }
.rs-hl-call { color: #3457d5; }

/* ── The Functions panel ──
   What a script can call, beside what is being written. Its own column rather than a dialog: writing a
   script means looking something up every few lines, and a dialog that has to be opened and dismissed for
   each one is a dialog nobody opens twice. */
.rs-fns {
    /* 300px until 300px is most of the window — zoomed far in, a fixed third column left the editor a
       strip too narrow to write in. */
    width: 300px; max-width: 40%; flex-shrink: 0; min-width: 0;
    display: flex; flex-direction: column; overflow: hidden;
    border-left: 1px solid var(--ops-border, #dde1ee);
    background: var(--ops-surface, #fff);
}
.rs-fns-hdr {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    flex-shrink: 0; padding: 7px 12px;
    background: var(--ops-surface-2, #f6f7fb);
    border-bottom: 1px solid var(--ops-border-soft, #eef0f7);
    font: 600 10.5px var(--ops-font, sans-serif);
    letter-spacing: .07em; text-transform: uppercase; color: var(--ops-text-3, #94a3b8);
}
.rs-fns-list { flex: 1; min-height: 0; overflow: auto; }

/* ── Group headings ──
   Functions, then procedures — the division the language makes, and the one the legacy console showed.
   The heading sticks to the top while its own group is scrolled through: with 75 in the first group, a
   heading that scrolls away leaves no way to tell which of the two is on screen. */
.rs-fn-grp {
    position: sticky; top: 0; z-index: 1;
    display: flex; align-items: center; gap: 6px;
    width: 100%; text-align: left; cursor: pointer;
    padding: 6px 12px; border: none;
    border-bottom: 1px solid var(--ops-border-soft, #eef0f7);
    background: var(--ops-surface-2, #f6f7fb);
    font: 600 10.5px var(--ops-font, sans-serif);
    letter-spacing: .05em; text-transform: uppercase; color: var(--ops-text-2, #545a70);
}
.rs-fn-grp:hover { background: var(--ops-primary-50, #eef2ff); }
.rs-fn-grp-chev {
    width: 11px; height: 11px; flex-shrink: 0;
    color: var(--ops-muted-2, #8a90a6);
    transform: rotate(90deg); transition: transform .12s ease;
}
.rs-fn-grp.is-collapsed .rs-fn-grp-chev { transform: rotate(0deg); }
.rs-fn-grp-name { flex: 1; min-width: 0; }
/* The count is why a group is worth collapsing — "Functions 75" says what is behind the heading. */
.rs-fn-grp-n {
    flex-shrink: 0; padding: 1px 6px; border-radius: 9px;
    background: var(--ops-border-soft, #eef0f7);
    font: 600 10px var(--ops-font-mono, monospace); letter-spacing: 0;
    color: var(--ops-muted-2, #8a90a6);
}

/* One row per function, and the whole row is the button: what it does on click (put the call in the
   script) is the only thing anyone wants from it, so there is nothing else in the row to aim at. */
.rs-fn {
    display: block; width: 100%; text-align: left; cursor: pointer;
    padding: 7px 12px; border: none; border-bottom: 1px solid var(--ops-border-soft, #eef0f7);
    background: transparent;
}
.rs-fn:hover { background: var(--ops-primary-50, #eef2ff); }
.rs-fn-sig { display: block; font: 400 11.5px var(--ops-font-mono, monospace); word-break: break-word; }
.rs-fn-name { color: var(--ops-primary, #4f46e5); font-weight: 600; }
.rs-fn-rest { color: var(--ops-text-2, #545a70); }
.rs-fn-desc {
    display: block; margin-top: 2px;
    font: 400 11px var(--ops-font, sans-serif); color: var(--ops-muted-2, #8a90a6);
}
/* A Python example: what it does in the reading font, the first line of its code under it in the code
   one — cut at the panel's edge; the whole code is on hover. */
.rs-fn-sig .rs-ex-title { font-family: var(--ops-font, sans-serif); font-size: 12px; }
.rs-ex-code {
    font-family: var(--ops-font-mono, monospace); font-size: 10.5px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ── The compile result, under the editor ──
   A drawer rather than a view: the script stays where it is and keeps its scroll position, and the report
   takes its own space below. Sized so the code above it is still worth reading, and scrolls on its own
   when there is more in it than that. */
.rs-compile {
    flex-shrink: 0; max-height: 45%; min-height: 120px;
    display: flex; flex-direction: column; overflow: hidden;
    border-top: 1px solid var(--ops-border, #dde1ee);
    background: var(--ops-surface, #fff);
}
.rs-compile-hdr {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    flex-shrink: 0; padding: 7px 14px;
    background: var(--ops-surface-2, #f6f7fb);
    border-bottom: 1px solid var(--ops-border-soft, #eef0f7);
    font: 600 10.5px var(--ops-font, sans-serif);
    letter-spacing: .07em; text-transform: uppercase; color: var(--ops-text-3, #94a3b8);
}
.rs-compile .rs-check { padding: 12px 14px 16px; }
/* The result on screen is about an older script. It sits in the panel header, next to what it qualifies,
   and takes the warning colour rather than the header grey: it is the difference between a verdict and a
   verdict that has expired. */
.rs-compile-stale {
    margin-left: auto; padding: 1px 8px; border-radius: 99px;
    background: var(--ops-warning-soft, #fdf4e3); color: var(--ops-warning, #b45309);
    font: 500 10.5px var(--ops-font, sans-serif); letter-spacing: 0; text-transform: none;
}

/* ── The compile result ──
   One line when there is nothing wrong; when there is, the lines that are wrong and what to do about each.
   Nothing else: the script is on screen right above this, so a report that also described what the script
   does was describing what could already be read. */
.rs-check { flex: 1; min-height: 0; overflow: auto; padding: 14px 16px 18px; background: var(--ops-surface, #fff); }

/* One tinted band, and it is the only tinted thing here.
   The findings under it used to be filled with the same red, so a result with anything in it arrived as a
   single pink field with faint lines across it: the band that says how bad this is looked exactly like the
   rows that say what is wrong. The band keeps the colour; the rows get a surface of their own. */
.rs-verdict {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 13px; border-radius: 9px; border: 1px solid transparent;
}
.rs-verdict.is-good { background: var(--ops-success-soft, #e9f7ef); }
.rs-verdict.is-bad  { background: var(--ops-danger-soft, #fdecec); }
/* Compiles, but part of it will not run. Its own colour because it is its own answer — a green tick
   would say "send it" about lines that are going to do nothing, and red would refuse a script the
   agent accepts. See the verdict block in ResourcesPanel. */
.rs-verdict.is-partial { background: var(--ops-warning-soft, #fdf4e3); }
.rs-verdict.is-empty { background: var(--ops-surface-2, #f6f7fb); border-color: var(--ops-border, #dde1ee); }
.rs-verdict-mark {
    display: grid; place-items: center; flex-shrink: 0;
    width: 19px; height: 19px; border-radius: 50%;
    font: 700 11.5px var(--ops-font, sans-serif); line-height: 1; color: #fff;
}
.rs-verdict.is-good .rs-verdict-mark { background: var(--ops-success, #16873f); }
.rs-verdict.is-bad  .rs-verdict-mark { background: var(--ops-danger, #b91c1c); }
.rs-verdict.is-partial .rs-verdict-mark { background: var(--ops-warning, #b45309); }
.rs-verdict.is-empty .rs-verdict-mark { background: var(--ops-muted-2, #8a90a6); }
.rs-verdict-text { display: flex; flex-direction: column; gap: 2px; font: 400 12.5px var(--ops-font, sans-serif); }
.rs-verdict-text strong { font: 600 13px var(--ops-font, sans-serif); color: var(--ops-text, #191c28); }


/* Something to fix: what is wrong, then what to do about it. The fix is the second line because the
   first thing wanted is whether this line matters, and the second is how to get on with it.

   Each finding is a card of its own on a quiet surface, kept apart by real space rather than by a shade of
   red against another shade of red. All the red left in a row is structural — the rule down its edge and
   the line marker — which is what lets three findings be counted at a glance instead of read. */
.rs-issues { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.rs-issues li {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 9px 12px 10px; border-radius: 8px;
    background: var(--ops-surface-2, #f6f7fb);
    border: 1px solid var(--ops-border-soft, #eef0f7);
    border-left: 3px solid var(--ops-danger, #b91c1c);
}
/* Outlined rather than filled: the rule down the edge of the row already carries the alarm, and a solid
   red pill on every row spends it again for nothing. */
.rs-issue-line {
    flex-shrink: 0; margin-top: 1px;
    padding: 1px 7px; border-radius: 99px;
    background: var(--ops-surface, #fff); color: var(--ops-danger, #b91c1c);
    border: 1px solid var(--ops-danger-soft, #fdecec);
    font: 600 10.5px var(--ops-font, sans-serif);
    font-variant-numeric: tabular-nums; white-space: nowrap;
}
/* flex:1 so the quoted line below can span the row rather than the width of the sentence beside it. */
.rs-issue-body { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; flex: 1; min-width: 0; }
/* The sentence somebody reads. It is the heaviest thing in the row on purpose — the quotation above it is
   the compiler's, and is there to be matched against, not read. */
.rs-issue-what { font: 600 12.5px var(--ops-font, sans-serif); color: var(--ops-text, #191c28); }
/* What to do, marked as an instruction rather than as more description. */
.rs-issue-fix {
    display: flex; gap: 6px;
    font: 400 12px var(--ops-font, sans-serif); color: var(--ops-text-2, #545a70);
}
.rs-issue-fix::before {
    content: "\2192";   /* → */
    flex-shrink: 0; color: var(--ops-muted-2, #8a90a6);
}

/* The compiler's own line, quoted. Monospace and boxed because it is a quotation, not prose about the
   problem — the reader is matching it against the script, or against something they searched for.

   Quiet, though. Drawn in red on red at 12px bold it was the loudest thing in the panel, which put an
   English sentence from a Delphi unit above the explanation written for the person reading it. It keeps
   its place at the top of the row — recognising it is the point — and gives up the weight. */
.rs-issue-raw {
    align-self: stretch; max-width: 100%; overflow-wrap: anywhere;
    padding: 3px 7px; border-radius: 5px;
    background: var(--ops-surface, #fff); border: 1px solid var(--ops-border-soft, #eef0f7);
    color: var(--ops-text-2, #545a70);
    font: 400 11px/1.45 var(--ops-font-mono, monospace);
}

/* A hint is not a failure — the agent runs the script either way — so it is told apart from an error at
   a glance rather than by being read. Amber on the line number and a tinted edge on the quoted line is
   the whole difference; the row keeps the weight it has, because a hint shouting would be a hint lying
   about what it is. */
/* A hint's row is edged amber, not red: the red rule is what says "this stops the script", and on a
   hint it said so about something that does not. */
.rs-issues li.is-hint { border-left-color: var(--ops-warning, #b45309); }
.rs-issues li.is-hint .rs-issue-line { color: var(--ops-warning, #b45309); }
.rs-issues li.is-hint .rs-issue-raw {
    background: var(--ops-warning-soft, #fdf4e3); border-color: var(--ops-warning-bd, #f5dca6);
}

/* A name in the what-to-do line of a grouped Python warning — "Nothing uses import os and import time"
   (PythonCheckSummary) — set as code, in the quoted line's own quiet colours. */
.rs-issue-fix code {
    padding: 0 5px; border-radius: 4px;
    background: var(--ops-surface, #fff); border: 1px solid var(--ops-border-soft, #eef0f7);
    color: var(--ops-text, #191c28);
    font: 400 11px/1.45 var(--ops-font-mono, monospace);
}

/* The tally beside a verdict — "with 1 thing worth knowing", or the hints under a failure. Under the
   verdict and quieter than it, so the verdict is still what the eye lands on. */
.rs-verdict-why {
    display: block; margin-top: 2px;
    font: 400 12px var(--ops-font, sans-serif); color: var(--ops-text-2, #545a70);
}

/* What a Python verdict was reached with — which Python and Ruff, held to which version's syntax. A
   footnote, so it sits under the findings and stays quiet. */


/* ── System policy, edited as what it does rather than as its file ── */
.rs-policy { flex: 1; min-height: 0; overflow: auto; padding: 10px 14px 16px; background: var(--ops-surface, #fff); }

.rs-policy-group {
    margin: 12px 0 6px; font: 600 11px var(--ops-font); letter-spacing: .06em; text-transform: uppercase;
    color: var(--ops-text-3, #94a3b8);
}
.rs-policy-group:first-child { margin-top: 2px; }

.rs-policy-row {
    display: flex; align-items: flex-start; gap: 10px; padding: 7px 8px; border-radius: 6px; cursor: pointer;
}
.rs-policy-row:hover { background: var(--ops-surface-2, #f6f7fb); }
.rs-policy-row input[type="checkbox"] { margin-top: 2px; flex: none; }
.rs-policy-row--extra { cursor: default; opacity: .8; }

.rs-policy-text   { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.rs-policy-title  { font: 500 13px var(--ops-font); color: var(--ops-text, #191c28); }
.rs-policy-detail { font: 400 11.5px/1.45 var(--ops-font); color: var(--ops-text-2, #4b5565); }

.rs-policy-value {
    flex: 0 1 220px; font: 400 12px var(--ops-font-mono, monospace);
    border: 1px solid var(--ops-border, #dde1ee); border-radius: 6px; padding: 4px 8px;
}
.rs-policy-value--fixed { border-style: dashed; color: var(--ops-text-2, #4b5565); background: var(--ops-surface-2, #f6f7fb); }

/* The template search: hundreds of settings behind one box, so it sits where the list would be. */
.rs-policy-search {
    width: 100%; margin: 2px 0 6px; padding: 7px 10px;
    font: 400 12.5px var(--ops-font); color: var(--ops-text, #191c28);
    border: 1px solid var(--ops-border, #dde1ee); border-radius: 6px;
    background: var(--ops-surface, #fff);
}
.rs-policy-search:focus { outline: 2px solid var(--ops-accent, #3b62f6); outline-offset: -1px; }

/* Where a template setting sits in the template's own tree — the row's only bearings. */
.rs-policy-path {
    display: block; font: 500 10.5px var(--ops-font); letter-spacing: .02em;
    color: var(--ops-text-3, #94a3b8);
}
.rs-policy-scope {
    margin-left: 6px; padding: 0 6px; border-radius: 9px; vertical-align: 1px;
    font: 500 10.5px var(--ops-font); letter-spacing: .03em;
    color: var(--ops-text-2, #4b5565); background: var(--ops-surface-2, #f6f7fb);
    border: 1px solid var(--ops-border, #dde1ee);
}

@media (max-width: 900px) {
    .rs-panel { flex-direction: column; }
    .rs-cats { width: auto; flex-direction: row; overflow-x: auto; border-right: none;
               border-bottom: 1px solid var(--ops-border, #dde1ee); }
    .rs-cats-hdr { display: none; }
    .rs-cat { border-left: none; border-bottom: 2px solid transparent; white-space: nowrap; }
    .rs-cat.is-active { border-left: none; border-bottom-color: var(--ops-primary, #4f46e5); }
}

/* Waiting for a screenshot to come back from the device. */
.dv-spinner {
    display: inline-block; width: 12px; height: 12px; margin-right: 6px; vertical-align: -1px;
    border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
    animation: dv-spin .6s linear infinite;
}
@keyframes dv-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .dv-spinner { animation-duration: 2s; } }

/* A shot taken while the device was locked is blank — say so, don't leave a black rectangle. */
.dv-shot-locked {
    display: flex; align-items: flex-start; gap: 6px;
    padding: 6px 8px; border-radius: 6px;
    background: var(--ops-warning-soft, #fdf0d4);
    border: 1px solid var(--ops-warning-bd, #f5dca6);
    font: 500 11.5px var(--ops-font, sans-serif) !important;
    color: var(--ops-warning, #b45309) !important;
    word-break: normal !important;
}
.dv-shot-locked svg { flex-shrink: 0; margin-top: 1px; }

/* Setting form */
.dv-set-section { display: flex; flex-direction: column; gap: 6px; padding-top: 4px; }
.dv-set-section-title {
    font: 600 10.5px var(--ops-font);
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--ops-muted-2);
    padding-top: 6px;
    border-top: 1px solid var(--ops-border-soft);
}
.dv-check {
    display: flex; align-items: center; gap: 8px;
    font: 400 13px var(--ops-font);
    color: var(--ops-text-2);
    cursor: pointer;
}
.dv-check input[type="checkbox"], .dv-check input[type="radio"] { accent-color: var(--ops-primary); width: 15px; height: 15px; cursor: pointer; }
.dv-check input:disabled { cursor: not-allowed; }

/* The group and device Setting dialogs, in tabs as StarCat11's Group Setting was. The body keeps one
   height whichever tab is open, so the dialog does not jump as the tabs change, and the tab strip stays
   in view while a long tab scrolls under it. */
.dv-modal--settings .dv-modal-body { height: min(62vh, 540px); }
/* -16px is the body's top padding: at 0 the strip stuck a padding's height down, with the page
   scrolling past in the gap above it. */
.dv-modal--settings .dv-tabstrip {
    position: sticky; top: -16px; z-index: 1;
    background: var(--ops-surface);
}
.dv-modal--settings .dv-tab { padding: 7px 11px; white-space: nowrap; }
.dv-set-tab { display: flex; flex-direction: column; gap: 10px; }
/* Client Configuration's switches in two columns, as StarCat11 listed them, so the page fits. Columns
   rather than a grid: in rows, a short section beside a long one left a hole under the short one. */
.dv-set-cols { columns: 2; column-gap: 28px; }
.dv-set-cols > .dv-set-section { break-inside: avoid; margin-bottom: 12px; }
.dv-set-cols .dv-set-section-title { border-top: 0; padding-top: 0; }
@media (max-width: 640px) { .dv-set-cols { columns: 1; } }
/* Right under the tab strip a section needs no rule above it — the strip is one. */
.dv-set-tab > .dv-set-section:first-child > .dv-set-section-title { border-top: 0; padding-top: 0; }
/* A box with its unit after it — File Inventory's sizes are KB, as the agent reads them. */
.dv-input-unit { display: flex; align-items: center; gap: 8px; min-width: 0; }
.dv-input-unit > .dv-form-input { flex: 1; min-width: 0; }
.dv-input-unit-suffix { font: 500 12px var(--ops-font); color: var(--ops-muted); white-space: nowrap; }
/* Software Metering: the applications it meters, one to a row. */
.dv-meter-add { display: flex; gap: 8px; }
.dv-meter-add > .dv-form-input { flex: 1; min-width: 0; }
.dv-meter-list {
    margin: 0; padding: 0; list-style: none;
    border: 1px solid var(--ops-border-soft); border-radius: 8px;
}
.dv-meter-list li {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 8px 6px 12px;
    font: 400 13px var(--ops-font); color: var(--ops-text-2);
}
.dv-meter-list li + li { border-top: 1px solid var(--ops-border-soft); }
.dv-meter-no { min-width: 22px; color: var(--ops-muted); }
.dv-meter-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.dv-meter-remove {
    border: 0; background: none; cursor: pointer;
    padding: 2px 7px; border-radius: 6px; color: var(--ops-muted);
}
.dv-meter-remove:hover:not(:disabled) { background: var(--ops-surface-2); color: var(--ops-danger); }
.dv-meter-remove:disabled { opacity: .4; cursor: not-allowed; }
.dv-meter-empty {
    padding: 10px 12px; border: 1px dashed var(--ops-border-soft); border-radius: 8px;
    font: 400 13px var(--ops-font); color: var(--ops-muted);
}

.dv-sql-editor {
    font: 12.5px var(--ops-font-mono, ui-monospace, monospace);
    line-height: 1.5;
    resize: vertical;
    white-space: pre;
    overflow-x: auto;
}

/* ================================================================
   SOFTWARE DEPLOYMENT (Tools ▸ Deployment)
   ================================================================ */
.dp-page { display: flex; flex-direction: column; height: 100%; overflow: hidden; }
.dp-hdr {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
    padding: 14px 16px 10px; border-bottom: 1px solid var(--ops-border, #dde1ee);
}
.dp-title { margin: 0; font: 600 16px var(--ops-font, sans-serif); color: var(--ops-text, #191c28); }
.dp-sub { margin: 3px 0 0; font-size: 12.5px; color: var(--ops-muted-2, #8a90a6); }
.dp-body { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; padding: 10px 16px 16px; overflow: auto; }
.dp-list, .dp-targets { border: 1px solid var(--ops-border, #dde1ee); border-radius: 8px; overflow: hidden; }
.dp-targets-hdr {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 12px; border-bottom: 1px solid var(--ops-border-soft, #eef0f6);
    font-size: 12.5px; color: var(--ops-text, #191c28);
}

/* Progress: installed / in flight / failed, so a row reads at a glance. */
.dp-pill {
    display: inline-block; min-width: 22px; padding: 1px 6px; margin-right: 3px; border-radius: 9px;
    font: 600 11px var(--ops-font-mono, monospace); text-align: center; font-variant-numeric: tabular-nums;
}
.dp-pill--ok   { background: var(--ops-success-soft, #e7f6ec); color: var(--ops-success, #1b6b35); }
.dp-pill--wait { background: var(--ops-primary-soft, #eef1ff); color: var(--ops-primary, #4f46e5); }
.dp-pill--err  { background: var(--ops-danger-soft, #fdecec); color: var(--ops-danger, #9b1c1c); }
.dp-of { font-size: 11px; color: var(--ops-muted-2, #8a90a6); }

/* The five counts on a deployment row — the Deploy Status panel that used to be a modal.
   Same reading as the modal's boxes, a number with its name under it, but sized for a cell: no card
   and no minimum width, so five fit where three pills were, and still larger than the pills they
   replaced. Each one is a button because it is the way into that status's machines. */
.dp-progress { white-space: nowrap; }
.dp-counts {
    display: inline-flex; gap: 4px; align-items: center; justify-content: flex-end;
}
.dp-count {
    display: flex; flex-direction: column; align-items: center; gap: 1px;
    min-width: 66px; padding: 5px 9px; border: 0; border-radius: 7px;
    background: var(--ops-surface-2, #f5f6fa); font: inherit; cursor: pointer;
}
.dp-count:hover  { background: var(--ops-surface-3, #eceef5); }
.dp-count:focus-visible { outline: 2px solid var(--ops-primary, #4f46e5); outline-offset: 1px; }
.dp-count-n {
    font: 600 17px var(--ops-font-mono, monospace); line-height: 1.1;
    font-variant-numeric: tabular-nums; color: var(--ops-text, #191c28);
}
.dp-count-n.ok   { color: var(--ops-success, #1b6b35); }
.dp-count-n.err  { color: var(--ops-danger, #9b1c1c); }
/* Yellow, not the amber the rest of the console warns in. It is the Deploying count, and it is the
   same idea as the yellow share of the ring beside it — a machine the job has not finished with.
   A darker step of the same hue than the ring uses, because this is 17px of text on white and the
   ring is a solid band. */
.dp-count-n.wait { color: #ca8a04; }
.dp-count-l { font-size: 10px; color: var(--ops-muted-2, #8a90a6); white-space: nowrap; }
.dp-count-total { margin-left: 6px; font-size: 11px; color: var(--ops-muted-2, #8a90a6); }

/* Download and Deploy are two headed groups, not one run of nine counts. The header says which
   phase a column is, so the labels under the numbers do not have to repeat it. */
.dp-group-hd { text-align: center; }

/* The report's head: the ring on the left, the ten counts on the right. One block instead of a
   Summary tab, because the numbers are the summary and clicking one is the filter. */
.dr-head {
    display: flex; align-items: center; gap: 28px; flex-wrap: wrap;
    padding: 4px 0 18px; margin-bottom: 14px;
    border-bottom: 1px solid var(--ops-border-soft, #eef0f6);
}
.dr-head-counts { display: flex; gap: 34px; flex-wrap: wrap; flex: 1; }
.dr-phase-hd {
    font: 600 10.5px var(--ops-font, sans-serif); letter-spacing: .06em; text-transform: uppercase;
    color: var(--ops-muted-2, #8a90a6); margin-bottom: 7px;
}
/* When a step began on this machine. Lower case and unspaced against the heading's capitals, so a
   stamp reads as a stamp rather than as another word in the title — and sits at the end of the
   line, where the eye lands after the step's name and its verdict. */
.dr-phase-when {
    margin-left: 10px; font-weight: 400; letter-spacing: 0; text-transform: none;
    color: var(--ops-muted-2, #8a90a6);
    font-variant-numeric: tabular-nums;
}
/* The one the table is filtered by. An underline rather than a fill: the number keeps its own
   colour, which is what tells failed from done at a glance. */
.dp-count.is-on {
    background: var(--ops-surface-3, #eceef5);
    box-shadow: inset 0 -2px 0 0 var(--ops-primary, #4f46e5);
}
.dr-clear { align-self: flex-start; white-space: nowrap; }
.dp-progress + .dp-progress { border-left: 1px solid var(--ops-border-soft, #eef0f6); }

/* Finding one machine in a job aimed at thousands. Sits where the filter bar sits, above the
   table, so the two ways of narrowing the list are in the same place. */
.dr-find {
    display: flex; align-items: center; gap: 8px; margin-bottom: 10px;
    font: 400 12px var(--ops-font, sans-serif); color: var(--ops-text-2, #4b5565);
}
.dr-find input {
    flex: 0 1 260px; min-width: 0;
    border: 1px solid var(--ops-border-soft, #eef0f6); border-radius: 6px;
    padding: 5px 9px; font: inherit; color: var(--ops-text-1, #1f2733);
    background: var(--ops-surface-1, #fff);
}
.dr-find input:focus { outline: none; border-color: var(--ops-accent, #6b7ae8); }

/* The report's device table, filtered to one status by the row that linked here. */
.dr-filter {
    display: flex; align-items: center; gap: 8px; margin-bottom: 10px;
    font: 400 12px var(--ops-font, sans-serif); color: var(--ops-text-2, #4b5565);
}
.dr-filter button {
    border: 0; background: var(--ops-surface-2, #f5f6fa); border-radius: 6px;
    padding: 3px 9px; font: inherit; cursor: pointer; color: inherit;
}
.dr-filter button:hover { background: var(--ops-surface-3, #eceef5); }

/* The filter's own name, carrying the weight: it is the answer to "why is this list short".

   Everything in this bar stays packed to the left, against the cards that set the filter. Pushing
   the button to the far edge would put it back where it just came from — a word on its own at the
   end of a long drag. */
.dr-filter-of { font-weight: 600; color: var(--ops-text, #191c28); }

.dp-status { font: 600 11.5px var(--ops-font, sans-serif); }

/* The agent's own words about a machine — long, and worth reading without breaking the table. */
.dp-msg {
    max-width: 380px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font: 400 11.5px var(--ops-font, sans-serif); color: var(--ops-text-2, #4b5565);
}
.dp-status--success, .dp-status--exists { color: var(--ops-success, #1b6b35); }
.dp-status--failed { color: var(--ops-danger, #9b1c1c); }
.dp-status--deploying { color: var(--ops-primary, #4f46e5); }
.dp-status--waiting, .dp-status--stop { color: var(--ops-muted-2, #8a90a6); }

/* ================================================================
   RESOURCES RAIL — the library where StarCat11 kept it: far left of
   the page, outside the Group tree, always in view. Files are dragged
   from here onto devices in the grid.
   ================================================================ */
.rr-rail {
    position: relative;
    width: 210px;
    min-width: 160px;
    max-width: 420px;
    flex-shrink: 0;
    background: var(--ops-surface);
    border-right: 1px solid var(--ops-border-soft);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width .2s ease;
}
/* !important: the resizer sets an inline width on .rr-rail, which otherwise beats this rule's
   class selector and would leave the rail stuck at whatever width it had before collapsing.
   min-width has to come off as well, and that is not belt-and-braces: min-width is applied after
   width during layout, so .rr-rail's own min-width:160px clamped the collapsed rail straight back
   up to 160px and !important on width could not stop it. The rail collapsed to a 160px column of
   empty space with one button in it. (.dv-sidebar has no min-width, which is why it collapsed
   correctly and this only ever looked broken on one side.) */
.rr-rail.collapsed { width: 40px !important; min-width: 40px !important; }

/* หุบทั้งสองแถบ: ยุบเหลือแถบเดียวที่ถือปุ่มกางทั้งคู่ แทนคอลัมน์ว่าง 40px สองคอลัมน์ติดกัน
   ซึ่งมีเส้นคั่นกลางและอ่านเป็นช่องว่างช่องเดียว ไม่ใช่แถบเครื่องมือ
   ซ่อนตัวจริงด้วย display:none ไม่ใช่ถอดออกจากผัง คอมโพเนนต์จึงยังมีชีวิตและกางกลับได้ทันทีโดยไม่โหลดใหม่ */
.dv-main-row.dv-docked .rr-rail,
.dv-main-row.dv-docked .dv-sidebar,
.dv-main-row.dv-docked .rr-resizer,
.dv-main-row.dv-docked > #sc-resizer { display: none; }

.dv-dock {
    width: 40px; flex: none;
    background: var(--ops-surface);
    border-right: 1px solid var(--ops-border-soft);
    display: flex; flex-direction: column; align-items: center;
    gap: 6px; padding-top: 8px;
    overflow: hidden;
}
/* ปุ่มทั้งสองมาจากคนละแถบ จึงมี margin ของตัวเองและไอคอนคนละขนาด (18 กับ 17) พอมาอยู่ในแถบเดียวกัน
   margin ในแนว flex ไม่ยุบรวม ระยะห่างจึงกลายเป็น 8+8=16px และกล่องปุ่มต่างกัน 1px ซึ่งเห็นได้ในแถบกว้าง 40px
   จึงบังคับกล่องให้เท่ากันและให้ dock เป็นคนคุมระยะห่างแทน */
.dv-dock .rr-expand,
.dv-dock .dv-sidebar-expand {
    margin: 0; padding: 0;
    width: 28px; height: 28px;
    display: grid; place-items: center;
    border: 1px solid var(--ops-border);
    border-radius: 7px;
    /* คนละคอมโพเนนต์จึงเคยตั้งสีของตัวเอง — rr-expand เป็น --ops-text-2 (#3b4252) ส่วน
       dv-sidebar-expand เป็น --ops-muted-2 (#8b94a3) ตอนอยู่คนละแถบไม่มีใครเห็น พอมาอยู่ติดกัน
       เทาสองระดับในแถบกว้าง 40px ผิดชัด · ใช้สีเดียวกับไอคอนหัวแผงตอนกาง ไอคอนตัวเดียวกันจะได้
       สีเดียวกันทั้งสองสถานะ */
    color: var(--ops-primary, #4f46e5);
}
.dv-dock .rr-expand:hover,
.dv-dock .dv-sidebar-expand:hover {
    background: color-mix(in srgb, var(--ops-primary, #4f46e5) 9%, transparent);
}

/* Drag handle between the rail and the rest of the page — hidden while the rail is collapsed,
   since there is nothing to resize down to 40px. */
.rr-rail.collapsed + .rr-resizer { display: none; }
.rr-expand {
    margin: 8px auto; padding: 6px; background: none; cursor: pointer;
    border: 1px solid var(--ops-border); border-radius: 7px; color: var(--ops-text-2);
}

.rr-hdr {
    display: flex; align-items: center; gap: 6px;
    padding: 10px 10px 8px;
    border-bottom: 1px solid var(--ops-border-soft);
}
.rr-hdr-icon { display: inline-flex; flex-shrink: 0; color: var(--ops-primary, #4f46e5); }
.rr-hdr-title { font: 600 12.5px var(--ops-font); color: var(--ops-text); flex: 1; }
.rr-collapse {
    background: none; border: 0; padding: 2px; cursor: pointer; color: var(--ops-muted-2, #8a90a6);
}

.rr-search { position: relative; padding: 8px 10px; }
.rr-search svg { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); width: 13px; height: 13px; color: var(--ops-muted-2, #8a90a6); pointer-events: none; }
.rr-search input {
    width: 100%; padding: 5px 8px 5px 26px; font-size: 12px;
    border: 1px solid var(--ops-border); border-radius: 7px;
    background: var(--ops-surface); color: var(--ops-text);
    transition: border-color .12s ease, box-shadow .12s ease;
}
.rr-search input:focus {
    outline: none; border-color: var(--ops-primary, #4f46e5);
    box-shadow: 0 0 0 3px var(--ops-primary-50, #eef2ff);
}

/* Add / Select-to-delete — the rail's own, so building up or trimming the library does not need a
   detour through the Resources tab. */
.rr-toolbar {
    display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
    padding: 0 10px 10px;
}
/* Same visual language as .dv-modal-btn (the buttons everywhere else on this page) — solid primary
   fill, opacity-fade hover, 7px radius — just sized down a notch for the rail's narrower column. */
.rr-toolbtn {
    display: inline-flex; align-items: center; gap: 5px; justify-content: center;
    padding: 6px 12px; font: 500 12px var(--ops-font); white-space: nowrap;
    border: 1px solid var(--ops-border); border-radius: 7px;
    background: var(--ops-surface); color: var(--ops-text-2, #4a5068);
    cursor: pointer; transition: background .12s ease, border-color .12s ease, color .12s ease, opacity .12s ease;
}
.rr-toolbtn-icon { width: 13px; height: 13px; flex-shrink: 0; }
.rr-toolbtn:hover { background: var(--ops-surface-2, #f6f7fb); }
.rr-toolbtn:disabled { opacity: .5; cursor: not-allowed; }
.rr-toolbtn--primary {
    background: var(--ops-primary, #4f46e5); border-color: var(--ops-primary, #4f46e5); color: #ffffff;
}
.rr-toolbtn--primary:hover { opacity: .88; background: var(--ops-primary, #4f46e5); }
.rr-toolbtn--active {
    background: var(--ops-primary-50, #eef2ff); border-color: var(--ops-primary, #4f46e5); color: var(--ops-primary, #4f46e5);
}
.rr-toolbtn--danger {
    background: var(--ops-danger, #b91c1c); border-color: var(--ops-danger, #b91c1c); color: #ffffff;
}
    .rr-toolbtn--danger:hover {
        background: #dc2626;
        border-color: #dc2626;
        color: #ffffff;
    }

/* Bottom-anchored, auto-dismissing status after an add/delete — the same light-tint language as
   .dv-modal-status/.dv-drop-status elsewhere on this page (a filled banner would be the odd one out),
   just floating over the list instead of sitting inline since there is no room to push content down. */
.rr-toast {
    position: absolute; left: 10px; right: 10px; bottom: 10px; z-index: 5;
    padding: 7px 10px; border-radius: 7px;
    font: 500 12px var(--ops-font); text-align: center;
    box-shadow: var(--ops-sh-2, 0 4px 14px rgba(15,23,42,.12));
    animation: rr-toast-in .15s ease-out;
}
.rr-toast.ok  { background: var(--ops-primary-50, #eef2ff); color: var(--ops-primary, #4f46e5); }
.rr-toast.err { background: var(--ops-danger-50, rgba(239,68,68,.10)); color: var(--ops-danger, #b91c1c); }
@keyframes rr-toast-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* Dropping a file from the desktop onto the list — rs-dropzone.js reads it and hands the bytes to
   ReceiveDroppedFile, the same upload path OnUpload uses. */
.rr-dropzone { position: relative; }
.rr-dropzone-overlay {
    display: none;
    position: absolute; inset: 0; z-index: 2;
    align-items: center; justify-content: center; text-align: center; padding: 8px;
    font: 600 12px var(--ops-font); color: var(--ops-primary, #4f46e5);
    background: var(--ops-primary-50, #eef2ff);
    border: 2px dashed var(--ops-primary, #4f46e5);
    pointer-events: none;
}
.rr-dropzone--over .rr-dropzone-overlay { display: flex; }

.rr-list { flex: 1; min-height: 0; overflow: auto; padding: 0 4px; }
.rr-row {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 6px; border-radius: 6px;
    font-size: 12px; color: var(--ops-text);
    cursor: pointer; user-select: none;
    transition: background .12s ease;
}
.rr-row:hover { background: var(--ops-surface-2, #f6f7fb); }
.rr-row--file { cursor: grab; }
/* Select mode is for ticking files to delete, not for dragging — dragging is switched off (draggable
   is bound to !manageMode in the markup) while it's on, so the row shouldn't still look grabbable. */
.rr-row--file.is-managing { cursor: default; }
.rr-row--file:active { cursor: grabbing; }
/* :active alone ties .is-managing on specificity and would otherwise win by coming later — a click
   during select mode (e.g. hitting the checkbox) must not flash the grab cursor either. */
.rr-row--file.is-managing:active { cursor: default; }
.rr-row.is-dragging { opacity: .45; }
.rr-row.is-checked { background: var(--ops-primary-50, #eef2ff); }
.rr-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* File size, hard right of the row — the legacy console's Size column, in what a 210px rail has room
   for. .rr-name already takes all the slack, so this only has to refuse to shrink or wrap; tabular
   figures keep the numbers in a column of their own rather than ragged down the list. */
.rr-size {
    flex-shrink: 0; margin-left: 6px;
    font-size: 11px; color: var(--ops-muted-2, #8a90a6);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* Which language a script is written in (AdvanceScript.LanguageTag), beside its name in the editor
   header — and only there: on every row of the lists it was clutter. Pascal and Python each get a colour
   of their own, because telling the two apart at a glance is the whole point; the command dialect stays
   grey. The tints are see-through so the same rule reads on a light theme and a dark one. */
.rs-lang {
    flex-shrink: 0; margin-left: 6px; padding: 0 5px; border-radius: 4px;
    font: 600 10px/16px var(--ops-font, sans-serif); letter-spacing: .02em; white-space: nowrap;
    color: var(--ops-text-2, #545a70); background: var(--ops-surface-2, #f1f3f8);
    border: 1px solid var(--ops-border, #dde1ee);
}
.rs-lang--python { color: #2563eb; background: rgba(37, 99, 235, .10); border-color: rgba(37, 99, 235, .30); }
.rs-lang--pascal { color: #8b5cf6; background: rgba(139, 92, 246, .10); border-color: rgba(139, 92, 246, .30); }
/* The language in the side panel's heading ("PYTHON EXAMPLES", "PASCAL FUNCTIONS"), in its tag's colour. */
.rs-fns-lang--python { color: #2563eb; }
.rs-fns-lang--pascal { color: #8b5cf6; }

/* Purely a visual affordance — grip icon on the left of a file row, brighter on hover — the row
   itself is draggable everywhere on it, this just shows where to grab. */
.rr-drag-handle {
    width: 8px; height: 14px; flex-shrink: 0;
    color: var(--ops-muted-2, #8a90a6); opacity: .3;
    cursor: grab; transition: opacity .12s ease, color .12s ease;
}
.rr-row:hover .rr-drag-handle { opacity: .8; }
.rr-row--file:active .rr-drag-handle { cursor: grabbing; }

.rr-check { flex-shrink: 0; margin: 0; cursor: pointer; accent-color: var(--ops-primary, #4f46e5); }

/* Per-file "⋮" menu — Delete lives here instead of a toolbar button, so it takes a deliberate two
   clicks (open the menu, then Delete) rather than one that could land on the wrong row. */
.rr-row-menu { position: relative; flex-shrink: 0; }
.rr-row-menu-btn {
    display: none;
    width: 18px; height: 18px; align-items: center; justify-content: center;
    background: none; border: 0; border-radius: 4px; cursor: pointer;
    color: var(--ops-muted-2, #8a90a6); font-size: 13px; line-height: 1;
}
.rr-row:hover .rr-row-menu-btn, .rr-row-menu-btn:focus { display: inline-flex; }
.rr-row-menu-btn:hover { background: var(--ops-border-soft, #eef0f3); color: var(--ops-text); }
.rr-row-menu-pop {
    position: absolute; right: 0; top: 100%; z-index: 6;
    min-width: 90px; margin-top: 2px; padding: 4px;
    background: var(--ops-surface); border: 1px solid var(--ops-border); border-radius: 7px;
    box-shadow: var(--ops-sh-2, 0 4px 14px rgba(15,23,42,.12));
}
.rr-row-menu-item {
    display: block; width: 100%; padding: 5px 8px; border: 0; border-radius: 5px;
    background: none; text-align: left; font-size: 12px; color: var(--ops-text); cursor: pointer;
}
.rr-row-menu-item:hover { background: var(--ops-surface-2, #f6f7fb); }
.rr-row-menu-item--danger { color: #b91c1c; }
.rr-row-menu-item--danger:hover { background: #fdecec; }

/* Catches a click anywhere else to close an open "⋮" menu — invisible, below the popover itself. */
.rr-menu-backdrop { position: fixed; inset: 0; z-index: 4; }

/* Toolbar's "Add" dropdown — File… / Folder…, one button standing in for what used to be two. Same
   popover language as .rr-row-menu-pop, just anchored to the left under the button instead of the
   right under a row. */
.rr-add-wrap { position: relative; }
.rr-add-menu {
    position: absolute; left: 0; top: 100%; z-index: 6;
    min-width: 120px; margin-top: 4px; padding: 4px;
    background: var(--ops-surface); border: 1px solid var(--ops-border); border-radius: 7px;
    box-shadow: var(--ops-sh-2, 0 4px 14px rgba(15,23,42,.12));
}
.rr-add-menu-item {
    display: flex; align-items: center; justify-content: flex-start; gap: 7px; width: 100%; padding: 6px 9px;
    border: 0; border-radius: 5px; background: none; text-align: left !important;
    font: 500 12px var(--ops-font); color: var(--ops-text); cursor: pointer;
}
.rr-add-menu-item:hover { background: var(--ops-surface-2, #f6f7fb); }
.rr-add-menu-icon { width: 14px; height: 14px; flex-shrink: 0; color: var(--ops-muted-2, #8a90a6); }

/* The hidden file pickers the Add menu and the right-click menu's "Upload" drive through `for=`. Kept
   clipped-but-present rather than display:none — a label still activates a display:none input in every
   browser that matters, but an input that is genuinely in the layout is the one shape of this that has
   never had a browser quirk, and it costs nothing here. */
.rr-hidden-input {
    position: absolute; width: 1px; height: 1px;
    margin: -1px; padding: 0; border: 0;
    clip: rect(0 0 0 0); clip-path: inset(50%);
    overflow: hidden; white-space: nowrap;
}

/* Right-click context menu — New/Edit/Delete/Upload/Download, positioned at the click point (fixed, so
   the inline left/top set from MouseEventArgs.ClientX/Y line up regardless of any ancestor's own
   positioning). Same popover language as .rr-row-menu-pop/.rr-add-menu. */
.rr-ctx-menu {
    position: fixed; z-index: 6;
    min-width: 140px; padding: 4px;
    background: var(--ops-surface); border: 1px solid var(--ops-border); border-radius: 7px;
    box-shadow: var(--ops-sh-2, 0 4px 14px rgba(15,23,42,.12));
}
.rr-ctx-item {
    display: flex; align-items: center; justify-content: flex-start; gap: 7px; width: 100%; padding: 6px 9px;
    border: 0; border-radius: 5px; background: none; text-align: left !important;
    font: 500 12px var(--ops-font); color: var(--ops-text); cursor: pointer; text-decoration: none;
}
.rr-ctx-item:hover { background: var(--ops-surface-2, #f6f7fb); }
.rr-ctx-item--danger { color: #b91c1c; }
.rr-ctx-item--danger:hover { background: #fdecec; }
.rr-ctx-item:disabled { opacity: .5; cursor: not-allowed; background: none; }
.rr-ctx-icon { width: 14px; height: 14px; flex-shrink: 0; color: var(--ops-muted-2, #8a90a6); }
.rr-ctx-item--danger .rr-ctx-icon { color: inherit; }

.rr-newfolder-input {
    width: 100%; padding: 7px 9px; font: 400 13px var(--ops-font);
    border: 1px solid var(--ops-border, #dde1ee); border-radius: 6px;
    background: var(--ops-surface, #fff); color: var(--ops-text, #191c28);
}

/* Tree — folders expand in place under the row that opened them, the way the Group tree does. */
.rr-tree-chevron {
    width: 12px; height: 12px; flex-shrink: 0;
    color: var(--ops-muted-2, #8a90a6); transition: transform .15s;
}
.rr-tree-chevron.open { transform: rotate(90deg); }
.rr-tree-chevron-ph { display: inline-block; width: 12px; height: 12px; flex-shrink: 0; }
.rr-file-icon { width: 13px; height: 13px; flex-shrink: 0; }

/* A heading over the script library's rows, which folds what is under it. It is not a row, so it cannot
   be dragged, ticked or right-clicked. */
.rr-group {
    display: flex; align-items: center; justify-content: flex-start; gap: 4px;
    width: 100%;
    padding: 10px 8px 3px;
    border: 0;
    background: none;
    cursor: pointer;
    text-align: left;
    font: 600 10px var(--ops-font);
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--ops-muted-2, #8a90a6);
}
.rr-group:first-child { padding-top: 4px; }
.rr-group:hover:not(:disabled) { color: var(--ops-text-2, #3b4252); }
/* Held open while filtering or deleting, which is no reason to look switched off: app.css fades every
   button[disabled]. */
.rr-group:disabled { cursor: default; opacity: 1; }
.rr-group .rr-tree-chevron { color: inherit; }

.rr-note, .rr-hint { padding: 8px 10px; font-size: 11.5px; color: var(--ops-muted-2, #8a90a6); }
.rr-hint { border-top: 1px solid var(--ops-border-soft); }
/* An empty Software Packages list says what goes there and offers the way to make one. */
.rr-note--action { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; line-height: 1.5; }
.rr-note-btn {
    padding: 5px 10px; border-radius: 6px; cursor: pointer;
    border: 1px solid var(--ops-primary); background: var(--ops-primary-50); color: var(--ops-primary);
    font: 600 11.5px var(--ops-font);
}
.rr-note-btn:hover { background: var(--ops-primary); color: #fff; }

.rr-cats { border-top: 1px solid var(--ops-border-soft); padding: 4px; display: flex; flex-direction: column; gap: 2px; }
.rr-cat {
    display: flex; align-items: center; justify-content: space-between; gap: 6px;
    padding: 6px 8px; border: 0; border-radius: 5px; cursor: pointer;
    background: none; color: var(--ops-text-2, #4a5068);
    font: 500 12px var(--ops-font); text-align: left;
}
.rr-cat:hover { background: var(--ops-surface-2, #f6f7fb); }
.rr-cat.is-active { background: var(--ops-primary-soft, #eef1ff); color: var(--ops-primary, #4f46e5); font-weight: 600; }
.rr-cat-count { font: 500 10.5px var(--ops-font-mono, monospace); color: var(--ops-muted-2, #8a90a6); font-variant-numeric: tabular-nums; }

/* ── Drop targets: only while something is actually being dragged ── */
.dv-row--droppable > td { transition: background .12s ease; }
.dv-row--drophover > td {
    background: var(--ops-primary-soft, #eef1ff) !important;
    box-shadow: inset 0 1px 0 var(--ops-primary, #4f46e5), inset 0 -1px 0 var(--ops-primary, #4f46e5);
}

/* The rows on their way to a group. Dragging a ticked row takes the whole selection, so more than
   one row can be lit at once — the operator needs to see how many are moving before they let go. */
.dv-row--dragging > td { opacity: .45; }

/* ── The picture under the cursor while rows are being dragged ──
   Built and thrown away by dv-rowdrag.js inside dragstart. It is positioned off-screen because the
   browser only needs to photograph it; it is never seen in the page itself. The stacked edges are
   what says "more than one" before the count is read. */
.dv-drag-ghost {
    position: fixed;
    top: -1000px;
    left: -1000px;
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 260px;
    padding: 8px 12px;
    border: 1px solid var(--ops-border, #e6e8ec);
    border-radius: 9px;
    background: var(--ops-surface, #fff);
    box-shadow: var(--ops-sh-2, 0 4px 14px rgba(15,23,42,.06));
    font: 500 12.5px var(--ops-font, inherit);
    color: var(--ops-text, #0b1220);
    white-space: nowrap;
}
.dv-drag-ghost.is-stack {
    /* Two offset edges behind the card — a pile, not a page. */
    box-shadow:
        var(--ops-sh-2, 0 4px 14px rgba(15,23,42,.06)),
        4px 4px 0 -1px var(--ops-surface, #fff), 4px 4px 0 0 var(--ops-border, #e6e8ec),
        8px 8px 0 -1px var(--ops-surface, #fff), 8px 8px 0 0 var(--ops-border, #e6e8ec);
}
.dv-drag-ghost-icon { width: 22px; height: 22px; flex-shrink: 0; }
.dv-drag-ghost-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.dv-drag-ghost-sub {
    font: 400 11px var(--ops-font-mono, monospace);
    color: var(--ops-muted-2, #8a90a6);
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── "Take them out of this group": a target that only exists mid-drag, so it is drawn as an
   opening rather than a button — dashed, quiet, and only warm once something is over it. ── */
.dv-tree-remove {
    display: flex; align-items: center; gap: 7px;
    margin: 6px 8px;
    padding: 9px 10px;
    border: 1px dashed var(--ops-border-strong, #d3d7df);
    border-radius: 8px;
    font: 500 11.5px var(--ops-font, inherit);
    color: var(--ops-muted, #5b6577);
    cursor: copy;
    transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.dv-tree-remove svg { width: 14px; height: 14px; flex-shrink: 0; opacity: .7; }
.dv-tree-remove.is-hover {
    background: var(--ops-danger-soft, #fee2e2);
    border-color: var(--ops-danger, #b91c1c);
    border-style: solid;
    color: var(--ops-danger, #b91c1c);
}
.dv-tree-remove.is-hover svg { opacity: 1; }

/* ── A group in the tree as a drop target ── */
.dv-tree-item--droppable { outline: 1px dashed transparent; }
.dv-tree-item--drophover {
    background: var(--ops-primary-soft, #eef1ff) !important;
    outline: 1px dashed var(--ops-primary, #4f46e5);
    outline-offset: -1px;
}
/* The group being dragged onto another: faded where it was, so it reads as on its way somewhere. */
.dv-tree-item--dragging { opacity: .45; }

.dv-drop-status {
    display: flex; align-items: center; gap: 8px;
    margin: 0 14px 8px; padding: 8px 12px; border-radius: 7px;
    font-size: 12.5px;
}
.dv-drop-status.ok  { background: var(--ops-primary-soft, #eef1ff); color: var(--ops-text); }
.dv-drop-status.err { background: var(--ops-danger-soft, #fdecec); color: var(--ops-danger, #9b1c1c); }
.dv-drop-status span { flex: 1; }
.dv-drop-status-x { background: none; border: 0; cursor: pointer; color: inherit; opacity: .7; }
/* A script to machines that are not all Windows: one chip per outcome, then the row column that says
   which machine is which. Left out is the only one that needs to stand out. */
.dv-script-plan { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.dv-script-plan-item {
    padding: 3px 10px; border-radius: 999px;
    font: 500 12px var(--ops-font); color: var(--ops-text);
    background: var(--ops-surface-2, #f6f7fb); border: 1px solid var(--ops-border, #dde1ee);
}
.dv-script-plan-item.is-skipped {
    background: var(--ops-danger-soft, #fdecec); border-color: transparent; color: var(--ops-danger, #9b1c1c);
}

/* Where the file should land, on the drop-confirm modal. One control for the whole send — the
   folder applies to every machine in the list under it — sitting above that list, because it is
   part of the sentence being confirmed rather than a setting tucked away below it. */
.dv-dest { margin: 0 0 12px; }
.dv-dest .dv-form-label { display: block; margin-bottom: 5px; }

/* The pill and its menu are .dv-filter-btn / .dv-dropdown-menu, the same pair the filter bar uses,
   so only what is particular to this one is here: a menu wide enough for a path, and rows that
   carry the path under the name. */
.dv-dest-menu { min-width: 250px; }
.dv-dest-item { align-items: flex-start; }
.dv-dest-item-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
/* Its own colour and weight, so the selected row's accent and bold stay on the name — the path is
   reference, not emphasis. */
.dv-dest-item-path {
    font: 400 11px var(--ops-font-mono);
    color: var(--ops-text-3, #94a3b8);
}

/* The line under the pill: where the file ends up, and how many machines that covers — or, once the
   rows disagree, one entry per folder with its share of the machines. */
.dv-dest-now {
    display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px;
    margin-top: 6px;
    font: 400 11.5px var(--ops-font);
    color: var(--ops-text-3, #94a3b8);
}
.dv-dest-now-path { font: 400 11.5px var(--ops-font-mono); color: var(--ops-text-2, #4b5565); }
.dv-dest-now-split { display: inline-flex; align-items: baseline; gap: 4px; }

/* ── The drop-confirm dialog is a list, not a question ──
   It carries a row per machine with a control on each, so it gets the width to show the folder's
   name beside the buttons and the height to show more than a porthole of a large send. The body
   scrolls rather than the page, so the footer's Send button is always where it was. */
.dv-modal--wide { width: 720px; }
.dv-modal--wide .dv-modal-body { max-height: min(62vh, 560px); overflow: auto; }

/* The machine list: one row each, the folder in a column with a heading, and the heading staying
   put while the rows go past it. */
.dv-drop-tablewrap {
    border: 1px solid var(--ops-border-soft);
    border-radius: 8px;
    overflow: auto;
    max-height: 340px;
}
.dv-drop-table {
    width: 100%;
    border-collapse: collapse;
    font: 400 12.5px var(--ops-font);
    color: var(--ops-text-2);
}
.dv-drop-table thead th {
    position: sticky; top: 0; z-index: 1;
    padding: 7px 10px;
    text-align: left; white-space: nowrap;
    font: 600 10.5px var(--ops-font); letter-spacing: .04em; text-transform: uppercase;
    color: var(--ops-muted-2);
    background: var(--ops-surface-2);
    border-bottom: 1px solid var(--ops-border-soft);
}
.dv-drop-table tbody td {
    padding: 5px 10px;
    border-bottom: 1px solid var(--ops-border-soft);
    white-space: nowrap;
}
.dv-drop-table tbody tr:last-child td { border-bottom: 0; }
.dv-drop-table tbody tr:hover td { background: var(--ops-surface-2); }
.dv-drop-td-name { color: var(--ops-text); font-weight: 500; }
/* The folder column is the one anything is done in, so it gets the right-hand edge and no more room
   than its contents need. */
.dv-drop-th-dest, .dv-drop-td-dest { width: 1%; }
.dv-drop-td-dest { display: flex; align-items: center; gap: 8px; }
/* Spelled out beside the buttons: an icon cannot say "C:\Windows\Temp", and the tooltip that can is
   only there for whoever thinks to hover. */
.dv-dest-rowname { color: var(--ops-text-2); }

.dv-dest-seg {
    display: inline-flex; flex: 0 0 auto; gap: 2px;
    padding: 2px;
    background: var(--ops-surface-2);
    border-radius: 7px;
}
.dv-dest-segbtn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 22px; height: 20px;
    padding: 0;
    border: 1px solid transparent; border-radius: 5px;
    background: transparent;
    color: var(--ops-text-3, #94a3b8);
    cursor: pointer;
    transition: background .1s, color .1s, border-color .1s;
}
.dv-dest-segbtn svg { width: 13px; height: 13px; }
.dv-dest-segbtn:hover { color: var(--ops-text-2, #4b5565); }
.dv-dest-segbtn.is-on {
    background: var(--ops-surface, #fff);
    border-color: var(--ops-primary, #4f46e5);
    color: var(--ops-primary, #4f46e5);
}

/* Online/offline dot next to each device in the drop-confirm list (Send/Schedule modal). */
.dv-drop-online-dot {
    display: inline-block;
    width: 6px; height: 6px;
    border-radius: 50%;
    margin: 0 4px 0 8px;
    vertical-align: middle;
}
/* "and N more" in that same list — clickable to expand/collapse the full device list. */
.dv-drop-list-toggle {
    background: none; border: 0; padding: 0; margin: 2px 0 0;
    font: inherit; font-size: 12.5px; color: var(--ops-primary, #4f46e5);
    cursor: pointer; text-decoration: underline;
    align-self: flex-start;   /* it sits under the table now, not inside it */
}
.dv-drop-list-toggle:hover { opacity: .8; }

/* ================================================================
   SIDEBAR
   ================================================================ */
.dv-sidebar {
    width: 224px;
    flex-shrink: 0;
    background: var(--ops-surface);
    border-right: 1px solid var(--ops-border-soft);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width .2s ease;
}
.dv-sidebar.collapsed { width: 40px; }

/* ── Header (Group + tenant icon + collapse) ── */
.dv-sidebar-hdr {
    display: flex; align-items: center; gap: 6px;
    padding: 10px 10px 8px;
    border-bottom: 1px solid var(--ops-border-soft);
    flex-shrink: 0;
}
/* สีมาจากที่นี่ ไม่ใช่จาก markup — ค่าเดียวกับ .rr-hdr-icon ของแผง Resources ที่อยู่ติดกัน
   เปลี่ยนทีเดียวได้ทั้งสองแผง และผูก token ทีหลังได้โดยไม่ต้องแตะ SVG */
.dv-sidebar-hdr-icon { display: inline-flex; flex-shrink: 0; color: var(--ops-primary, #4f46e5); }
.dv-sidebar-hdr-title { font: 600 12.5px var(--ops-font); color: var(--ops-text); flex: 1; }
.dv-sidebar-collapse, .dv-sidebar-expand {
    border: none; background: none; cursor: pointer; color: var(--ops-muted-2);
    padding: 2px; display: inline-flex; align-items: center; justify-content: center;
}
.dv-sidebar-expand { margin: 8px auto; padding: 6px; border: 1px solid var(--ops-border); border-radius: 7px; }

/* ── Footer actions (New group / SQL group) ── */
.dv-sidebar-footer {
    flex-shrink: 0;
    border-top: 1px solid var(--ops-border-soft);
    padding: 8px;
    display: flex; gap: 6px;
    position: relative;
}

/* One control: it opens the list of group types rather than making one of them outright. */
.dv-foot-primary {
    flex: 1; min-width: 0;
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    height: 32px; padding: 0 10px;
    border: 1px solid var(--ops-primary, #4f46e5); border-radius: 8px;
    background: var(--ops-primary, #4f46e5); color: #fff;
    font: 500 12.5px var(--ops-font); white-space: nowrap; cursor: pointer;
    transition: filter .1s;
}
.dv-foot-primary:hover, .dv-foot-primary.on { filter: brightness(1.08); }
.dv-foot-plus { width: 13px; height: 13px; flex-shrink: 0; }
.dv-foot-caret { width: 12px; height: 12px; flex-shrink: 0; opacity: .8; transition: transform .12s; }
.dv-foot-primary.on .dv-foot-caret { transform: rotate(180deg); }

/* Opens upward: the footer is the last thing in the sidebar. */
.dv-foot-scrim { position: fixed; inset: 0; z-index: 40; }
.dv-foot-pop {
    position: absolute; bottom: calc(100% + 6px); right: 8px; left: 8px; z-index: 41;
    background: var(--ops-surface); border: 1px solid var(--ops-border); border-radius: 10px;
    box-shadow: 0 1px 2px rgba(20, 30, 60, .06), 0 10px 28px -12px rgba(20, 30, 60, .3);
    padding: 5px;
}
.dv-foot-pop-item {
    /* Rows are two lines (name + what it does); centring the icon against the pair left it floating
       between them. It belongs with the name. */
    /* justify-content is spelled out because MudBlazor centres every <button>; without it the icon
       drifted right by however much narrower the row's text was than the menu. */
    width: 100%; display: flex; align-items: flex-start; justify-content: flex-start; gap: 10px;
    padding: 8px 10px; border: none; border-radius: 7px; background: transparent;
    color: var(--ops-text-2, #3b4252); font: 400 12.5px var(--ops-font);
    text-align: left; cursor: pointer;
}
.dv-foot-pop-item:hover { background: var(--ops-surface-2); }
.dv-foot-pop-item svg { width: 15px; height: 15px; flex-shrink: 0; margin-top: 2px; color: var(--ops-muted); }
.dv-foot-pop-item:hover svg { color: var(--ops-primary, #4f46e5); }
.dv-foot-pop-txt { min-width: 0; }
.dv-foot-pop-txt { line-height: 1.45; }
.dv-foot-pop-txt small { display: block; font-size: 10.5px; color: var(--ops-muted); line-height: 1.35; margin-top: 1px; }
.dv-sidebar-foot-btn {
    flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 4px;
    padding: 5px 0; border: 1px solid var(--ops-border); border-radius: 6px;
    background: var(--ops-surface); color: var(--ops-muted);
    font: 400 11px var(--ops-font); cursor: pointer;
    transition: background .1s, color .1s;
}
.dv-sidebar-foot-btn:hover { background: var(--ops-surface-2); color: var(--ops-text-2); }
.dv-sidebar-foot-btn svg { width: 11px; height: 11px; flex-shrink: 0; }

/* ── Search ── */
.dv-sidebar-search {
    display: flex; align-items: center; gap: 6px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--ops-border-soft);
    flex-shrink: 0;
}
.dv-sidebar-search svg { width: 12px; height: 12px; flex-shrink: 0; opacity: .4; }
.dv-sidebar-search input {
    flex: 1; border: none; background: transparent;
    font: 400 12px var(--ops-font); color: var(--ops-text);
    outline: none; min-width: 0;
}
.dv-sidebar-search input::placeholder { color: var(--ops-muted-2); }

/* ── Tree body ── */
.dv-sidebar-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 6px 0;
}
.dv-sidebar-body::-webkit-scrollbar { width: 4px; }
.dv-sidebar-body::-webkit-scrollbar-thumb { background: var(--ops-border-soft); border-radius: 2px; }

/* ── Tree item ── */
.dv-tree-item {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px 5px 10px;
    cursor: pointer;
    border-radius: 0;
    transition: background .08s;
    min-height: 30px;
    position: relative;
}
.dv-tree-item:hover { background: var(--ops-surface-2); }
.dv-tree-item.active {
    background: var(--ops-primary-50);
}
.dv-tree-item.active::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--ops-primary);
    border-radius: 0 2px 2px 0;
}
.dv-tree-item.active .dv-tree-label { color: var(--ops-primary); font-weight: 600; }

/* ── Chevron ── */
.dv-tree-chevron {
    width: 13px; height: 13px;
    flex-shrink: 0;
    cursor: pointer;
    color: var(--ops-muted-2);
    transition: transform .15s;
}
.dv-tree-chevron.open { transform: rotate(90deg); }
.dv-tree-chevron-ph { width: 13px; height: 13px; flex-shrink: 0; }

/* ── Icon ── */
.dv-tree-icon {
    width: 14px; height: 14px;
    flex-shrink: 0;
}

/* ── Label ── */
.dv-tree-label {
    font: 400 12.5px var(--ops-font);
    color: var(--ops-text-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
    line-height: 1.35;
}
.dv-highlight {
    background: var(--ops-warning-soft, #fef9c3);
    color: var(--ops-warning, #92400e);
    border-radius: 2px;
    padding: 0 1px;
}

/* ── Tree children (no animation needed, just show/hide) ── */
.dv-tree-children { }

/* ── Legend ── */
.dv-sidebar-legend {
    flex-shrink: 0;
    border-top: 1px solid var(--ops-border-soft);
    padding: 10px 12px;
}
.dv-legend-title {
    font: 700 9.5px var(--ops-font);
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--ops-muted-2);
    margin-bottom: 7px;
}
.dv-legend-row {
    display: flex; align-items: center; gap: 7px;
    font: 400 11.5px var(--ops-font);
    color: var(--ops-muted);
    margin-bottom: 5px;
    line-height: 1.3;
}
.dv-legend-row:last-child { margin-bottom: 0; }
.dv-legend-row svg { width: 13px; height: 13px; flex-shrink: 0; }

/* ── Skeleton ── */
.dv-skel-sidebar { padding: 6px 0; }
.dv-skel-tree-row {
    display: flex; align-items: center; gap: 5px;
    padding: 5px 10px;
    min-height: 30px;
}
.dv-skel {
    border-radius: 4px;
    background: linear-gradient(90deg, var(--ops-border-soft, #edf0f4) 25%, var(--ops-surface-2, #f8f9fb) 37%, var(--ops-border-soft, #edf0f4) 63%);
    background-size: 200% 100%;
    animation: dv-shimmer 1.4s infinite;
    flex-shrink: 0;
}
.dv-skel-chevron { width: 13px; height: 9px; }
.dv-skel-icon    { width: 14px; height: 14px; border-radius: 3px; }
.dv-skel-label   { height: 10px; flex: 1; }

/* ================================================================
   CONTEXT MENU
   ================================================================ */
.dv-ctx-overlay {
    position: fixed; inset: 0; z-index: 1500;
}
.dv-ctx-menu {
    position: fixed;
    min-width: 170px;
    background: var(--ops-surface);
    border: 1px solid var(--ops-border);
    border-radius: 9px;
    box-shadow: var(--ops-sh-2);
    z-index: 1600;
    padding: 4px;
}
.dv-ctx-item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 7px;
    width: 100%;
    padding: 7px 9px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--ops-text-2);
    font: 400 12.5px var(--ops-font);
    cursor: pointer;
    text-align: left;
    transition: background .1s;
}
.dv-ctx-item:hover { background: var(--ops-surface-2); color: var(--ops-text); }
.dv-ctx-item svg { width: 12px; height: 12px; flex-shrink: 0; opacity: .6; }
.dv-ctx-item--danger { color: var(--ops-danger); }
.dv-ctx-item--danger:hover { background: var(--ops-danger-soft, #fff1f1); color: var(--ops-danger); }
.dv-ctx-sep { height: 1px; background: var(--ops-border-soft); margin: 3px 0; }

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 900px) {
    .dv-hdr-actions { gap: 4px; }
    .dv-btn { padding: 5px 7px; font-size: 11px; }
    .dv-kpi-strip { padding: 8px 12px; gap: 6px; }
    .dv-filter-bar, .dv-hdr, .dv-body { padding-left: 12px; padding-right: 12px; }
    .dv-search { min-width: 150px; }
}

/* ── Row chevron column (handoff: indicates row opens detail drawer) ── */
/* กว้างขึ้นเล็กน้อยจาก 28px เพื่อให้ปุ่มคอลัมน์ 26px มีระยะหายใจ */
.dv-th-chevron { width: 34px; }
.dv-td-chevron {
    width: 28px;
    text-align: center;
    color: var(--sc-text-3, #8b94a3);
    opacity: .55;
}
.dv-table tbody tr:hover .dv-td-chevron { opacity: 1; color: var(--sc-primary, #4f46e5); }

/* ── Row shortcuts ───────────────────────────────────────────────────────────
   Remote control, capture screen, refresh-status-and-ping and Controls, floating over the right side of the Host
   name cell on hover rather than sitting inline after the hostname. Inline (even hidden via
   opacity, with a reserved width) still counts toward that column's auto-computed width —
   table-layout:auto sizes Host name to fit the widest row, so every row ended up with the
   full icon-group's worth of blank space after a short name, and a long name had nowhere
   left to go but under the icons. Absolutely positioned, .dv-rowacts contributes nothing to
   the column's width at all: the column now sizes to the hostname text alone (truncated
   with an ellipsis past 200px — see .dv-hostname), and the icons simply overlay whatever is
   underneath when they show. */
/* ความกว้างขั้นต่ำ 180px (user สั่งลดจาก 260px 2026-10-19) — พอสำหรับชื่อยาวปกติ (90% ไม่เกิน
   12 ตัวอักษร ≈ 90px) กับป้าย Bypass/Control ในบรรทัดเดียว · ไอคอนลัด (~110px) ลอยทับปลายชื่อ
   ตอนชี้แถว ซึ่งเป็นราคาที่ยอมจ่ายเพื่อให้ตารางแคบลง และชื่อเต็มยังอยู่ใน title ของช่อง */
.dv-table td.dv-td-hostname { position: relative; overflow: visible; min-width: 180px; }
.dv-table thead th.dv-th-chevron { position: sticky; z-index: 3; right: 0; background: var(--ops-surface-2); }
.dv-table td.dv-td-chevron        { position: sticky; z-index: 2; right: 0; background: var(--ops-surface); }
.dv-table tbody tr:hover  td.dv-td-chevron { background: var(--ops-surface-2); }
.dv-table tbody tr.dv-row--selected td.dv-td-chevron { background: var(--ops-primary-50, #f0f4ff); }
.dv-table tbody tr.dv-row--active   td.dv-td-chevron { background: var(--ops-primary-50); }
/* Anchored to the cell (.dv-td-hostname, above), not to .dv-host-cell — what it is anchored
   TO decides where it sits; what REVEALS it is the whole row (see the rule below).
   Background matches --ops-surface-2 on purpose, not plain white: hovering this cell also
   satisfies `.dv-table tbody tr:hover` (hover bubbles up to the row), which paints the whole
   row --ops-surface-2 at the very same moment — so the icon group is always exactly the same
   colour as the row it is sitting on top of, seamless rather than a mismatched patch. A
   shared border-radius reads as one small tag rather than a hard-edged rectangle.
   Hidden with `visibility`, not `opacity` — and centred with top/bottom/margin, not
   `transform: translateY()`. Both opacity-below-1 and any transform create a new stacking
   context, which traps .dv-rowact-menu's z-index:1200 inside it: the dropdown could then no
   longer win against LATER <tr> rows in the table (plain, unpositioned siblings still paint
   over it in DOM order), so an open menu rendered interleaved with whatever rows sat below
   it. Neither visibility nor top/bottom/margin centering creates a stacking context, so the
   menu's z-index reaches the table level as intended. */
.dv-rowacts {
    position: absolute; top: 0; bottom: 0; right: 8px; margin: auto 0;
    height: 26px;
    display: inline-flex; align-items: center; gap: 2px;
    background: var(--ops-surface-2);
    border-radius: 6px;
    visibility: hidden;
}
/* ทั้งแถวเป็นตัวเปิด ไม่ใช่เฉพาะช่องชื่อเครื่อง — คนกวาดสายตาอ่าน IP หรือผู้ใช้อยู่แล้วนึกอยากสั่ง
   อะไรกับเครื่องนั้น ต้องเลื่อนเมาส์กลับไปที่ชื่อก่อนไอคอนถึงจะโผล่ ซึ่งเป็นจังหวะที่ไม่มีเหตุผล
   ให้ต้องมี

   แลกมากับการที่ไอคอนทับชื่อเครื่องบ่อยขึ้น (มันลอยอยู่เหนือช่องชื่อ) — ยอมได้ เพราะชื่อยังอ่านได้
   ตลอดเวลาที่เมาส์ไม่ได้อยู่บนแถวนั้น และแถวที่เมาส์อยู่คือแถวที่คนกำลังจะสั่งงาน ไม่ใช่แถวที่
   กำลังอ่าน */
.dv-table tbody tr:hover .dv-rowacts { visibility: visible; }
/* An open menu outlives the pointer leaving the cell. */
.dv-rowacts:has(.dv-rowact-menu) { visibility: visible; }

.dv-rowact {
    display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 26px;
    padding: 0;
    border: 1px solid transparent; border-radius: 6px;
    background: transparent;
    color: var(--ops-text-2, #4b5563);
    cursor: pointer;
    transition: background .1s, color .1s, border-color .1s;
}
.dv-rowact svg { width: 15px; height: 15px; }
/* --ops-primary-50 rather than --ops-surface-2 here: the group behind these buttons (above)
   already sits at --ops-surface-2, so that would no longer read as a distinct hover state. */
.dv-rowact:hover {
    background: var(--ops-primary-50, #eef2ff);
    border-color: var(--ops-border);
    color: var(--ops-primary, #4f46e5);
}
.dv-rowact--on {
    background: var(--ops-primary-50, #eef2ff);
    border-color: var(--ops-border);
    color: var(--ops-primary, #4f46e5);
}
/* Dimmed, not hidden: the machine has not granted control permission, and the title says so. */
.dv-rowact--off { opacity: .45; }

/* The menu lives inside the scrolling table, so it opens upward on rows past the
   halfway mark — downward it would be clipped by the container, not overflow it. */
.dv-rowact-menu {
    z-index: 1200;   /* above the sticky header and the pinned cells it hangs off */
    top: calc(100% + 4px);
    left: auto;
    right: 0;
    max-height: 320px;
    overflow-y: auto;
    /* Without this, scrolling the menu list once it hits its own top/bottom "chains" into the
       table's own scroll container underneath it — the whole page/table jumps along with the
       menu instead of the scroll stopping at the menu's edge. */
    overscroll-behavior: contain;
}
.dv-rowact-menu--up { top: auto; bottom: calc(100% + 4px); }

/* ── User cell with avatar (handoff style) ── */
.dv-user-cell { display: inline-flex; align-items: center; gap: 6px; }
.dv-user-avatar {
    width: 22px; height: 22px; border-radius: 99px; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #6366f1, #4338ca);
    color: #fff; font-size: 9px; font-weight: 700; letter-spacing: .04em;
}

/* ── Per-group device count badge ── */
.dv-tree-count {
    font: 500 10px var(--ops-font-mono);
    color: var(--ops-muted-2);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
    margin-left: 4px;
}
.dv-tree-item.active .dv-tree-count { color: var(--ops-primary); }
/* More of the group offline than /configs/ChangeAlert's group warning allows — StarCat11 drew it orange. */
.dv-tree-item--offline-warn .dv-tree-label,
.dv-tree-item--offline-warn .dv-tree-count,
.dv-tree-item--offline-warn.active .dv-tree-label,
.dv-tree-item--offline-warn.active .dv-tree-count { color: var(--ops-warning, #b45309); font-weight: 600; }
/* A condition group whose query failed — marked, not left blank ("not counted yet"). */
.dv-tree-count-error, .dv-tree-item.active .dv-tree-count-error { color: var(--ops-danger, #dc2626); font-weight: 700; }
.dv-count-error {
    font-size: 11px;
    color: var(--ops-danger, #dc2626);
    margin-left: 6px;
}
/* "Include subgroups (2,425)": the tree's number is the branch, the list is the group itself. */
.dv-count-sub {
    margin-left: 8px; padding: 2px 8px; border-radius: 999px;
    border: 1px solid var(--ops-border, #e5e7eb); background: var(--ops-surface, #fff);
    font-size: 11px; color: var(--ops-primary, #4f46e5); cursor: pointer;
}
.dv-count-sub:hover { border-color: var(--ops-primary, #4f46e5); }
.dv-count-sub:focus-visible { outline: 2px solid var(--ops-primary, #4f46e5); outline-offset: 2px; }

/* ปุ่มล้างของกลุ่มผลลัพธ์ — จางไว้จนกว่าจะชี้ที่แถว เพราะมันไม่ใช่สิ่งที่คนมาหาในต้นไม้กลุ่ม
   แต่ต้องอยู่ตรงนั้นตอนที่นึกได้ว่าผลค้างมาจากคำถามเมื่อไหร่ก็ไม่รู้ */
.dv-tree-x {
    display: inline-flex; align-items: center; justify-content: center;
    width: 16px; height: 16px; margin-left: 2px; padding: 0;
    border: 0; border-radius: 4px; background: transparent; cursor: pointer;
    color: var(--ops-muted-2); opacity: 0; flex-shrink: 0;
    transition: opacity .12s ease, background .12s ease, color .12s ease;
}
.dv-tree-item:hover .dv-tree-x,
.dv-tree-item.active .dv-tree-x { opacity: 1; }
.dv-tree-x:hover { background: var(--ops-faint); color: var(--ops-danger); }
.dv-tree-x:focus-visible { opacity: 1; outline: 2px solid var(--ops-primary); outline-offset: 1px; }

/* ── รายการคำตอบของ Inspect ตอนถามหลายเครื่อง ──────────────────────────────
   จุดสีนำหน้าทุกแถว รวมแถวที่ยังไม่ตอบ เพราะสิ่งที่คนอ่านอยากรู้ก่อนคือ "ครบหรือยัง"
   ไม่ใช่ "ใครตอบว่าอะไร" — และสองอย่างนั้นแยกกันไม่ออกถ้าแถวที่ยังไม่ตอบหน้าตาเหมือนแถวที่ตอบว่าไม่ */
.dv-ins-list { display: flex; flex-direction: column; gap: 2px; max-height: 240px; overflow-y: auto; }
.dv-ins-row  { display: flex; align-items: center; gap: 8px; font-size: 12.5px; padding: 3px 0; min-width: 0; }
.dv-ins-name { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ops-text); }
.dv-ins-ans  { margin-left: auto; flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis;
               white-space: nowrap; color: var(--ops-muted); font: 500 11.5px var(--ops-font-mono); }

.dv-ins-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--ops-muted-2); }
.dv-ins-dot.is-yes     { background: var(--ops-success, #22c55e); }
.dv-ins-dot.is-no      { background: var(--ops-muted-2); }
.dv-ins-dot.is-silent  { background: var(--ops-warn, #f59e0b); }
.dv-ins-dot.is-error   { background: var(--ops-danger, #ef4444); }
.dv-ins-dot.is-unclear { background: var(--ops-warn, #f59e0b); opacity: .55; }
.dv-ins-dot.is-asking  { background: var(--ops-primary); animation: dv-ins-pulse 1s ease-in-out infinite; }
@keyframes dv-ins-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

/* ── SQL query preview block ── */
.dv-sql-preview {
    flex-shrink: 0;
    border-top: 1px solid var(--ops-border-soft);
    padding: 8px 12px 4px;
}
.dv-sql-preview-lbl {
    font: 600 9.5px var(--ops-font);
    letter-spacing: .08em;
    color: var(--ops-muted-2);
    margin-bottom: 5px;
}
.dv-sql-preview-code {
    background: #0b1220;
    color: #86efac;
    border-radius: 7px;
    padding: 8px 10px;
    font: 500 10.5px var(--ops-font-mono);
    line-height: 1.5;
    word-break: break-all;
    max-height: 120px;
    overflow-y: auto;
}

/* ── Sidebar + content row (group sidebar sits under the full-width header) ── */
.dv-main-row { display: flex; flex: 1; min-height: 0; overflow: hidden; }
.dv-main-body { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }

/* ── Workspace tabs (device list · System Monitoring · Capture Screen) ──
   Inactive bodies stay mounted so a monitoring stream keeps running in the background. */
.dv-hidden { display: none !important; }

.dv-worktabs {
    display: flex; align-items: stretch; gap: 2px; flex-shrink: 0;
    padding: 0 10px; border-bottom: 1px solid var(--ops-border, #dde1ee);
    background: var(--ops-surface-2, #f6f7fb);
    overflow-x: auto; scrollbar-width: thin;
}
.dv-worktab {
    display: inline-flex; align-items: center; gap: 7px; flex-shrink: 0;
    max-width: 260px; padding: 9px 12px;
    border: none; border-bottom: 2px solid transparent; background: transparent;
    font: 500 12.5px var(--ops-font, sans-serif); color: var(--ops-text-2, #545a70);
    cursor: pointer; white-space: nowrap;
}
.dv-worktab:hover { color: var(--ops-text, #191c28); background: var(--ops-surface, #fff); }
.dv-worktab.is-active {
    color: var(--ops-primary, #4f46e5); background: var(--ops-surface, #fff);
    border-bottom-color: var(--ops-primary, #4f46e5); font-weight: 600;
}
.dv-worktab:focus-visible { outline: 2px solid var(--ops-primary, #4f46e5); outline-offset: -2px; }
.dv-worktab-label { overflow: hidden; text-overflow: ellipsis; }
.dv-worktab-close {
    display: inline-flex; align-items: center; justify-content: center;
    width: 16px; height: 16px; border-radius: 4px; flex-shrink: 0;
    font-size: 11px; line-height: 1; color: var(--ops-muted-2, #8a90a6);
}
.dv-worktab-close:hover { background: var(--ops-danger-soft, #fee2e2); color: var(--ops-danger, #b91c1c); }

.dv-worktab-body { flex: 1; min-height: 0; overflow: auto; }

/* The remote viewer fills its tab; it scrolls/scales internally, so the tab itself must not scroll. */
.dv-worktab-body:has(> .dv-worktab-frame) { overflow: hidden; }
.dv-worktab-frame { display: block; width: 100%; height: 100%; border: 0; background: #111; }

/* Capture Screen rendered inside a tab instead of as a modal. */
.dv-embed { display: block; height: 100%; }
.dv-embed-inner { display: flex; flex-direction: column; height: 100%; padding: 16px; gap: 12px; }

/* ── Force dropdown items left-aligned (override any global button/menu rule) ── */
.dv-dropdown-menu .dv-dropdown-item {
    display: flex !important;
    align-items: center;
    justify-content: flex-start !important;
    text-align: left !important;
    width: 100%;
}

/* ── Chat panel ──────────────────────────────────────────────
   A transcript reads as a column of turns; whose turn it was has to be visible at a glance, so the
   two sides sit against opposite edges rather than relying on the name alone. */
.dv-chat-log {
    display: flex; flex-direction: column; gap: 10px;
    max-height: 320px; min-height: 160px; overflow-y: auto;
    padding: 4px 2px; margin-bottom: 10px;
}
.dv-chat-line { display: flex; flex-direction: column; gap: 2px; max-width: 82%; }
.dv-chat-line--us   { align-self: flex-end; align-items: flex-end; }
.dv-chat-line--them { align-self: flex-start; align-items: flex-start; }
.dv-chat-who { font-size: 11px; color: var(--ops-muted); }
.dv-chat-text {
    font-size: 13px; line-height: 1.45; padding: 7px 11px;
    border-radius: var(--ops-r); white-space: pre-wrap; word-break: break-word;
}
.dv-chat-line--us   .dv-chat-text { background: var(--ops-primary); color: #fff; }
.dv-chat-line--them .dv-chat-text { background: var(--ops-faint); color: var(--ops-text); }

/* วันคั่นบทสนทนา — แถวบอกแค่เวลา ข้อความของเมื่อวานกับของเช้านี้จึงอ่านเหมือนคุยรวดเดียว
   align-self: center เพราะเส้นนี้ไม่ได้เป็นของฝั่งไหน ต่างจากทุกแถวรอบตัวมัน */
.dv-chat-day {
    align-self: center; max-width: 100%;
    font-size: 10.5px; letter-spacing: .04em; text-transform: uppercase;
    color: var(--ops-muted); background: var(--ops-faint);
    padding: 2px 10px; border-radius: 999px; margin: 2px 0;
}

/* ── Horizontal pan bar for the grid ─────────────────────────────────────────
   Drawn rather than asked for: this is an overlay-scrollbar platform, where the
   native bar is invisible until something moves — and neither ::-webkit-scrollbar
   sizing nor scrollbar-color/scrollbar-width will pin one open. Sits on the body
   and is positioned over the grid's bottom edge by dv-pan.js, because everything
   inside the panel belongs to Blazor. */
/* แถบเลื่อนแนวนอนที่ dv-pan.js เคยวาดเองถูกถอดออกแล้ว (2026-09-08)
   ของเนทีฟจองพื้นที่ของมันอยู่แล้ว สองอันจึงซ้อนกันเป็นสองเส้น */

/* ── Drawer tabs without a stylesheet of their own ─────────────────────────────
   Driver, FIM, File Inventory and Change render inside the device drawer but have no scoped CSS,
   so they missed every rule the other tabs follow. These give them the same three things the rest
   of the panel has: controls inside a group, tables in a white card that scrolls within itself,
   and states that sit in a card rather than floating on the page ground.

   They live here, in the page stylesheet, because Blazor stamps its scope attribute on the last
   element of a selector — a parent component's scoped rules cannot reach a child component's
   markup, so DeviceDrawerD.razor.css physically cannot style these. */
.ddc-tabbody .sc-panel-tab-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}

.ddc-tabbody .sc-panel-filter-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin: 0;
    padding: 8px 10px;
    background: var(--ops-surface, #fff);
    border-radius: 12px;
}

/* ลูกโดยตรงเท่านั้น — ไม่ใช่ทุก input ในแถบ

   ช่องค้นหาตามแบบคือ label ที่มีกรอบ แล้วมี input ใสอยู่ข้างใน ถ้ากฎนี้กวาดทุก input ในแถบ มันจะไป
   ใส่กรอบและพื้นหลังให้ input ตัวในด้วย (เจาะจงกว่ากฎของช่องค้นหาเอง จึงชนะ) ผลคือกล่องซ้อนกล่อง */
.ddc-tabbody .sc-panel-filter-row > input[type="text"] {
    height: 28px;
    min-width: 0;
    padding: 0 9px;
    border: 1px solid var(--ops-border, #e6e8ec);
    border-radius: 8px;
    background: var(--ops-bg, #f6f7f9);
    font: 400 12px var(--ops-font, sans-serif);
    color: var(--ops-text, #0b1220);
}

/* The table scrolls inside its own card. A table wider than the panel used to push a scrollbar
   across the whole drawer, which moved the footer buttons along with it. */
.ddc-tabbody .sc-panel-table-wrap {
    max-width: 100%;
    overflow-x: auto;
    background: var(--ops-surface, #fff);
    border-radius: 12px;
}

/* One line per row — but only inside a box that scrolls, never in the key/value tables.

   An unbounded Description column stretched FIM rows to roughly 140px each, so four events filled
   the panel. Applying the cure to every .csp-table was too broad: the Overview and Detail tables in
   the General tab use the same class, and stopping them from wrapping pushed values like
   "HP EliteBook 845 G7 Notebook PC" past the edge of the panel where they were simply cut off.
   These three wrappers are the ones that scroll horizontally, so nothing is lost inside them. */
.ddc-tabbody .sc-panel-table-wrap .csp-table td,
.ddc-tabbody .hwt-table-box .csp-table td,
.ddc-tabbody .swt-table-scroll .csp-table td {
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ddc-tabbody .sc-panel-empty,
.ddc-tabbody .sc-panel-loading {
    padding: 28px 16px;
    text-align: center;
    font-size: 12.5px;
    color: var(--ops-muted, #5b6577);
    background: var(--ops-surface, #fff);
    border-radius: 12px;
}

.ddc-tabbody .sc-count-label {
    font-size: 11.5px;
    color: var(--ops-muted, #5b6577);
}

/* The file-type tree sat bare on the page ground between two cards, so it read as loose debris
   rather than as one of the tab's parts. */
.ddc-tabbody .sc-filetree-split {
    display: flex;
    gap: 12px;
    min-width: 0;
}

.ddc-tabbody .sc-filetree {
    padding: 8px 10px;
    background: var(--ops-surface, #fff);
    border-radius: 12px;
    flex: 0 0 auto;
}

.ddc-tabbody .sc-filetree-main {
    min-width: 0;
    flex: 1;
}

/* The pager is a block of the panel like any other, so it sits in its own card — except when it is
   already inside a filter row, which is a card itself. */
.ddc-tabbody .csp-pager {
    padding: 8px 10px;
    background: var(--ops-surface, #fff);
    border-radius: 12px;
}

.ddc-tabbody .sc-panel-filter-row .csp-pager {
    width: 100%;
    padding: 0;
    background: transparent;
}

/* ── Drawer tab controls (ported from the approved mock) ──────────────────────
   The "dvt-" prefix is deliberate: "dv-" already belongs to the device sidebar in this same file. */

/* Segmented switch. Two plain text buttons side by side gave no sign of which one was active
   beyond a colour; lifting the selected one onto a white surface says it structurally. */
.ddc-tabbody .dvt-seg {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px;
    border-radius: 8px;
    background: var(--ops-bg, #f6f7f9);
}

.ddc-tabbody .dvt-seg-b {
    border: 0;
    border-radius: 6px;
    padding: 5px 10px;
    background: transparent;
    font: 500 12px var(--ops-font, sans-serif);
    color: var(--ops-muted, #5b6577);
    white-space: nowrap;
    cursor: pointer;
    transition: background .12s, color .12s;
}

.ddc-tabbody .dvt-seg-b:hover { color: var(--ops-text-2, #3b4252); }

.ddc-tabbody .dvt-seg-b.is-on {
    background: var(--ops-surface, #fff);
    color: var(--ops-text, #0b1220);
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .10);
}

/* Filter chip: an uppercase label welded to its value. The select inside keeps every native
   behaviour and simply loses its own chrome. */
.ddc-tabbody .dvt-filt {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 30px;
    padding: 0 8px 0 10px;
    border: 1px solid var(--ops-border, #e6e8ec);
    border-radius: 8px;
    background: var(--ops-surface, #fff);
    white-space: nowrap;
    cursor: pointer;
}

.ddc-tabbody .dvt-filt:hover { background: var(--ops-surface-2, #f8fafc); }

.ddc-tabbody .dvt-filt-l {
    font: 600 10.5px var(--ops-font, sans-serif);
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--ops-muted-2, #8b94a3);
}

.ddc-tabbody .dvt-filt select {
    appearance: none;
    -webkit-appearance: none;
    border: 0;
    outline: 0;
    padding: 0 15px 0 0;
    background: transparent
        url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b94a3' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E")
        no-repeat right center / 11px 11px;
    font: 400 12px var(--ops-font, sans-serif);
    color: var(--ops-text-2, #3b4252);
    cursor: pointer;
}

/* Search field with the magnifier inside it, rather than a bare box that looks like every other
   input in the row. */
.ddc-tabbody .dvt-search {
    display: flex;
    align-items: center;
    gap: 7px;
    height: 30px;
    padding: 0 10px;
    border: 1px solid var(--ops-border, #e6e8ec);
    border-radius: 8px;
    background: var(--ops-surface, #fff);
    color: var(--ops-muted-2, #8b94a3);
    flex: 1 1 150px;
    min-width: 130px;
    max-width: 260px;
}

.ddc-tabbody .dvt-search svg { width: 14px; height: 14px; flex-shrink: 0; }

.ddc-tabbody .dvt-search input {
    border: 0;
    outline: 0;
    background: transparent;
    font: 400 12.5px var(--ops-font, sans-serif);
    color: var(--ops-text, #0b1220);
    width: 100%;
    min-width: 0;
}

.ddc-tabbody .dvt-tb-sp { flex: 1 1 auto; }

.ddc-tabbody .dvt-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 30px;
    padding: 0 11px;
    border: 1px solid var(--ops-border, #e6e8ec);
    border-radius: 8px;
    background: var(--ops-surface, #fff);
    color: var(--ops-text-2, #3b4252);
    font: 500 12px var(--ops-font, sans-serif);
    white-space: nowrap;
    cursor: pointer;
    transition: background .12s, color .12s, border-color .12s;
}

.ddc-tabbody .dvt-btn svg { width: 14px; height: 14px; color: var(--ops-muted, #5b6577); }
.ddc-tabbody .dvt-btn:hover { background: var(--ops-surface-2, #f8fafc); color: var(--ops-text, #0b1220); }

.ddc-tabbody .dvt-btn-danger,
.ddc-tabbody .dvt-btn-danger svg { color: var(--ops-danger, #b91c1c); }

.ddc-tabbody .dvt-btn-danger:hover {
    background: var(--ops-danger-soft, #fef2f2);
    color: var(--ops-danger, #b91c1c);
    border-color: transparent;
}

.ddc-tabbody .dvt-btn:disabled { opacity: .6; cursor: default; }

/* A destructive button asking in place (Change tab ▸ Clear): the question, then Clear and Cancel. */
.ddc-tabbody .dvt-confirm { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ddc-tabbody .dvt-confirm-lbl { font: 600 12px var(--ops-font, sans-serif); color: var(--ops-danger, #b91c1c); }

/* FIM keeps its own two-way switch; give it the same segmented look so the panel does not carry
   two different idioms for the same kind of control. */
.ddc-tabbody .sc-subtab {
    border: 0;
    border-radius: 6px;
    padding: 5px 10px;
    background: transparent;
    font: 500 12px var(--ops-font, sans-serif);
    color: var(--ops-muted, #5b6577);
    white-space: nowrap;
    cursor: pointer;
}

.ddc-tabbody .sc-subtab.active {
    background: var(--ops-primary-50, #eef2ff);
    color: var(--ops-primary, #4f46e5);
    font-weight: 600;
}

/* ── Count inside the segmented switch ───────────────────────────────────── */
.ddc-tabbody .dvt-cnt {
    margin-left: 6px;
    font-weight: 600;
    color: var(--ops-muted-2, #8b94a3);
}

.ddc-tabbody .dvt-seg-b.is-on .dvt-cnt { color: var(--ops-muted, #5b6577); }

/* ── Baseline Compare (Change ▸ Baseline Compare) ────────────────────────────
   What the machine has gained, lost and had changed since its saved original: a card per kind of
   difference, coloured by it and counted, each item a title over one line of detail. The tables it
   had were wider than the panel and scrolled inside boxes that scrolled inside the panel. */
.ddc-tabbody .dvt-bl {
    --dvt-bl-tone: var(--ops-muted, #5b6577);
    --dvt-bl-soft: var(--ops-bg, #f6f7f9);
    padding: 10px 12px 6px;
    background: var(--ops-surface, #fff);
    border-radius: 12px;
    border-left: 3px solid var(--dvt-bl-tone);
}

.ddc-tabbody .dvt-bl.is-found   { --dvt-bl-tone: var(--ops-success, #15803d); --dvt-bl-soft: var(--ops-success-soft, #dcfce7); }
.ddc-tabbody .dvt-bl.is-lost    { --dvt-bl-tone: var(--ops-danger, #b91c1c);  --dvt-bl-soft: var(--ops-danger-soft, #fee2e2); }
.ddc-tabbody .dvt-bl.is-changed { --dvt-bl-tone: var(--ops-warning, #b45309); --dvt-bl-soft: var(--ops-warning-soft, #fef3c7); }

.ddc-tabbody .dvt-bl-h {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 4px;
    font: 600 12.5px var(--ops-font, sans-serif);
    color: var(--ops-text, #0b1220);
}

.ddc-tabbody .dvt-bl-mark {
    display: inline-grid;
    place-items: center;
    width: 18px;
    height: 18px;
    border-radius: 5px;
    background: var(--dvt-bl-soft);
    color: var(--dvt-bl-tone);
    font-weight: 700;
    line-height: 1;
}

.ddc-tabbody .dvt-bl-n {
    margin-left: auto;
    min-width: 22px;
    padding: 1px 8px;
    border-radius: 99px;
    background: var(--dvt-bl-soft);
    color: var(--dvt-bl-tone);
    font-size: 11.5px;
    text-align: center;
}

/* Everything below the header lines up with the title, past the mark (18px + the 8px gap). */
.ddc-tabbody .dvt-bl-none {
    padding: 2px 0 6px 26px;
    font-size: 12px;
    color: var(--ops-muted, #5b6577);
}

.ddc-tabbody .dvt-bl-kind {
    margin: 10px 0 2px 26px;
    font: 600 10.5px var(--ops-font, sans-serif);
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--ops-muted-2, #8b94a3);
}

.ddc-tabbody .dvt-bl-kn { margin-left: 6px; color: var(--ops-muted, #5b6577); }

.ddc-tabbody .dvt-bl-row {
    margin-left: 26px;
    padding: 6px 0;
}

.ddc-tabbody .dvt-bl-row + .dvt-bl-row { border-top: 1px solid var(--ops-border-soft, #eef0f3); }

.ddc-tabbody .dvt-bl-t {
    font-size: 12.5px;
    color: var(--ops-text, #0b1220);
    overflow-wrap: anywhere;
}

.ddc-tabbody .dvt-bl-d {
    margin-top: 1px;
    font-size: 11.5px;
    color: var(--ops-muted, #5b6577);
    overflow-wrap: anywhere;
}

.ddc-tabbody .dvt-bl-was {
    color: var(--ops-muted-2, #8b94a3);
    text-decoration: line-through;
}

.ddc-tabbody .dvt-bl-more {
    margin: 2px 0 4px 26px;
    padding: 2px 0;
    border: 0;
    background: transparent;
    color: var(--ops-primary, #4f46e5);
    font: 500 12px var(--ops-font, sans-serif);
    cursor: pointer;
}

.ddc-tabbody .dvt-bl-more:hover { text-decoration: underline; }

/* ── Expanding rows ──────────────────────────────────────────────────────────
   Ten columns in a 600px panel meant half of them were always off screen, and the two hash columns
   squeezed to 100px were unreadable even when you scrolled to them. Five columns carry the scan;
   the row opens for the rest. */
.ddc-tabbody .dvt-exp .dvt-row { cursor: pointer; }
.ddc-tabbody .dvt-exp .dvt-row:hover { background: var(--ops-bg, #f6f7f9); }
.ddc-tabbody .dvt-exp .dvt-row.is-open { background: var(--ops-primary-50, #eef2ff); }

.ddc-tabbody .dvt-exp-c { width: 26px; padding-right: 0 !important; }

.ddc-tabbody .dvt-chev {
    width: 12px;
    height: 12px;
    color: var(--ops-faint, #b7bdc8);
    transition: transform .12s;
}

.ddc-tabbody .dvt-row.is-open .dvt-chev {
    transform: rotate(90deg);
    color: var(--ops-primary, #4f46e5);
}

.ddc-tabbody .dvt-num { text-align: right; font-variant-numeric: tabular-nums; }

/* File name on top, full path beneath it: the name is what you scan for, the path is what you read
   when a row looks wrong. */
.ddc-tabbody .dvt-path { white-space: normal !important; max-width: 320px !important; }
.ddc-tabbody .dvt-path-name { display: block; font-weight: 500; color: var(--ops-text, #0b1220); }

.ddc-tabbody .dvt-path-dir {
    display: block;
    font-size: 11px;
    color: var(--ops-muted-2, #8b94a3);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Severity ── */
.ddc-tabbody .dvt-sev {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .03em;
    color: var(--ops-muted, #5b6577);
}

.ddc-tabbody .dvt-sev-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

.ddc-tabbody .dvt-sev-critical { color: var(--ops-danger, #b91c1c); }
.ddc-tabbody .dvt-sev-high { color: #c2410c; }
.ddc-tabbody .dvt-sev-warning { color: var(--ops-warning, #b45309); }

/* ── The opened row ── */
.ddc-tabbody .dvt-detail > td {
    white-space: normal !important;
    max-width: none !important;
    overflow: visible !important;
    padding: 2px 10px 12px !important;
    background: var(--ops-bg, #f6f7f9);
}

.ddc-tabbody .dvt-kv {
    display: grid;
    grid-template-columns: 132px minmax(0, 1fr);
    gap: 4px 12px;
    margin: 0;
    font-size: 12px;
}

.ddc-tabbody .dvt-kv dt { color: var(--ops-muted, #5b6577); }

.ddc-tabbody .dvt-kv dd {
    margin: 0;
    min-width: 0;
    color: var(--ops-text, #0b1220);
}

/* Hashes and registry paths have no spaces to break at, so they need to be told they may break
   mid-token — otherwise one value stretches the whole panel. */
.ddc-tabbody .dvt-kv dd.dvt-brk { overflow-wrap: anywhere; }

/* ── Toolbar count and plain filter input ───────────────────────────────── */
.ddc-tabbody .dvt-count {
    font-size: 12px;
    color: var(--ops-muted, #5b6577);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.ddc-tabbody .dvt-filter-in {
    height: 30px;
    width: 150px;
    min-width: 0;
    padding: 0 10px;
    border: 1px solid var(--ops-border, #e6e8ec);
    border-radius: 8px;
    background: var(--ops-surface, #fff);
    font: 400 12px var(--ops-font, sans-serif);
    color: var(--ops-text, #0b1220);
}

/* ── Empty state that says why ──────────────────────────────────────────────
   "No files found" alone cannot tell you whether the machine has no files or has never been
   scanned — two different situations with two different remedies. */
.ddc-tabbody .dvt-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 34px 18px !important;
}

.ddc-tabbody .dvt-empty-ico {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin-bottom: 2px;
    border-radius: 50%;
    background: var(--ops-bg, #f6f7f9);
    color: var(--ops-muted-2, #8b94a3);
}

.ddc-tabbody .dvt-empty-ico svg { width: 21px; height: 21px; }

.ddc-tabbody .dvt-empty-t {
    font-size: 13px;
    font-weight: 600;
    color: var(--ops-text, #0b1220);
}

.ddc-tabbody .dvt-empty-s {
    max-width: 380px;
    font-size: 12px;
    line-height: 1.5;
    color: var(--ops-muted, #5b6577);
}

.ddc-tabbody .dvt-empty .dvt-btn { margin-top: 6px; }

/* ── File-type chips ──────────────────────────────────────────────────────
   They wrap rather than scroll: an endpoint that reports twenty file types should show twenty
   choices on two lines, not nineteen hidden behind a sideways drag. */
.ddc-tabbody .dvt-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    min-width: 0;
}

.ddc-tabbody .dvt-chip {
    height: 26px;
    padding: 0 11px;
    border: 1px solid transparent;
    border-radius: 99px;
    background: var(--ops-bg, #f6f7f9);
    font: 500 11.5px var(--ops-font, sans-serif);
    color: var(--ops-muted, #5b6577);
    white-space: nowrap;
    cursor: pointer;
    transition: background .12s, color .12s;
}

.ddc-tabbody .dvt-chip:hover { color: var(--ops-text-2, #3b4252); }

.ddc-tabbody .dvt-chip.is-on {
    background: var(--ops-primary-50, #eef2ff);
    color: var(--ops-primary, #4f46e5);
    font-weight: 600;
}

.ddc-tabbody .dvt-fileinv-main { min-width: 0; }

/* ── กล่องติดตั้งเอเจนต์ ────────────────────────────────────────────────────────────
   ตารางตรวจความพร้อมและตารางผลติดตั้งใช้หน้าตาเดียวกัน ต่างกันแค่คอลัมน์ */
.agi-row   { display: flex; align-items: center; gap: 10px; }
.agi-row label { font: 500 12px var(--ops-font); color: var(--ops-text-2); white-space: nowrap; }
.agi-row select { flex: 0 1 240px; }

.agi-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.agi-table th {
    text-align: left; padding: 6px 8px; font-weight: 600;
    color: var(--ops-text-2); border-bottom: 1px solid var(--ops-border-soft);
    white-space: nowrap;
}
.agi-table td { padding: 6px 8px; border-bottom: 1px solid var(--ops-border-soft); color: var(--ops-text); }
.agi-table tr:last-child td { border-bottom: none; }

.agi-mono  { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.agi-ok    { color: var(--ops-success, #16a34a); }
.agi-no    { color: var(--ops-danger, #dc2626); }
.agi-busy  { color: var(--ops-primary); }
.agi-muted { color: var(--ops-muted); }

.agi-note {
    padding: 8px 10px; border-radius: 6px; font-size: 12.5px;
    background: var(--ops-surface-2); color: var(--ops-text-2);
}
.agi-note--warn {
    background: color-mix(in srgb, var(--ops-danger, #dc2626) 10%, transparent);
    color: var(--ops-text);
}

/* รายการเมนูที่กดไม่ได้ — ต้องยังอ่านออกว่ามีอะไรอยู่ ไม่ใช่จางจนหาไม่เจอ */
.dv-dropdown-item--disabled { opacity: .45; cursor: not-allowed; }
.dv-dropdown-item--disabled:hover { background: transparent; color: inherit; }
.dv-modal--agi { width: min(820px, 94vw); }
.agi-scroll { overflow-x: auto; }

/* ── รายชื่อเครื่องที่คำสั่งจะไปถึง (Execute Command + กล่องเตือนสิทธิ์) ──────────────
   ตัดจำนวนชื่อด้วยงบตัวอักษรฝั่ง C# แล้ว ความสูงตรงนี้เป็นตาข่ายกันพลาดชั้นที่สอง:
   ถ้าประมาณความกว้างต่อบรรทัดคลาดไป ของจะถูกตัดแทนที่จะดันของข้างล่างหาย
   --dv-exec-lines มาจากฝั่ง Razor จะได้ไม่ต้องแก้สองที่เวลาเปลี่ยนจำนวนบรรทัด */
.dv-exec-targets { margin-bottom: 10px; }
.dv-exec-filter  { margin-bottom: 6px; }

.dv-exec-names {
    font-size: 11.5px;
    line-height: 1.55;
    max-height: calc(var(--dv-exec-lines, 5) * 1.55em);
    overflow: hidden;
}
.dv-exec-namelist {
    font-family: var(--ops-font-mono);
    color: var(--ops-text-2, #334155);
}
/* ตัวสรุปท้ายรายการอ่านเป็นคำ ไม่ใช่ชื่อเครื่อง จึงไม่ควรหน้าตาเหมือนกัน */
.dv-exec-more {
    margin-left: 6px;
    font-weight: 600;
    color: var(--ops-muted);
}

/* The host page's buttons above the machine table — where the Machines card kept them. */
.dr-toolbar { margin-bottom: 10px; }

/* A count that is one digit most of the time reads better centred under its heading than pushed
   against the next column's edge. */
.csp-table th.rs-mid, .csp-table td.rs-mid { text-align: center; }

/* The second line of counts: lighter than the outcomes above it, because it answers a question
   about them rather than standing beside them. */
.dp-count--sub { min-width: 0; padding: 4px 10px; }
.dp-count--sub .dp-count-l { font-size: 11px; }

/* ── Deploying, broken open ───────────────────────────────────────────────────────────────────
   One strip, not three more cards. Three tiles under three tiles read as six outcomes however the
   numbers add up — equal cards say equal things, and the eye believes the layout over the labels.
   So this is drawn as a thing that belongs to the card above it: the Deploying yellow, a line up
   to that card, and plus signs between the counts to say they add up to it. */
.dr-substrip {
    grid-column: 1 / -1;
    position: relative;
    margin-top: 14px;
    padding: 5px 6px;
    display: flex; align-items: stretch; gap: 2px;
    border: 1px solid #fde68a;
    border-radius: 10px;
    background: #fffbeb;
}

/* The tie to the card above. Centred on the grid, which is where the Deploying card is. */
.dr-substrip::before {
    content: "";
    position: absolute;
    left: 50%; top: -14px;
    width: 1px; height: 14px;
    background: #fcd34d;
}

.dr-substrip .dp-count {
    flex: 1;
    background: none;
    border-radius: 7px;
}
.dr-substrip .dp-count:hover   { background: rgba(234, 179, 8, 0.14); }
.dr-substrip .dp-count.is-on   { background: rgba(234, 179, 8, 0.22); box-shadow: inset 0 -2px 0 0 #ca8a04; }
.dr-substrip .dp-count-n       { font-size: 15px; color: #ca8a04; }
.dr-substrip .dp-count-l       { color: #a98a2b; }

/* The arithmetic, said out loud. Light enough not to compete with the numbers it joins. */
.dr-sub-plus {
    display: flex; align-items: center;
    font: 600 12px var(--ops-font-mono, monospace);
    color: #dcc278;
}

/* The report's counts: the three outcomes, and under them the three steps that stopped machines.

   One grid of six rather than two rows laid beside each other, because the columns have to agree.
   Two rows measured separately come out at two sets of widths and the second line sits half under
   the first. inline-grid keeps the block the width of its own cards instead of the page's, and the
   equal columns come from 1fr measured inside that. */
.dr-count-grid {
    display: inline-grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px 6px;
}

/* A count that only reports. Same card as the one beside it, without the pointer and the lift on
   hover — both of those are a promise that pressing it will do something, and these two have
   nothing to do when pressed. */
.dp-count--flat { cursor: default; }
.dp-count--flat:hover { background: var(--ops-surface-2, #f5f6fa); }

/* A step this machine never reached. Said in the step's own place rather than by leaving the step
   out: a missing heading reads as a report that forgot to mention something. */
.dr-step-none {
    padding: 10px 2px 2px;
    font: 400 12px var(--ops-font, sans-serif);
    color: var(--ops-muted-2, #8a90a6);
}

/* The way into the long story, beside the verdict it belongs to rather than under the table.

   Written out here rather than borrowed from .csp-icon-btn, which this page does not load — the
   report pulls in managedevice-page.css and tool-page.css, and that class lives in a third
   stylesheet. A class name that happens to match an unloaded rule looks right in the markup and
   draws nothing.

   Smaller than the standard icon button so it sits inside a table row without setting the row's
   height, and on the baseline beside the verdict chip rather than above it. */
.dr-history-btn {
    width: 24px; height: 24px; padding: 0;
    vertical-align: middle; margin-left: 10px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--ops-border-soft, #eef0f6);
    border-radius: 6px;
    background: none;
    color: var(--ops-muted-2, #8a90a6);
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
}
.dr-history-btn:hover {
    background: var(--ops-surface-2, #f5f6fa);
    color: var(--ops-text, #191c28);
    border-color: var(--ops-border, #e3e6ef);
}
.dr-history-btn:focus-visible { outline: 2px solid var(--ops-primary, #4f46e5); outline-offset: 1px; }

/* The files table does not light up under the pointer.

   Nothing in a row of it is clickable — the one thing to press is the timeline button, and that
   button belongs to all five rows at once. A row that highlights promises it can be opened, and
   with the timeline cell spanning the whole table the highlight lands on whichever row the pointer
   happens to be level with rather than the one it is pointing at. The button has its own hover,
   which is the only thing here that answers to one. */
.dr-filetable tbody tr:hover td { background: transparent; }

/* The story's pager. Left to right: which lines these are, back, where you are, forward. */
.dr-pager {
    justify-content: flex-start;
    gap: 10px;
    font: 400 12px var(--ops-font, sans-serif);
    color: var(--ops-text-2, #4b5565);
}
.dr-pager button {
    min-width: 26px; height: 24px; padding: 0 7px;
    border: 1px solid var(--ops-border-soft, #eef0f6);
    border-radius: 6px;
    background: none; font: inherit; cursor: pointer; color: inherit;
}
.dr-pager button:hover:enabled { background: var(--ops-surface-2, #f5f6fa); }
.dr-pager button:disabled { opacity: .4; cursor: default; }
