﻿/* Minimal utility-like styles when Tailwind is absent */
.tw-grid {
    display: grid;
    gap: 2px
}

.tw-flex {
    display: flex
}

.tw-items-center {
    align-items: center
}

.tw-justify-between {
    justify-content: space-between
}

.tw-h-full {
    height: 100%
}

.tw-w-full {
    width: 100%
}

.tw-rounded-2xl {
    border-radius: 1rem
}

.tw-rounded-lg {
    border-radius: .5rem
}

.tw-border {
    border: 1px solid rgba(100,116,139,.35)
}

.tw-shadow {
    box-shadow: 0 6px 24px -10px rgba(2,6,23,.25)
}

.tw-p-2 {
    padding: .5rem
}

.tw-p-3 {
    padding: .75rem
}

.tw-p-4 {
    padding: 1rem
}

.tw-gap-2 {
    gap: .5rem
}

.tw-gap-3 {
    gap: .75rem
}

.tw-bg-700 {
    background: #334155
}

.tw-bg-800 {
    background: #1f2937
}

.tw-text {
    color: #e5e7eb
}

.tw-hover:hover {
    background: #374151
}

.ellipsis {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap
}

.tile {
    position: relative; /* fix for overlay */
    min-height: 0;
    background: #0b1220;
    border-radius: .25rem;
    overflow: hidden
}

    .tile video, .tile iframe, .tile canvas {
        width: 100%;
        height: 100%;
        display: block;
        background: #000
    }

.tile-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: .95rem
}

.tile-toolbar {
    position: absolute;
    top: 6px;
    right: 6px;
    display: flex;
    gap: 6px;
    z-index: 20
}

    .tile-toolbar button, .tile-toolbar select {
        background: rgba(15,23,42,.75);
        color: #e5e7eb;
        border: 1px solid rgba(148,163,184,.25);
        border-radius: .5rem;
        font-size: .85rem;
        padding: .15rem .4rem
    }

.tile-header {
    position: absolute;
    left: 8px;
    top: 6px;
    z-index: 20;
    color: #e5e7eb;
    background: rgba(15,23,42,.65);
    padding: .1rem .4rem;
    border-radius: .4rem;
    max-width: 70%
}

.tile-error {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: grid;
    place-items: center;
    background: rgba(2,6,23,.6);
    color: #fecaca;
    font-size: .95rem;
    padding: 1rem
}

.drop-target {
    outline: 1px dashed rgba(74,144,217,.35);
    outline-offset: -4px
}

.drop-over {
    outline-color: #60a5fa;
    background: rgba(59,130,246,.06)
}

/* ===== Bottom toolbar (Hikvision-style) ===== */
.wall-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #1a1a2e;
    border-top: 1px solid rgba(148,163,184,.15);
    padding: .35rem .75rem;
    flex-shrink: 0;
    min-height: 40px;
}

.wall-toolbar-left {
    display: flex;
    align-items: center;
    gap: 0;
}

.wall-toolbar-right {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.wall-tab {
    background: none;
    border: none;
    color: #8b8fa3;
    font-size: .85rem;
    padding: .35rem .85rem;
    cursor: pointer;
    transition: color .2s;
    font-weight: 500;
    letter-spacing: .02em;
    position: relative;
}
    .wall-tab:hover {
        color: #c0c4d6;
    }
    .wall-tab.active {
        color: #e5e7eb;
    }
    .wall-tab.active::after {
        content: '';
        position: absolute;
        left: .85rem;
        right: .85rem;
        bottom: 0;
        height: 2px;
        background: #4a90d9;
        border-radius: 1px;
    }

.wall-actions {
    display: flex;
    align-items: center;
    gap: .15rem;
}

.wall-icon-btn {
    background: none;
    border: none;
    color: #8b8fa3;
    font-size: .9rem;
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: .35rem;
    cursor: pointer;
    transition: color .2s, background .2s;
}
    .wall-icon-btn:hover {
        color: #e5e7eb;
        background: rgba(255,255,255,.08);
    }

.wall-search {
    display: flex;
    align-items: center;
    gap: .4rem;
    background: rgba(74,144,217,.18);
    border: 1px solid rgba(74,144,217,.35);
    border-radius: 1rem;
    padding: .2rem .65rem .2rem .5rem;
    color: #a0b4d0;
    font-size: .78rem;
    cursor: pointer;
    transition: background .2s;
}
    .wall-search:hover {
        background: rgba(74,144,217,.28);
    }
    .wall-search i {
        font-size: .7rem;
    }
    .wall-search-label {
        font-weight: 500;
        letter-spacing: .03em;
    }

.wall-layout-icons {
    display: flex;
    align-items: center;
    gap: .3rem;
    margin-left: .25rem;
}

.wall-grid-icon {
    background: none;
    border: 1px solid transparent;
    color: #6b7280;
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: .3rem;
    cursor: pointer;
    padding: 0;
    transition: color .2s, border-color .2s;
}
    .wall-grid-icon:hover {
        color: #c0c4d6;
        border-color: rgba(148,163,184,.25);
    }
    .wall-grid-icon.active {
        color: #4a90d9;
        border-color: rgba(74,144,217,.45);
    }

/* Fullscreen mode for the entire wall section */
#wallSection.wall-fullscreen {
    background: #0b1220;
}

#wallSection.wall-fullscreen #wall {
    height: 100%;
}

#wallSection:fullscreen {
    display: flex;
    flex-direction: column;
}

/* Legacy layout-btn kept for JS compat */
.layout-btn {
    border: 1px solid rgba(148,163,184,.35);
    background: rgba(2,6,23,.35);
    color: #e5e7eb;
    border-radius: .5rem;
    padding: .3rem .5rem
}

    .layout-btn.active {
        border-color: #60a5fa;
        box-shadow: 0 0 0 2px rgba(96,165,250,.25) inset
    }

.maximized {
    position: fixed !important;
    z-index: 50;
    inset: .75rem;
    border-radius: 1rem;
    background: #000
}

/* Debug panel inside tile */
.tile-debug {
    position: absolute;
    left: 8px;
    right: 8px;
    bottom: 8px;
    z-index: 30;
    background: rgba(2,6,23,.85);
    border: 1px solid rgba(148,163,184,.35);
    border-radius: .5rem;
    max-height: 45%;
    overflow: hidden;
    color: #e5e7eb;
    font-size: 12px;
}

.tile-debug-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .25rem .5rem;
    border-bottom: 1px solid rgba(148,163,184,.25);
    background: rgba(15,23,42,.6);
    font-weight: 600;
}

    .tile-debug-head button {
        background: rgba(30,41,59,.7);
        color: #e5e7eb;
        border: 1px solid rgba(148,163,184,.25);
        border-radius: .35rem;
        font-size: .8rem;
        padding: .1rem .4rem;
    }

.tile-debug-body {
    margin: 0;
    padding: .5rem .6rem;
    max-height: calc(45% - 30px);
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* Always-visible Debug FAB inside each tile */
.tile-debug-fab {
    position: absolute;
    left: 8px;
    bottom: 8px;
    z-index: 35; /* מעל הוידאו וה-Overlay */
    background: rgba(30,41,59,.9);
    color: #93c5fd;
    border: 1px solid rgba(148,163,184,.35);
    border-radius: .5rem;
    padding: .2rem .45rem;
    font-weight: 700;
    line-height: 1;
}

    .tile-debug-fab:hover {
        background: rgba(51,65,85,.95);
    }

/* אם אתה רוצה שהכפתור בסרגל גם יהיה מודגש */
.tile-toolbar .btn-dbg {
    color: #93c5fd;
    font-weight: 700;
}

/* Record button */
.tile-toolbar .btn-rec {
    color: #64748b;      /* grey when idle — not recording */
    font-size: .65rem;
    padding: 0 .3rem;
    transition: color .2s;
}
.tile-toolbar .btn-rec:hover {
    color: #f87171;      /* hint red on hover */
}
.tile-toolbar .btn-rec i {
    /* no transition — animation takes over when active */
}
.tile-toolbar .btn-rec.rec-active {
    color: #ef4444;
}
.tile-toolbar .btn-rec.rec-active i {
    animation: rec-pulse 1s ease-in-out infinite;
}
@keyframes rec-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: .2; }
}

/* ===================================================================
   Playback-mode bottom panel (Hikvision-style timeline + transport)
   =================================================================== */

/* --- Playback panel container --- */
.pb-panel {
    flex-shrink: 0;
    background: #0d1526;
    border-top: 1px solid rgba(148,163,184,.15);
    display: flex;
    flex-direction: column;
}

/* --- Timeline ruler area --- */
.pb-timeline-wrap {
    position: relative;
    background: #0f1a2e;
    padding: 0;
}

.pb-timeline {
    position: relative;
    height: 32px;
    cursor: crosshair;
    overflow: hidden;
}

.pb-timeline-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.pb-playhead {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #4a90d9;
    pointer-events: none;
    z-index: 5;
    left: 50%;
    box-shadow: 0 0 4px rgba(74,144,217,.6);
}

.pb-timeline-date {
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 6px;
    color: #94a3b8;
    font-size: 11px;
    pointer-events: none;
    white-space: nowrap;
    z-index: 6;
}

.pb-timeline-date i {
    font-size: 10px;
}

/* --- Transport controls bar --- */
.pb-controls {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .3rem .75rem;
    background: #111827;
    border-top: 1px solid rgba(148,163,184,.1);
    min-height: 36px;
}

.pb-controls-left {
    display: flex;
    align-items: center;
}

.pb-ptz-toggle {
    background: none;
    border: 1px solid rgba(148,163,184,.2);
    border-radius: .3rem;
    color: #8b8fa3;
    font-size: .75rem;
    padding: .2rem .5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: .3rem;
    transition: color .2s, border-color .2s;
}
.pb-ptz-toggle:hover {
    color: #e5e7eb;
    border-color: rgba(148,163,184,.35);
}
.pb-ptz-toggle.active {
    color: #4a90d9;
    border-color: rgba(74,144,217,.45);
}

.pb-controls-center-left {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-left: auto;
}

.pb-source-dropdown {
    position: relative;
    display: flex;
    align-items: center;
}
.pb-source-dropdown select {
    appearance: none;
    background: rgba(30,41,59,.7);
    border: 1px solid rgba(148,163,184,.2);
    border-radius: .35rem;
    color: #cbd5e1;
    font-size: .75rem;
    padding: .25rem 1.5rem .25rem .5rem;
    cursor: pointer;
}
.pb-source-dropdown i {
    position: absolute;
    right: .5rem;
    pointer-events: none;
    font-size: .6rem;
    color: #64748b;
}

.pb-action-icons {
    display: flex;
    align-items: center;
    gap: .1rem;
}

.pb-icon-btn {
    background: none;
    border: none;
    color: #64748b;
    font-size: .8rem;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: .3rem;
    cursor: pointer;
    transition: color .2s, background .2s;
}
.pb-icon-btn:hover {
    color: #e5e7eb;
    background: rgba(255,255,255,.06);
}

/* --- Transport buttons --- */
.pb-transport {
    display: flex;
    align-items: center;
    gap: .15rem;
    margin-left: auto;
}

.pb-transport-btn {
    background: none;
    border: none;
    color: #8b8fa3;
    font-size: .85rem;
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: .3rem;
    cursor: pointer;
    transition: color .2s, background .2s;
}
.pb-transport-btn:hover {
    color: #e5e7eb;
    background: rgba(255,255,255,.06);
}
.pb-transport-play {
    color: #e5e7eb;
    font-size: .95rem;
}
.pb-speed-label {
    font-size: .7rem;
    font-weight: 600;
    color: #94a3b8;
    min-width: 30px;
    text-align: center;
}

/* --- PTZ panel (fly-out, bottom-left) --- */
.pb-ptz-panel {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 200px;
    background: #111827;
    border: 1px solid rgba(148,163,184,.2);
    border-radius: 0 .5rem 0 0;
    z-index: 40;
    box-shadow: 4px -4px 16px rgba(0,0,0,.3);
}

.pb-ptz-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .35rem .6rem;
    border-bottom: 1px solid rgba(148,163,184,.15);
    color: #e5e7eb;
    font-size: .8rem;
    font-weight: 600;
}

.pb-ptz-close {
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    font-size: .75rem;
}
.pb-ptz-close:hover { color: #e5e7eb; }

.pb-ptz-body {
    padding: .75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .5rem;
}

.pb-ptz-dpad {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.pb-ptz-dpad-mid {
    display: flex;
    align-items: center;
    gap: 2px;
}

.pb-ptz-dir {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(30,41,59,.6);
    border: 1px solid rgba(148,163,184,.2);
    border-radius: .35rem;
    color: #94a3b8;
    font-size: .9rem;
    cursor: pointer;
    transition: color .2s, background .2s;
}
.pb-ptz-dir:hover {
    color: #e5e7eb;
    background: rgba(74,144,217,.15);
}
.pb-ptz-home {
    font-size: .7rem;
}

.pb-ptz-zoom {
    display: flex;
    gap: .3rem;
}

.pb-ptz-zbtn {
    width: 36px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(30,41,59,.6);
    border: 1px solid rgba(148,163,184,.2);
    border-radius: .35rem;
    color: #94a3b8;
    font-size: .7rem;
    cursor: pointer;
    transition: color .2s, background .2s;
}
.pb-ptz-zbtn:hover {
    color: #e5e7eb;
    background: rgba(74,144,217,.15);
}

/* Playback-mode tile placeholder */
.tile-pb-placeholder {
    position: absolute;
    inset: 0;
    z-index: 25; /* above tile-header(20), tile-toolbar(20), tile-error(10) */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #0b1220;
    color: #94a3b8;
    font-size: 1.1rem;
    gap: .25rem;
    user-select: none;
}
.tile-pb-placeholder .pb-ch-name {
    font-weight: 500;
    color: #cbd5e1;
}
.tile-pb-placeholder .pb-ch-status {
    font-size: .85rem;
    color: #64748b;
}

/* Active (selected) tile in playback mode */
.tile.pb-active {
    outline: 2px solid #4a90d9;
    outline-offset: -2px;
}

/* ===================================================================
   Per-tile PTZ — floating draggable window
   (CSS copied from Player.cshtml so the disc looks identical)
   =================================================================== */
.tile-ptz-win {
    position: fixed;
    z-index: 9999;
    width: 240px;
    background: linear-gradient(160deg, #1e293b 0%, #0f172a 100%);
    border: 1px solid rgba(148,163,184,.18);
    border-radius: 1rem;
    box-shadow: 0 12px 40px rgba(2,6,23,.7);
    color: #e2e8f0;
    user-select: none;
    -webkit-user-select: none;
    overflow: hidden;
}

.tile-ptz-win-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .65rem .75rem .5rem;
    cursor: grab;
}
.tile-ptz-win-header:active { cursor: grabbing; }

.tile-ptz-win-title {
    font-size: .82rem;
    font-weight: 500;
    color: #cbd5e1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 168px;
}

.tile-ptz-win-close {
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    font-size: .8rem;
    line-height: 1;
    padding: .1rem .2rem;
    flex-shrink: 0;
    transition: color .15s;
}
.tile-ptz-win-close:hover { color: #e2e8f0; }

.tile-ptz-win-body {
    padding: .2rem .75rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .85rem;
}

/* ---- D-pad: exact copy of .player-ptz-dpad from Player.cshtml ---- */
.tile-ptz-dpad {
    position: relative;
    width: 112px;
    height: 112px;
    --ptz-diag-ring-offset: 22px;
    border-radius: 9999px;
    border: 1px solid rgba(148,163,184,.24);
    background:
        radial-gradient(circle at center, rgba(51,65,85,.96) 0 23px, rgba(15,23,42,.92) 24px 55px, rgba(51,65,85,.6) 56px 100%);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 8px 18px rgba(2,6,23,.35);
    flex-shrink: 0;
}

/* shared btn reset */
.tile-ptz-dpad button {
    user-select: none;
    -webkit-user-select: none;
}

/* cardinal */
.tile-ptz-dpad .ptz-dir {
    position: absolute;
    width: 34px;
    height: 34px;
    border: 1px solid rgba(148,163,184,.28);
    border-radius: 10px;
    background: linear-gradient(180deg, rgba(71,85,105,.95), rgba(30,41,59,.95));
    color: #dbeafe;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: transform .12s ease, background-color .12s ease, border-color .12s ease;
    touch-action: none;
    cursor: pointer;
}
.tile-ptz-dpad .ptz-dir:hover, .tile-ptz-dpad .ptz-dir.ptz-active {
    background: linear-gradient(180deg, rgba(37,99,235,.92), rgba(29,78,216,.92));
    border-color: rgba(96,165,250,.8);
}
.tile-ptz-dpad .ptz-up    { top:8px; left:50%; transform:translateX(-50%); }
.tile-ptz-dpad .ptz-down  { bottom:8px; left:50%; transform:translateX(-50%); }
.tile-ptz-dpad .ptz-left  { left:8px; top:50%; transform:translateY(-50%); }
.tile-ptz-dpad .ptz-right { right:8px; top:50%; transform:translateY(-50%); }
.tile-ptz-dpad .ptz-up:hover    { transform:translateX(-50%) scale(1.04); }
.tile-ptz-dpad .ptz-down:hover  { transform:translateX(-50%) scale(1.04); }
.tile-ptz-dpad .ptz-left:hover  { transform:translateY(-50%) scale(1.04); }
.tile-ptz-dpad .ptz-right:hover { transform:translateY(-50%) scale(1.04); }
.tile-ptz-dpad .ptz-up.ptz-active    { transform:translateX(-50%); }
.tile-ptz-dpad .ptz-down.ptz-active  { transform:translateX(-50%); }
.tile-ptz-dpad .ptz-left.ptz-active  { transform:translateY(-50%); }
.tile-ptz-dpad .ptz-right.ptz-active { transform:translateY(-50%); }

/* diagonal */
.tile-ptz-dpad .ptz-diag {
    width: 20px;
    height: 20px;
    border-radius: 7px;
    padding: 0;
}
.tile-ptz-dpad .ptz-diag .diag-chevron { font-size:9px; line-height:1; transform-origin:center; }
.tile-ptz-dpad .ptz-up-left  { top:50%; left:50%; transform:translate(calc(-50% - var(--ptz-diag-ring-offset)), calc(-50% - var(--ptz-diag-ring-offset))); }
.tile-ptz-dpad .ptz-up-right { top:50%; left:50%; transform:translate(calc(-50% + var(--ptz-diag-ring-offset)), calc(-50% - var(--ptz-diag-ring-offset))); }
.tile-ptz-dpad .ptz-down-left  { top:50%; left:50%; transform:translate(calc(-50% - var(--ptz-diag-ring-offset)), calc(-50% + var(--ptz-diag-ring-offset))); }
.tile-ptz-dpad .ptz-down-right { top:50%; left:50%; transform:translate(calc(-50% + var(--ptz-diag-ring-offset)), calc(-50% + var(--ptz-diag-ring-offset))); }
.tile-ptz-dpad .ptz-up-left .diag-chevron  { transform:rotate(45deg); }
.tile-ptz-dpad .ptz-up-right .diag-chevron { transform:rotate(135deg); }
.tile-ptz-dpad .ptz-down-left .diag-chevron  { transform:rotate(-45deg); }
.tile-ptz-dpad .ptz-down-right .diag-chevron { transform:rotate(-135deg); }
.tile-ptz-dpad .ptz-up-left:hover  { transform:translate(calc(-50% - var(--ptz-diag-ring-offset)), calc(-50% - var(--ptz-diag-ring-offset))) scale(1.04); }
.tile-ptz-dpad .ptz-up-right:hover { transform:translate(calc(-50% + var(--ptz-diag-ring-offset)), calc(-50% - var(--ptz-diag-ring-offset))) scale(1.04); }
.tile-ptz-dpad .ptz-down-left:hover  { transform:translate(calc(-50% - var(--ptz-diag-ring-offset)), calc(-50% + var(--ptz-diag-ring-offset))) scale(1.04); }
.tile-ptz-dpad .ptz-down-right:hover { transform:translate(calc(-50% + var(--ptz-diag-ring-offset)), calc(-50% + var(--ptz-diag-ring-offset))) scale(1.04); }

/* centre stop/home */
.tile-ptz-dpad .ptz-center {
    position: absolute;
    inset: 50% auto auto 50%;
    transform: translate(-50%, -50%);
    width: 36px;
    height: 36px;
    border-radius: 9999px;
    border: 1px solid rgba(148,163,184,.38);
    background: radial-gradient(circle at 35% 30%, rgba(148,163,184,.45), rgba(51,65,85,.9));
    color: #e2e8f0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    cursor: pointer;
    transition: transform .12s ease, filter .12s ease;
}
.tile-ptz-dpad .ptz-center:hover  { filter:brightness(1.1); transform:translate(-50%,-50%) scale(1.05); }
.tile-ptz-dpad .ptz-center:active { transform:translate(-50%,-50%) scale(.96); }

/* ---- zoom row ---- */
.tile-ptz-zoom-row {
    display: flex;
    align-items: center;
    gap: .5rem;
    width: 100%;
    justify-content: center;
}

.tile-ptz-zoom-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #94a3b8;
    flex: 1;
    text-align: center;
}

.tile-ptz-zbtn {
    width: 36px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(30,41,59,.6);
    border: 1px solid rgba(148,163,184,.2);
    border-radius: .35rem;
    color: #94a3b8;
    font-size: .7rem;
    cursor: pointer;
    transition: color .15s, background .15s;
    touch-action: none;
}
.tile-ptz-zbtn:hover,
.tile-ptz-zbtn.ptz-active {
    color: #dbeafe;
    background: rgba(37,99,235,.55);
    border-color: rgba(96,165,250,.6);
}

.tile-ptz-preset-shortcut {
    height: 28px;
    border: 1px solid rgba(96,165,250,.55);
    border-radius: .35rem;
    background: rgba(29,78,216,.44);
    color: #dbeafe;
    font-size: 10px;
    line-height: 1;
    padding: 0 .45rem;
    display: inline-flex;
    align-items: center;
    gap: .26rem;
    cursor: pointer;
    transition: filter .12s, border-color .12s, background .12s;
}

.tile-ptz-preset-shortcut:hover,
.tile-ptz-preset-shortcut.active {
    border-color: rgba(147,197,253,.9);
    background: rgba(37,99,235,.72);
    filter: brightness(1.06);
}

/* ---- speed slider: exact copy from Player.cshtml ---- */
.tile-ptz-speed-wrap {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: .25rem;
}

.tile-ptz-speed-label {
    font-size: 10px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #94a3b8;
    text-align: center;
}

.tile-ptz-speed-row {
    display: grid;
    grid-template-columns: auto minmax(100px,1fr) auto;
    align-items: center;
    gap: .45rem;
    color: #a8b4ca;
    font-size: 10px;
}

.tile-ptz-speed-slider {
    width: 100%;
    accent-color: #3b82f6;
    cursor: pointer;
}

.tile-ptz-speed-value {
    text-align: center;
    font-size: 10px;
    color: #cbd5e1;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* ---- PTZ presets list ---- */
.tile-ptz-presets-wrap {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: .35rem;
    padding-top: .25rem;
    border-top: 1px solid rgba(148,163,184,.18);
}

.tile-ptz-presets-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.tile-ptz-presets-head-actions {
    display: inline-flex;
    align-items: center;
    gap: .24rem;
}

.tile-ptz-presets-label {
    font-size: 10px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #94a3b8;
}

.tile-ptz-refresh-presets {
    width: 24px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(148,163,184,.28);
    border-radius: .35rem;
    background: rgba(30,41,59,.7);
    color: #cbd5e1;
    cursor: pointer;
    font-size: 10px;
    transition: background .12s, border-color .12s;
}
.tile-ptz-refresh-presets:hover {
    background: rgba(37,99,235,.45);
    border-color: rgba(96,165,250,.75);
}

.tile-ptz-go-group-preset {
    height: 22px;
    border: 1px solid rgba(52,211,153,.45);
    border-radius: .35rem;
    background: rgba(5,150,105,.45);
    color: #d1fae5;
    font-size: 10px;
    line-height: 1;
    padding: 0 .42rem;
    cursor: pointer;
}

.tile-ptz-go-group-preset:hover {
    filter: brightness(1.08);
}

.tile-ptz-group-context {
    font-size: 10px;
    color: #93c5fd;
    line-height: 1.25;
}

.tile-ptz-targets-wrap {
    display: flex;
    flex-direction: column;
    gap: .22rem;
    border: 1px solid rgba(148,163,184,.2);
    border-radius: .4rem;
    background: rgba(15,23,42,.45);
    padding: .3rem .34rem;
}

.tile-ptz-targets-label {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: #94a3b8;
}

.tile-ptz-targets-list {
    display: flex;
    flex-direction: column;
    gap: .18rem;
}

.tile-ptz-target-item {
    display: inline-flex;
    align-items: center;
    gap: .32rem;
    font-size: 10px;
    color: #dbeafe;
}

.tile-ptz-target-item input[type="checkbox"] {
    width: 12px;
    height: 12px;
    accent-color: #3b82f6;
    cursor: pointer;
}

.tile-ptz-target-item input[type="checkbox"]:disabled {
    cursor: default;
}

.tile-ptz-targets-empty {
    font-size: 10px;
    color: #64748b;
}

.tile-ptz-presets-create {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: .35rem;
}

.tile-ptz-preset-name {
    min-width: 0;
    height: 26px;
    border-radius: .35rem;
    border: 1px solid rgba(148,163,184,.3);
    background: rgba(15,23,42,.86);
    color: #e2e8f0;
    font-size: 11px;
    padding: 0 .45rem;
}

.tile-ptz-preset-name:focus {
    outline: none;
    border-color: rgba(96,165,250,.85);
    box-shadow: 0 0 0 1px rgba(96,165,250,.35);
}

.tile-ptz-save-preset {
    height: 26px;
    border: 1px solid rgba(16,185,129,.45);
    border-radius: .35rem;
    background: rgba(6,95,70,.88);
    color: #d1fae5;
    font-size: 11px;
    padding: 0 .55rem;
    cursor: pointer;
    transition: filter .12s;
}

.tile-ptz-save-preset:hover {
    filter: brightness(1.1);
}

.tile-ptz-save-preset:disabled,
.tile-ptz-refresh-presets:disabled,
.tile-ptz-go-group-preset:disabled,
.tile-ptz-preset-btn:disabled {
    opacity: .45;
    cursor: default;
    filter: none;
}

.tile-ptz-presets-list {
    display: flex;
    flex-direction: column;
    gap: .25rem;
    max-height: 132px;
    overflow: auto;
    padding-right: 2px;
}

.tile-ptz-presets-empty {
    font-size: 10px;
    color: #64748b;
    text-align: center;
    padding: .28rem 0;
}

.tile-ptz-preset-row {
    display: flex;
    align-items: center;
    gap: .35rem;
    border: 1px solid rgba(148,163,184,.22);
    border-radius: .4rem;
    background: rgba(15,23,42,.6);
    padding: .22rem .32rem;
}

.tile-ptz-preset-row.group-default {
    border-color: rgba(52,211,153,.5);
    background: rgba(4,120,87,.24);
}

.tile-ptz-preset-main {
    flex: 1;
    min-width: 0;
}

.tile-ptz-preset-title {
    font-size: 11px;
    color: #dbeafe;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tile-ptz-preset-coords {
    margin-top: 1px;
    font-size: 9px;
    color: #93c5fd;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.tile-ptz-preset-actions {
    display: inline-flex;
    align-items: center;
    gap: .22rem;
}

.tile-ptz-preset-btn {
    min-width: 28px;
    height: 22px;
    border: 1px solid rgba(148,163,184,.28);
    border-radius: .35rem;
    background: rgba(30,41,59,.75);
    color: #e2e8f0;
    font-size: 10px;
    cursor: pointer;
}

.tile-ptz-preset-btn.goto {
    border-color: rgba(96,165,250,.6);
    background: rgba(30,64,175,.55);
}

.tile-ptz-preset-btn.bind {
    border-color: rgba(52,211,153,.55);
    background: rgba(6,95,70,.7);
    color: #d1fae5;
}

.tile-ptz-preset-btn.remove {
    border-color: rgba(248,113,113,.45);
    background: rgba(127,29,29,.55);
}

.tile-ptz-presets-status {
    min-height: 12px;
    font-size: 10px;
    line-height: 1.25;
    color: #94a3b8;
}

.tile-ptz-presets-status.error {
    color: #fca5a5;
}

/* ===================================================================
   Per-tile Mini Playback overlay  (z-55, over live video inside tile)
   =================================================================== */
.tile-pb-mini {
    position: absolute;
    inset: 0;
    z-index: 55;
    background: #000;
    display: flex;
    flex-direction: column;
    color: #e5e7eb;
}

.tile-pb-mini-header {
    display: flex;
    align-items: center;
    gap: .4rem;
    padding: .3rem .5rem;
    border-bottom: 1px solid rgba(148,163,184,.18);
    background: rgba(15,23,42,.8);
    font-size: .78rem;
    font-weight: 600;
    flex-shrink: 0;
    z-index: 5;
}

.tile-pb-mini-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tile-pb-mini-close {
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    font-size: .9rem;
    line-height: 1;
    padding: .1rem .25rem;
    flex-shrink: 0;
}
.tile-pb-mini-close:hover { color: #e5e7eb; }

.tile-pb-mini-video-wrap {
    flex: 1;
    min-height: 0;
    position: relative;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tile-pb-mini-video-wrap video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
    display: block;
}

.tile-pb-mini-black {
    position: absolute;
    inset: 0;
    background: #000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    color: #334155;
    font-size: .82rem;
    z-index: 2;
}
.tile-pb-mini-black i { font-size: 1.5rem; }

.tile-pb-mini-checking {
    position: absolute;
    inset: 0;
    background: #000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    color: #64748b;
    font-size: .8rem;
    z-index: 3;
}

.tile-pb-mini-bottom {
    flex-shrink: 0;
    background: rgba(10,16,30,.96);
    border-top: 1px solid rgba(148,163,184,.14);
    padding: .32rem .45rem;
    display: flex;
    flex-direction: column;
    gap: .24rem;
}

.tile-pb-mini-bar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .45rem;
    min-height: 12px;
    font-size: .61rem;
    color: #64748b;
}

.tile-pb-mini-bar-tools {
    display: flex;
    align-items: center;
    gap: .28rem;
    flex-wrap: wrap;
}

.tile-pb-mini-zbtn {
    background: rgba(30,41,59,.72);
    color: #cbd5e1;
    border: 1px solid rgba(148,163,184,.25);
    border-radius: .32rem;
    font-size: .58rem;
    line-height: 1.1;
    padding: .14rem .34rem;
    cursor: pointer;
    transition: border-color .12s, background .12s, color .12s;
}
.tile-pb-mini-zbtn:hover {
    border-color: rgba(147,197,253,.55);
    color: #e2e8f0;
    background: rgba(37,99,235,.3);
}
.tile-pb-mini-zbtn.active {
    color: #dbeafe;
    border-color: rgba(96,165,250,.8);
    background: rgba(37,99,235,.55);
}
.tile-pb-mini-zbtn:disabled {
    opacity: .45;
    cursor: default;
}

.tile-pb-mini-jump-time {
    height: 20px;
    min-width: 92px;
    background: rgba(15,23,42,.8);
    color: #e2e8f0;
    border: 1px solid rgba(148,163,184,.25);
    border-radius: .32rem;
    font-size: .6rem;
    padding: 0 .3rem;
    font-variant-numeric: tabular-nums;
}
.tile-pb-mini-jump-time:focus {
    outline: none;
    border-color: rgba(96,165,250,.85);
    box-shadow: 0 0 0 1px rgba(96,165,250,.35);
}

.tile-pb-mini-go {
    min-width: 32px;
}

.tile-pb-mini-bar-status {
    color: #94a3b8;
    font-variant-numeric: tabular-nums;
}

/* Last-2-hours timeline bar */
.tile-pb-mini-segments {
    position: relative;
    height: 14px;
    border-radius: 999px;
    border: 1px solid rgba(59,130,246,.25);
    background:
        linear-gradient(90deg, rgba(59,130,246,.06) 0%, rgba(14,165,233,.08) 100%),
        rgba(30,41,59,.9);
    min-height: 14px;
    overflow: hidden;
    cursor: pointer;
    touch-action: none;
}

.tile-pb-mini-segments.dragging {
    cursor: ew-resize;
}

.tile-pb-mini-segments.marking,
.tile-pb-mini-segments.marking.dragging {
    cursor: crosshair;
}

.tile-pb-mini-seg-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}

.tile-pb-mini-mark-band {
    position: absolute;
    top: 1px;
    height: calc(100% - 2px);
    border: 1px dashed rgba(191,219,254,.95);
    border-radius: 999px;
    background: rgba(59,130,246,.22);
    pointer-events: none;
    z-index: 3;
}

.tile-pb-mini-seg {
    position: absolute;
    top: 1px;
    height: calc(100% - 2px);
    min-width: 2px;
    border: none;
    border-radius: 999px;
    background: linear-gradient(180deg, #60a5fa, #2563eb);
    pointer-events: none;
    opacity: 0.8;
    transition: opacity .12s, filter .12s;
    padding: 0;
    z-index: 2;
}
.tile-pb-mini-seg:hover,
.tile-pb-mini-seg.active {
    opacity: 1;
    filter: brightness(1.12);
    box-shadow: 0 0 0 1px rgba(191,219,254,.95) inset;
}

.tile-pb-mini-seg.is-live {
    background: linear-gradient(180deg, #fbbf24, #d97706);
    box-shadow: 0 0 0 1px rgba(253,224,71,.55) inset;
}

.tile-pb-mini-bar-dot {
    position: absolute;
    top: 50%;
    left: 100%;
    width: 12px;
    height: 12px;
    transform: translate(-50%, -50%);
    border-radius: 999px;
    border: 1.5px solid #bfdbfe;
    background: linear-gradient(180deg, #38bdf8, #0284c7);
    box-shadow: 0 1px 5px rgba(0,0,0,.5);
    cursor: ew-resize;
    padding: 0;
    z-index: 4;
}

.tile-pb-mini-segments.dragging .tile-pb-mini-bar-dot,
.tile-pb-mini-bar-dot:hover {
    transform: translate(-50%, -50%) scale(1.08);
}

.tile-pb-mini-axis {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #64748b;
    font-size: .58rem;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.tile-pb-mini-axis-mid {
    opacity: .85;
}

/* Transport bar */
.tile-pb-mini-timeline {
    padding: .05rem .05rem .1rem;
}

.tile-pb-mini-scrubber {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    border-radius: 2px;
    cursor: pointer;
    outline: none;
    background: linear-gradient(
        to right,
        #3b82f6 0%,
        #3b82f6 var(--pb-fill, 0%),
        rgba(148,163,184,.2) var(--pb-fill, 0%)
    );
}
.tile-pb-mini-scrubber::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #93c5fd;
    border: 1.5px solid #1d4ed8;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0,0,0,.5);
}
.tile-pb-mini-scrubber::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #93c5fd;
    border: 1.5px solid #1d4ed8;
    cursor: pointer;
}
.tile-pb-mini-scrubber::-webkit-slider-track {
    height: 4px;
    border-radius: 2px;
}
.tile-pb-mini-scrubber:hover::-webkit-slider-thumb {
    background: #bfdbfe;
    transform: scale(1.2);
}

/* Transport bar */
.tile-pb-mini-transport {
    display: flex;
    align-items: center;
    gap: .3rem;
    min-height: 22px;
}

.tile-pb-mini-tbtn {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: .75rem;
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: .3rem;
    padding: 0;
    transition: color .12s, background .12s;
}
.tile-pb-mini-tbtn:hover {
    color: #e5e7eb;
    background: rgba(255,255,255,.07);
}

.tile-pb-mini-time {
    margin-left: auto;
    font-size: .68rem;
    color: #64748b;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}