/* ============ HERO (pola portal) ============ */
.hero-section {
  position: relative; overflow: hidden;
  padding: calc(var(--header-height) + 70px) 0 90px;
  background: linear-gradient(140deg, #05122b 0%, #0a2a5e 45%, #123f8f 100%);
}
.hero-bg-grid {
  position: absolute; inset: 0; opacity: .5;
  background-image:
    linear-gradient(rgba(108, 172, 228, .16) 1px, transparent 1px),
    linear-gradient(90deg, rgba(108, 172, 228, .16) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(ellipse at 50% 40%, #000 30%, transparent 78%);
}
.hero-bg-overlay {
  position: absolute; inset: 0;
  background:
    radial-gradient(60% 55% at 78% 20%, rgba(203, 160, 82, .22), transparent 65%),
    radial-gradient(45% 60% at 12% 85%, rgba(0, 71, 187, .5), transparent 70%);
}
.hero-content { position: relative; z-index: 2; max-width: 860px; }
.hero-glass {
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .16);
  backdrop-filter: blur(16px);
  border-radius: 26px; padding: clamp(26px, 4vw, 46px);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .35);
}
.hero-headline {
  font-size: clamp(30px, 5.4vw, 58px); font-weight: 700;
  text-transform: uppercase; color: #fff; margin: 20px 0 16px; line-height: 1.15;
}
.hero-subheadline { color: rgba(233, 238, 248, .82); font-size: clamp(15px, 1.6vw, 17.5px); max-width: 640px; }
.hero-cta-group { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin-top: 26px; }
.hero-video-btn {
  display: inline-flex; align-items: center; gap: 13px;
  background: transparent; border: 0; color: #fff; padding: 6px 4px; text-align: left;
}
.hero-video-btn-play {
  width: 50px; height: 50px; border-radius: 50%;
  background: var(--color-gold); display: grid; place-items: center;
  color: #4a3312; box-shadow: 0 0 0 6px rgba(203, 160, 82, .2);
  transition: transform .2s ease;
}
.hero-video-btn:hover .hero-video-btn-play { transform: scale(1.07); }
.hero-video-btn-label { display: block; font-family: var(--font-head); font-weight: 600; font-size: 15px; }
.hero-video-btn-sub { display: block; font-size: 12.5px; color: rgba(233, 238, 248, .6); }

/* ============ STATS ============ */
.stats-section { margin-top: -46px; position: relative; z-index: 5; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.stat-card { padding: 24px; text-align: center; }
.stat-number {
  display: block; font-family: var(--font-head); font-weight: 700;
  font-size: clamp(28px, 3.4vw, 42px); color: var(--color-primary);
}
[data-theme="dark"] .stat-number { color: var(--color-horizon); }
.stat-label { font-size: 13.5px; color: var(--text-soft); }

/* ============ TENTANG ============ */
.about-section { padding: 84px 0 0; }
.about-lead { font-size: 16.5px; }
.tentang-compact-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.tentang-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 28px;
  box-shadow: var(--shadow-sm); display: flex; flex-direction: column;
  transition: transform .2s ease, box-shadow .2s ease;
}
.tentang-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-md); }
.tentang-card-title { font-size: 15px; letter-spacing: .1em; text-transform: uppercase; color: var(--color-primary); margin-bottom: 10px; }
[data-theme="dark"] .tentang-card-title { color: var(--color-horizon); }
.tentang-card-copy { color: var(--text-soft); font-size: 14.5px; flex: 1; }
.tentang-card-btn { align-self: flex-start; font-size: 13.5px; padding: 9px 16px; }
.tentang-card-sejarah { border-top: 4px solid var(--color-primary); }
.tentang-card-visi { border-top: 4px solid var(--color-gold); }
.tentang-card-ikhlas { border-top: 4px solid var(--color-horizon); }

/* ============ KARTU KANAL (pola kartu prodi) ============ */
.prodi-section { padding: 84px 0 0; }
.prodi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.prodi-card { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.prodi-card-header { padding: 20px 22px 0; }
.prodi-header-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.prodi-badge { font-size: 11px; padding: 4px 11px; }
.prodi-abbr {
  font-family: var(--font-head); font-weight: 700; font-size: 12.5px;
  letter-spacing: .1em; color: var(--text-faint);
}
.prodi-card-title { font-size: 19px; margin: 14px 0 2px; }
.prodi-title-ar { color: var(--color-gold-earth); font-size: 14px; }
.prodi-card-copy { padding: 0 22px; color: var(--text-soft); font-size: 14.3px; flex: 1; }
.prodi-card-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 22px; border-top: 1px dashed var(--border); background: var(--surface-2);
}
.prodi-link {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: 0; color: var(--color-primary);
  font-family: var(--font-head); font-weight: 600; font-size: 13.5px;
}
[data-theme="dark"] .prodi-link { color: var(--color-horizon); }
.prodi-link:hover { text-decoration: underline; }

/* pratinjau mini kamera */
.cam-mini {
  position: relative; aspect-ratio: 16 / 9; background: var(--video-bg);
  border-bottom: 1px solid var(--border);
}
.cam-mini canvas { width: 100%; height: 100%; }

/* ============ TABS ============ */
.ekosistem-section { padding: 84px 0 0; }
.tab-nav-wrapper { display: flex; justify-content: center; margin-bottom: 26px; }
.tab-list {
  display: inline-flex; flex-wrap: wrap; gap: 6px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; box-shadow: var(--shadow-sm);
}
.tab-btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 0; background: transparent; color: var(--text-soft);
  font-family: var(--font-head); font-weight: 600; font-size: 14px;
  padding: 9px 18px; border-radius: 999px; transition: background .18s, color .18s;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.is-active { background: var(--color-primary); color: #fff; box-shadow: 0 6px 18px rgba(0, 71, 187, .3); }
.tab-panels-container { position: relative; }
.tab-panel { display: none; }
.tab-panel.is-active { display: block; animation: panelIn .3s ease; }
@keyframes panelIn { from { opacity: 0; transform: translateY(10px); } }
.ekosistem-card { display: grid; grid-template-columns: 1.5fr 1fr; gap: 30px; align-items: center; }
.ekosistem-info-badge { font-size: 11.5px; }
.ekosistem-title { font-size: clamp(19px, 2.4vw, 26px); text-transform: uppercase; margin: 14px 0 10px; }
.ekosistem-copy { color: var(--text-soft); }
.ekosistem-tags { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 16px; }
.ekosistem-tag-item {
  font-size: 13px; padding: 6px 13px; border-radius: 999px;
  background: var(--bg-soft); border: 1px solid var(--border); color: var(--text-soft);
}
.ekosistem-visual-box {
  background: linear-gradient(150deg, rgba(0, 71, 187, .1), rgba(203, 160, 82, .14));
  border: 1px dashed var(--border-strong); border-radius: var(--radius);
  padding: 28px; text-align: center;
}
.ekosistem-visual-icon { width: 54px; height: 54px; margin: 0 auto 14px; color: var(--color-primary); stroke-width: 1.4; }
.ekosistem-visual-title { font-size: 14.5px; letter-spacing: .08em; text-transform: uppercase; }
.ekosistem-visual-text { font-size: 14px; color: var(--text-soft); margin: 0; }

/* ============ BERITA / AKTIVITAS ============ */
.berita-section { padding: 84px 0 90px; }
.berita-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; }
.berita-card {
  display: flex; gap: 16px; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm);
  transition: transform .18s ease;
}
.berita-card:hover { transform: translateY(-3px); }
.berita-thumb {
  width: 92px; height: 62px; border-radius: 10px; flex: none;
  background: var(--video-bg); overflow: hidden; position: relative;
}
.berita-thumb canvas { width: 100%; height: 100%; }
.berita-meta { font-size: 12px; color: var(--text-faint); letter-spacing: .05em; text-transform: uppercase; }
.berita-title { font-size: 15.5px; margin: 5px 0 4px; }
.berita-title a { color: var(--text); }
.berita-title a:hover { color: var(--color-primary); }
.section-cta { text-align: center; margin-top: 34px; }

/* ============ LIVE GRID ============ */
.live-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(2, 1fr);
}
.live-grid[data-cols="1"] { grid-template-columns: 1fr; max-width: none; gap: 8px; }
.live-grid[data-cols="4"] { grid-template-columns: repeat(2, 1fr); }
.live-grid[data-cols="6"] { grid-template-columns: repeat(3, 1fr); }
.live-grid[data-cols="9"] { grid-template-columns: repeat(3, 1fr); }

.tile {
  position: relative; background: var(--video-bg);
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; aspect-ratio: 16 / 9;
  box-shadow: var(--shadow-sm); transition: box-shadow .2s ease, border-color .2s ease;
  contain: strict;
}
.tile:hover { box-shadow: var(--shadow-md); border-color: rgba(108, 172, 228, .5); }
.tile.is-offline { border-color: rgba(198, 40, 40, .5); }
.tile canvas { width: 100%; height: 100%; }
.tile.is-expanded {
  position: fixed; inset: 0; z-index: 110; aspect-ratio: auto;
  width: 100vw; height: 100vh; border-radius: 0; margin: 0;
  box-shadow: none; background: #000;
  display: flex; align-items: center; justify-content: center;
}
.tile.is-expanded .tile-img,
.tile.is-expanded canvas {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
}
.tile-backdrop {
  position: fixed; inset: 0; z-index: 109; background: rgba(4, 8, 16, .78);
  backdrop-filter: blur(3px); display: none;
}
.tile-backdrop.is-open { display: block; }

.tile-osd-top, .tile-osd-bottom {
  position: absolute; left: 0; right: 0; z-index: 5;
  display: flex;
  align-items: center; justify-content: space-between; gap: 8px;
  padding: 9px 11px; font-size: 12px; color: var(--osd);
  background: linear-gradient(180deg, rgba(3, 8, 16, .78), transparent);
  pointer-events: none;
}
.tile-osd-top { top: 0; }
.tile-osd-bottom {
  bottom: 0; background: linear-gradient(0deg, rgba(3, 8, 16, .8), transparent);
  pointer-events: auto;
}
.tile-name { font-family: var(--font-head); font-weight: 600; letter-spacing: .05em; }
.tile-chip {
  font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 6px; background: rgba(255, 255, 255, .14);
}
.tile-status { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--color-success); box-shadow: 0 0 0 3px rgba(46, 125, 50, .3); }
.dot.is-off { background: var(--color-danger); box-shadow: 0 0 0 3px rgba(198, 40, 40, .3); }
.dot.is-rec { background: #e53935; box-shadow: 0 0 0 3px rgba(229, 57, 53, .3); animation: blink 1.1s infinite; }
@keyframes blink { 50% { opacity: .35; } }
.tile-clock { font-variant-numeric: tabular-nums; letter-spacing: .06em; }
.tile-actions { display: flex; gap: 6px; }
.tile-btn {
  width: 30px; height: 26px; display: grid; place-items: center;
  border-radius: 7px; border: 1px solid rgba(255, 255, 255, .2);
  background: rgba(255, 255, 255, .1); color: #fff;
  transition: background .15s ease;
}
.tile-btn:hover { background: var(--color-primary); border-color: var(--color-primary); }
.tile-btn.is-active { background: #c62828; border-color: #c62828; }
.tile-btn .icon { width: 14px; height: 14px; }
.tile-motion {
  position: absolute; top: 44px; right: 11px;
  background: rgba(198, 40, 40, .92); color: #fff;
  font-family: var(--font-head); font-size: 11px; letter-spacing: .1em;
  padding: 4px 10px; border-radius: 7px; opacity: 0; transform: translateY(-6px);
  transition: opacity .2s ease, transform .2s ease;
}
.tile-motion.is-on { opacity: 1; transform: translateY(0); }
.tile-offline-label {
  position: absolute; inset: 0; display: grid; place-content: center;
  text-align: center; color: #e57373; font-family: var(--font-head);
  letter-spacing: .12em; font-size: 13px; gap: 8px;
}
.tile-nostream {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 40%, rgba(30, 40, 52, .9), #0a0f16 70%);
  color: #8fa0b3; font-family: var(--font-head); font-size: 11px;
  letter-spacing: .14em; text-transform: uppercase; text-align: center; padding: 12px;
}
/* ---- Mode atur posisi ubin live ---- */
.live-grid.is-arranging .tile { cursor: grab; }
.live-grid.is-arranging .tile::after {
  content: ''; position: absolute; inset: 0; z-index: 4;
  border: 2px dashed rgba(108, 172, 228, .85); border-radius: var(--radius);
  pointer-events: none;
}
.live-grid.is-arranging .tile.is-dragging { opacity: .5; }
.live-grid.is-arranging .tile.drop-target::after {
  border-style: solid; border-color: #2e7d32;
  box-shadow: inset 0 0 0 3px rgba(46, 125, 50, .35);
}
.live-grid.is-arranging .tile-actions,
.live-grid.is-arranging .tile-motion { display: none; }
.tile-slot {
  position: absolute; z-index: 6; top: 9px; right: 11px;
  font-family: var(--font-head); font-size: 11px; font-weight: 700;
  color: #fff; background: rgba(0, 71, 187, .9);
  border-radius: 999px; padding: 2px 9px; letter-spacing: .04em;
}
.tile-movebar {
  position: absolute; z-index: 6; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  display: flex; align-items: center; gap: 4px;
  background: rgba(3, 8, 16, .72); border-radius: 999px; padding: 5px 7px;
  backdrop-filter: blur(3px);
}
.tile-grip { color: #cfe0f5; font-size: 13px; line-height: 1; padding: 0 2px; cursor: grab; }
.tile-mbtn {
  width: 27px; height: 27px; display: grid; place-items: center;
  border-radius: 50%; border: 1px solid rgba(255, 255, 255, .22);
  background: rgba(255, 255, 255, .12); color: #fff;
  font-size: 10px; line-height: 1; cursor: pointer;
  transition: background .15s ease;
}
.tile-mbtn:hover, .tile-mbtn:focus-visible { background: var(--color-primary); border-color: var(--color-primary); }
.arrange-hint { color: var(--color-primary); font-weight: 500; }

/* ---- Gambar asli kamera fisik di atas canvas simulasi ---- */
.tile-img {
  position: absolute; inset: 0; z-index: 3;
  width: 100%; height: 100%; object-fit: cover; background: #000;
}
video.tile-img { object-fit: cover; }
/* Sembunyikan canvas simulasi saat stream asli sudah tersambung atau gagal, agar tidak muncul video simulasi. */
.tile.is-stream-ok canvas { display: none; }
.tile.is-stream-fail canvas { display: none; }
.tile.is-focus { outline: 3px solid #f59e0b; outline-offset: -3px; box-shadow: 0 0 0 4px rgba(245,158,11,.35); z-index: 5; }
.tile-stream { position: absolute; z-index: 6; left: 11px; bottom: 9px; pointer-events: none; }
.tile-stream span {
  display: none; font-family: var(--font-head); font-size: 10.5px; font-weight: 700;
  letter-spacing: .08em; padding: 3px 9px; border-radius: 999px; color: #fff;
}
.tile.is-stream-ok .tile-stream-ok { display: inline-block; background: rgba(46, 125, 50, .92); }
.tile.is-stream-fail .tile-stream-fail { display: inline-block; background: rgba(198, 40, 40, .92); }

/* ---- Form kamera: tes koneksi stream ---- */
.cam-test-result { font-size: 13px; color: var(--text-faint); }
.cam-test-result.is-ok { color: var(--color-success, #2e7d32); font-weight: 600; }
.cam-test-result.is-err { color: var(--color-danger, #c62828); font-weight: 600; }
.form-note { font-size: 12.5px; color: var(--text-faint); margin: 4px 0 0; }
.form-note.is-warn { color: var(--color-danger); font-weight: 600; }

/* ---- Penemuan kamera di jaringan ---- */
.modal-wide { width: min(820px, 100%); }
.modal-wide .modal-body { max-height: 68vh; overflow-y: auto; }
.discover-fields .field { flex: 1 1 190px; min-width: 0; }
.discover-actions {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
  margin: 14px 0 10px;
}
.discover-status { font-size: 12.5px; color: var(--text-faint); }
.discover-status.is-err { color: var(--color-danger); font-weight: 600; }
.discover-list {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-soft); overflow: hidden;
}
.discover-empty {
  padding: 18px 16px; font-size: 13px; color: var(--text-faint); line-height: 1.55;
}
.discover-item {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 14px;
  padding: 13px 15px; border-bottom: 1px solid var(--border);
}
.discover-item:last-child { border-bottom: 0; }
.discover-item.is-known { opacity: .62; }
.discover-main { min-width: 0; flex: 1; }
.discover-main strong { display: block; color: var(--text); font-size: 14px; line-height: 1.35; }
.discover-main small { display: block; margin-top: 3px; color: var(--text-faint); font-size: 12px; }
.discover-main code {
  display: block; margin-top: 6px; padding: 5px 7px; border-radius: 6px;
  background: rgba(0, 0, 0, .22); color: var(--text-soft);
  font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.discover-main .discover-note { display: block; margin-top: 5px; color: var(--text-faint); font-size: 11.5px; line-height: 1.4; }
.discover-tags { display: inline-flex; flex-wrap: wrap; gap: 4px; margin-left: 6px; vertical-align: middle; }
.discover-tag {
  display: inline-block; padding: 2px 6px; border-radius: 999px;
  background: var(--bg-soft); border: 1px solid var(--border);
  color: var(--text-faint); font-size: 10px; font-weight: 700; letter-spacing: .04em;
}
.discover-tag.is-onvif { color: var(--color-gold); border-color: var(--color-gold); }
.discover-item .btn { flex: 0 0 auto; }
.discover-item .btn:disabled { opacity: .55; cursor: not-allowed; }
@media (max-width: 640px) {
  .discover-item { flex-direction: column; }
  .discover-item .btn { width: 100%; }
}

/* ---- Mode tamu: hanya grid live ---- */
body.is-guest .guest-hide { display: none !important; }

body.guest-live-only .site-header,
body.guest-live-only .site-footer,
body.guest-live-only .guest-bar,
body.guest-live-only #page-live .page-head > div:first-child,
body.guest-live-only #page-live .live-hint {
  display: none !important;
}
body.guest-live-only #page-live {
  padding-top: 0;
}
body.guest-live-only #page-live .container-wide {
  max-width: none;
  padding: 0;
}
body.guest-live-only .guest-live-login {
  display: inline-flex;
}
.guest-live-login {
  display: none;
  position: fixed;
  bottom: 14px;
  right: 14px;
  z-index: 100;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--color-gold, #c9a227);
  color: #111;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 6px 18px rgba(0,0,0,.25);
}

/* Kelompok IP: tag di kolom alamat & kode CIDR */
.ip-group-tag {
  display: block; margin-top: 3px; font-size: 11px; font-weight: 600;
  color: var(--text-faint); letter-spacing: .02em;
  max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ipg-cidr { font-size: 12.5px; font-variant-numeric: tabular-nums; }

/* Kartu pengelompokan IP: butuh lebar penuh karena berisi tabel 5 kolom */
#ipGroupCard { grid-column: 1 / -1; }
#ipGroupCard .cam-table-wrap { margin-bottom: 4px; }
#ipGroupTable { min-width: 560px; }
#ipGroupTable th { padding: 12px 14px; }
#ipGroupTable td { padding: 11px 14px; }
#ipGroupTable td small { display: block; font-size: 12px; color: var(--text-faint); }
#ipGroupCard .field-row { flex-wrap: wrap; }
#ipGroupCard .field { flex: 1 1 200px; min-width: 0; }
@media (max-width: 640px) {
  #ipGroupCard .field { flex: 0 0 auto; }
}

/* Filter kelompok IP di toolbar tabel kamera */
#adminIpGroupFilter { flex: 0 1 auto; min-width: 150px; max-width: 230px; text-overflow: ellipsis; }

/* Cegah badge/tombol aksi terlipat → baris tabel tetap ringkas */
.cam-table .status-pill,
.cam-table .area-badge,
.cam-table .pub-toggle,
.cam-table .pub-badge,
.cam-table .row-actions,
.cam-table .row-lock { white-space: nowrap; }
.cam-table .row-actions { flex-wrap: nowrap; }

.live-hint { text-align: center; color: var(--text-faint); font-size: 13.5px; margin-top: 16px; }

/* ============ TABEL KAMERA ============ */
.cam-table-wrap {
  width: 100%; max-width: 100%;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow-x: auto;
}
.cam-table { width: 100%; border-collapse: collapse; font-size: 14.3px; min-width: 860px; }
.cam-table th {
  text-align: left; font-family: var(--font-head); font-size: 12px;
  letter-spacing: .1em; text-transform: uppercase; color: var(--text-faint);
  padding: 15px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2);
}
.cam-table td { padding: 14px 16px; border-bottom: 1px solid var(--border); color: var(--text-soft); }
.cam-table tr:last-child td { border-bottom: 0; }
.cam-table tr:hover td { background: var(--surface-2); }
.cam-table .cam-name { color: var(--text); font-weight: 600; }
.cam-table .cam-name small { display: block; font-weight: 400; color: var(--text-faint); font-size: 12.5px; }
.cam-table .cam-name .stream-mode { color: var(--color-gold, #c9a227); font-weight: 600; }
.cam-table .cam-name .cam-desc { display:block; font-weight:400; color: var(--text-soft, #475569); font-size:12px; margin-top:2px; }
.status-pill {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 600; padding: 4px 11px; border-radius: 999px;
}
.status-pill.on { color: var(--color-success); background: rgba(46, 125, 50, .12); }
.status-pill.off { color: var(--color-danger); background: rgba(198, 40, 40, .12); }
.rec-pill {
  display: flex; align-items: center; gap: 5px; width: fit-content;
  font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 999px; margin-top: 4px;
}
.rec-pill.is-rec { color: #1b7f3a; background: rgba(46,125,50,.10); }
.rec-pill.is-fail { color: #b42318; background: rgba(198,40,40,.10); }
.rec-pill.is-wait { color: #64748b; background: rgba(100,116,139,.10); }
.row-actions { display: flex; gap: 7px; }

/* visibilitas publik kamera (publish admin → tamu) */
.pub-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; cursor: pointer;
  padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text-faint); font-family: var(--font-body); transition: all .15s ease;
}
.pub-toggle:hover { border-color: var(--color-primary); color: var(--text-soft); }
.pub-toggle.is-on { color: var(--color-success); background: rgba(46, 125, 50, .1); border-color: transparent; }
[data-theme="dark"] .pub-toggle { background: var(--bg-soft); }
.pub-toggle svg { width: 15px; height: 15px; }
.pub-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; padding: 4px 11px; border-radius: 999px;
}
.pub-badge.pub-on { color: var(--color-success); background: rgba(46, 125, 50, .12); }
.pub-badge.pub-off { color: var(--text-faint); background: var(--surface-2); border: 1px solid var(--border); }

/* Badge area kamera & jenis kelamin pengguna */
.area-badge, .gender-badge {
  display: inline-flex; align-items: center; white-space: nowrap;
  font-size: 11.5px; font-weight: 600; padding: 4px 10px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-soft);
}
.area-badge.area-lk { color: #1565c0; background: rgba(21, 101, 192, .12); border-color: transparent; }
.area-badge.area-pr { color: #ad1457; background: rgba(173, 20, 87, .12); border-color: transparent; }
.area-badge.area-umum { color: var(--text-faint); }
.gender-badge.gender-L { color: #1565c0; background: rgba(21, 101, 192, .12); border-color: transparent; }
.gender-badge.gender-P { color: #ad1457; background: rgba(173, 20, 87, .12); border-color: transparent; }
.gender-badge.gender-x { color: var(--text-faint); }
[data-theme="dark"] .area-badge.area-lk, [data-theme="dark"] .gender-badge.gender-L { color: #7fb4f5; }
[data-theme="dark"] .area-badge.area-pr, [data-theme="dark"] .gender-badge.gender-P { color: #f2a2c4; }

/* ============ REKAMAN ============ */
.rec-layout { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; align-items: start; }
.rec-player-card { padding: 18px; }
.rec-player { position: relative; background: #05090f; border-radius: 14px; overflow: hidden; }
.rec-player canvas { width: 100%; aspect-ratio: 16 / 9; }
.rec-osd {
  position: absolute; top: 10px; left: 12px; color: var(--osd);
  font-size: 12.5px; letter-spacing: .08em; font-variant-numeric: tabular-nums;
  background: rgba(3, 8, 16, .6); padding: 4px 10px; border-radius: 7px;
}
.rec-controls { display: flex; align-items: center; gap: 14px; margin-top: 14px; }
.rec-time { font-family: var(--font-head); font-variant-numeric: tabular-nums; font-weight: 600; min-width: 52px; text-align: right; }
.rec-timeline {
  position: relative; height: 42px; margin-top: 14px;
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: 10px; overflow: hidden; cursor: pointer;
}
.rec-seg { position: absolute; top: 0; bottom: 0; border-radius: 3px; }
.rec-seg.motion { background: linear-gradient(180deg, rgba(203, 160, 82, .85), rgba(203, 160, 82, .55)); }
.rec-seg.continuous { background: rgba(0, 71, 187, .55); }
[data-theme="dark"] .rec-seg.continuous { background: rgba(108, 172, 228, .4); }
.rec-cursor { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--color-danger); box-shadow: 0 0 6px rgba(198, 40, 40, .8); }
.rec-legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--text-faint); margin-top: 10px; }
.rec-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.rec-journal-title { font-size: 13.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 14px; }
.rec-journal-list { display: flex; flex-direction: column; gap: 10px; max-height: 460px; overflow-y: auto; }
.rec-journal-item {
  display: flex; justify-content: space-between; gap: 10px; align-items: center;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface-2); font-size: 13.5px;
}
.rec-journal-item b { font-family: var(--font-head); font-variant-numeric: tabular-nums; }
.rec-journal-item span { color: var(--text-faint); font-size: 12.5px; }

/* Rekaman video asli (server-side, stream copy) */
.rec-real-card { padding: 18px; margin-bottom: 20px; }
.rec-real-card[hidden] { display: none; }
.rec-real-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.rec-real-head strong { display: block; margin-top: 6px; font-family: var(--font-head); font-size: 15px; }
.rec-real-meta { display: block; margin-top: 4px; color: var(--text-faint); font-size: 12.5px; }
.rec-video { width: 100%; aspect-ratio: 16 / 9; background: #05090f; border-radius: 12px; display: block; }
.rec-real-list { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; max-height: 160px; overflow-y: auto; padding: 4px 2px; }
.rec-real-seg {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px;
  border: 1px solid var(--border); border-radius: 6px; background: var(--surface-2);
  color: var(--text-soft); font-family: var(--font-head); font-size: 11.5px; cursor: pointer;
  white-space: nowrap;
}
.rec-real-seg:hover { border-color: var(--color-primary); color: var(--color-primary); }
.rec-real-seg.is-active { border-color: var(--color-primary); background: rgba(0, 71, 187, .10); color: var(--color-primary); }
.rec-engine-card { padding: 18px; margin-bottom: 20px; }
.rec-engine-cams { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.rec-engine-cam {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 11px; border: 1px solid var(--border); border-radius: 9px;
  background: var(--surface-2); font-size: 13px;
}
.rec-engine-cam .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; background: var(--text-faint); }
.rec-engine-cam.is-on .dot { background: var(--color-success); box-shadow: 0 0 0 3px rgba(46, 160, 67, .14); }
.rec-engine-cam small { color: var(--text-faint); }
@media (max-width: 640px) {
  .rec-real-head { flex-direction: column; }
  .rec-real-head .toolbar { width: 100%; }
  .rec-real-seg { font-size: 12px; }
}

/* ============ KEJADIAN ============ */
.chart-card { margin-bottom: 20px; }
.chart { display: flex; align-items: flex-end; gap: 5px; height: 170px; }
.chart-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; height: 100%; }
.chart-bar {
  width: 100%; max-width: 34px; border-radius: 6px 6px 3px 3px;
  background: linear-gradient(180deg, var(--color-primary), var(--color-horizon));
  min-height: 3px; transition: height .5s ease;
}
.chart-col.has-motion .chart-bar { background: linear-gradient(180deg, var(--color-gold-earth), var(--color-gold)); }
.chart-label { font-size: 11px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.chart-val { font-size: 11.5px; font-weight: 700; color: var(--text-soft); font-family: var(--font-head); }

.event-list { display: flex; flex-direction: column; gap: 12px; }
.event-item {
  display: grid; grid-template-columns: 132px 1fr auto; gap: 18px; align-items: center;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow-sm);
}
.event-thumb { width: 132px; height: 74px; border-radius: 9px; overflow: hidden; background: var(--video-bg); }
.event-thumb canvas { width: 100%; height: 100%; }
.event-title { font-size: 15.5px; margin-bottom: 3px; }
.event-meta { font-size: 13px; color: var(--text-faint); }
.event-score { font-family: var(--font-head); font-weight: 700; color: var(--color-gold-earth); }
[data-theme="dark"] .event-score { color: var(--color-gold); }
.event-actions { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.empty-state {
  text-align: center; padding: 50px 20px; color: var(--text-faint);
  background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius-lg);
}

/* ============ PENGATURAN ============ */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.settings-title { font-size: 14px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 16px; }
.settings-note { font-size: 13.5px; color: var(--text-soft); line-height: 1.6; }
/* Live View admin: header minimal agar video lebih banyak */
#adminPanel-live .page-head { margin-bottom: 8px; gap: 8px; }
#adminPanel-live .admin-title { font-size: 16px; margin: 4px 0 0; }
#adminPanel-live .page-sub { display: none; }
#adminPanel-live .badge-gold { display: none; }
.settings-note ul, .settings-note ol { margin: 6px 0 0; padding-left: 18px; }
.settings-note li { margin-bottom: 4px; }
.settings-note strong { color: var(--text); }
.akses-cam-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 16px; max-height: 260px; overflow-y: auto; padding: 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-soft); }
.settings-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.storage-bar { height: 14px; background: var(--bg-soft); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; margin-bottom: 10px; }
.storage-fill { height: 100%; background: linear-gradient(90deg, var(--color-primary), var(--color-gold)); transition: width .5s ease; }

@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .tentang-compact-grid { grid-template-columns: 1fr; }
  .ekosistem-card { grid-template-columns: 1fr; }
  .rec-layout { grid-template-columns: 1fr; }
  .live-grid[data-cols="6"], .live-grid[data-cols="9"] { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .stats-grid { grid-template-columns: 1fr; }
  .live-grid, .live-grid[data-cols="4"], .live-grid[data-cols="6"], .live-grid[data-cols="9"] { grid-template-columns: 1fr; }
  .event-item { grid-template-columns: 1fr; }
  .event-thumb { width: 100%; height: 140px; }
  .field-row { flex-direction: column; gap: 0; }
  .tab-list { border-radius: 16px; }
}

/* ============================================================
   Tabel kamera (publik & admin): lebar kolom tetap supaya baris
   ringkas, tidak ada nama/badge yang terlipat berantakan.
   ============================================================ */
:is(#camTable, #adminCamTable) { table-layout: fixed; min-width: 1042px; }
:is(#camTable, #adminCamTable) th,
:is(#camTable, #adminCamTable) td { padding: 12px 10px; }
:is(#camTable, #adminCamTable) th:nth-child(1) { width: 66px; }
:is(#camTable, #adminCamTable) th:nth-child(2) { width: 146px; }
:is(#camTable, #adminCamTable) th:nth-child(3) { width: 128px; }
:is(#camTable, #adminCamTable) th:nth-child(4) { width: 84px; }
:is(#camTable, #adminCamTable) th:nth-child(5) { width: 96px; }
:is(#camTable, #adminCamTable) th:nth-child(6) { width: 68px; }
:is(#camTable, #adminCamTable) th:nth-child(7) { width: 108px; }
:is(#camTable, #adminCamTable) th:nth-child(8) { width: 92px; }
:is(#camTable, #adminCamTable) th:nth-child(9) { width: 118px; }
:is(#camTable, #adminCamTable) th:nth-child(10) { width: 136px; }
:is(#camTable, #adminCamTable) td { overflow: hidden; }
:is(#camTable, #adminCamTable) td.cam-name { overflow-wrap: anywhere; }
:is(#camTable, #adminCamTable) .area-badge { padding: 3px 9px; font-size: 11.5px; }
:is(#camTable, #adminCamTable) .status-pill { padding: 4px 9px; font-size: 11.5px; }
:is(#camTable, #adminCamTable) .pub-toggle { padding: 4px 8px; font-size: 11.5px; }

/* Layar sempit: sembunyikan kolom sekunder agar tombol Aksi tidak terpotong */
@media (max-width: 1300px) {
  :is(#camTable, #adminCamTable) { min-width: 878px; }
  :is(#camTable, #adminCamTable) th:nth-child(5),
  :is(#camTable, #adminCamTable) td:nth-child(5),
  :is(#camTable, #adminCamTable) th:nth-child(6),
  :is(#camTable, #adminCamTable) td:nth-child(6) { display: none; }
}

/* ============================================================
   Pemisahan kamera per area (Umum / Putra / Putri).
   Aktif secara bawaan; bisa dimatikan lewat "Pisah per Area".
   ============================================================ */
.area-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--text-faint); flex: 0 0 auto; }
.live-area-head.area-lk .area-dot, .area-group-row.area-lk .area-dot { background: #1565c0; }
.live-area-head.area-pr .area-dot, .area-group-row.area-pr .area-dot { background: #ad1457; }

/* Judul kelompok di grid Live */
.live-area-head {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 10px;
  margin-top: 6px; padding: 9px 13px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface-2);
  font-family: var(--font-head); font-weight: 700;
  font-size: 13px; letter-spacing: .06em; color: var(--text-soft);
}
.live-area-head:first-child { margin-top: 0; }
.live-area-head .area-dot { width: 10px; height: 10px; }
.live-area-head.area-lk { border-left: 4px solid #1565c0; color: #1565c0; }
.live-area-head.area-pr { border-left: 4px solid #ad1457; color: #ad1457; }
.live-area-head .live-area-count {
  margin-left: auto; font-weight: 600; font-size: 11.5px;
  letter-spacing: .02em; color: var(--text-faint);
}
[data-theme="dark"] .live-area-head.area-lk { color: #7fb4f5; }
[data-theme="dark"] .live-area-head.area-pr { color: #f2a2c4; }

/* Paginasi Live (bila kamera per area melebihi ukuran grid) */
.live-pager {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px; border-radius: 9px;
  background: var(--surface); border: 1px solid var(--border);
}
.live-area-head .live-pager { margin-left: 8px; }
.live-pager .pager-btn {
  width: 26px; height: 26px; display: grid; place-items: center;
  border: 1px solid var(--border-strong); border-radius: 7px;
  background: var(--surface); color: var(--text-soft);
  font-size: 16px; line-height: 1; cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.live-pager .pager-btn:hover:not(:disabled) { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.live-pager .pager-btn:disabled { opacity: .35; cursor: default; }
.pager-label { font-size: 11.5px; font-weight: 700; letter-spacing: .04em; color: var(--text-soft); min-width: 34px; text-align: center; }
.live-pager .pager-num { width: auto; min-width: 26px; padding: 0 7px; font-size: 12px; font-weight: 700; }
.live-pager .pager-btn.is-active,
.live-pager .pager-btn.is-active:hover { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.pager-gap { min-width: 14px; text-align: center; font-size: 12px; font-weight: 700; color: var(--text-faint); }
.live-pager-bar {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 10px;
  justify-content: flex-end; padding: 2px 2px 8px;
}
.live-pager-info { font-size: 11.5px; font-weight: 600; color: var(--text-faint); margin-right: auto; }
@media (max-width: 480px) {
  .live-area-head { flex-wrap: wrap; row-gap: 4px; }
  .live-area-head .live-area-count { margin-left: auto; }
  .live-area-head .live-pager { flex: 0 0 100%; justify-content: flex-end; margin-left: 0; }
}

/* Label area pada tiap ubin Live */
.tile-osd-top .tile-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-area {
  flex: 0 0 auto; white-space: nowrap;
  font-size: 10px; font-weight: 700; letter-spacing: .08em;
  padding: 3px 8px; border-radius: 6px; color: #fff;
  background: rgba(120, 130, 145, .72);
}
.tile-area.area-lk { background: rgba(21, 101, 192, .88); }
.tile-area.area-pr { background: rgba(173, 20, 87, .88); }

/* Baris judul kelompok di tabel kamera */
:is(#camTable, #adminCamTable) tr.area-group-row td {
  padding: 9px 12px; background: var(--surface-2);
  border-top: 2px solid var(--border);
}
.area-group-row .area-dot { margin-right: 8px; vertical-align: middle; }
.area-group-name { font-family: var(--font-head); font-weight: 700; letter-spacing: .05em; color: var(--text); vertical-align: middle; }
.area-group-count { margin-left: 10px; font-size: 11.5px; font-weight: 600; color: var(--text-faint); vertical-align: middle; }
.area-group-row.area-lk .area-group-name { color: #1565c0; }
.area-group-row.area-pr .area-group-name { color: #ad1457; }
[data-theme="dark"] .area-group-row.area-lk .area-group-name { color: #7fb4f5; }
[data-theme="dark"] .area-group-row.area-pr .area-group-name { color: #f2a2c4; }

/* ============ EVENTDASH LAYOUT ============ */
.eventdash-layout {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 8px;
  padding: 8px;
  height: calc(100vh - var(--header-height));
  box-sizing: border-box;
}
.eventdash-main {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}
.eventdash-display {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #8e44ad;
}
.eventdash-display .player-v2-video-wrap {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.eventdash-display .tile {
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
}
.eventdash-display .tile canvas,
.eventdash-display .tile img.tile-img, video.tile-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.eventdash-display .live-grid,
.eventdash-display .live-grid[data-cols="1"] {
  max-width: none;
  width: 100%;
  height: 100%;
  margin: 0;
}
.eventdash-display .player-v2-overlay {
  position: absolute;
  bottom: 8px;
  left: 8px;
  right: 8px;
  display: flex;
  justify-content: space-between;
  color: #fff;
  font-size: 13px;
  text-shadow: 0 1px 3px rgba(0,0,0,.8);
  pointer-events: none;
}
/* Fullscreen: video mengisi seluruh layar */
.eventdash-display.is-fullscreen,
.eventdash-display:fullscreen,
.eventdash-display:-webkit-full-screen {
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  border: none !important;
  border-radius: 0 !important;
  background: #000;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin: 0 !important;
  padding: 0 !important;
}
.eventdash-display.is-fullscreen .player-v2-video-wrap,
.eventdash-display:fullscreen .player-v2-video-wrap,
.eventdash-display:-webkit-full-screen .player-v2-video-wrap {
  width: 100% !important;
  height: 100% !important;
}
.eventdash-display.is-fullscreen .live-grid,
.eventdash-display.is-fullscreen .live-grid[data-cols="1"],
.eventdash-display:fullscreen .live-grid,
.eventdash-display:fullscreen .live-grid[data-cols="1"],
.eventdash-display:-webkit-full-screen .live-grid,
.eventdash-display:-webkit-full-screen .live-grid[data-cols="1"] {
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  gap: 0 !important;
  padding: 0 !important;
}
.eventdash-display.is-fullscreen .tile,
.eventdash-display:fullscreen .tile,
.eventdash-display:-webkit-full-screen .tile {
  width: 100% !important;
  height: 100% !important;
  aspect-ratio: auto !important;
  border-radius: 0 !important;
  border: none !important;
}
.eventdash-display.is-fullscreen .tile canvas,
.eventdash-display.is-fullscreen .tile img.tile-img, video.tile-img,
.eventdash-display:fullscreen .tile canvas,
.eventdash-display:fullscreen .tile img.tile-img, video.tile-img,
.eventdash-display:-webkit-full-screen .tile canvas,
.eventdash-display:-webkit-full-screen .tile img.tile-img, video.tile-img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
}

.eventdash-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.eventdash-controls .player-btn {
  flex: 0 0 auto;
  padding: 6px 12px;
  border: 1px solid #ccc;
  background: #fff;
  color: #333;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}
.eventdash-controls .player-btn:hover { background: #f0f0f0; }
.eventdash-controls .audit-search {
  flex: 1 1 auto;
  min-width: 100px;
}
.eventdash-sidebar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}
.eventdash-card {
  background: #fff;
  border-radius: 8px;
  padding: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  border-left: 3px solid #8e44ad;
}
.eventdash-card h4 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  color: #8e44ad;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.eventdash-info {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 13px;
  border-bottom: 1px solid #f0f0f0;
}
.eventdash-info:last-child { border-bottom: none; }
.eventdash-info .label { color: #666; }
.eventdash-info .value { font-weight: 600; color: #333; }
.eventdash-channel-list {
  flex: 1 1 auto;
  overflow-y: auto;
  max-height: 300px;
}
.eventdash-channel-list .player-v2-thumb {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  margin-bottom: 4px;
  transition: background 0.15s;
  border: 1px solid #eee;
}
.eventdash-channel-list .player-v2-thumb:hover { background: #f5f0fa; }
.eventdash-channel-list .player-v2-thumb.is-active { background: #8e44ad; color: #fff; border-color: #8e44ad; }
.eventdash-channel-list .player-v2-thumb-img {
  width: 48px;
  height: 32px;
  background: #222;
  border-radius: 4px;
  flex-shrink: 0;
  overflow: hidden;
}
.eventdash-channel-list .player-v2-thumb-img img { width: 100%; height: 100%; object-fit: cover; }
.eventdash-channel-list .player-v2-thumb-info { min-width: 0; }
.eventdash-channel-list .player-v2-thumb-name { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.eventdash-channel-list .player-v2-thumb-sub { font-size: 10px; opacity: 0.7; }
@media (max-width: 768px) {
  .eventdash-layout { grid-template-columns: 1fr; }
  .eventdash-sidebar { max-height: 250px; }
}

/* ============ CINEMA LAYOUT ============ */
.cinema-layout {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  height: calc(100vh - var(--header-height));
  box-sizing: border-box;
  background: #000;
}
.cinema-display {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
  background: #000;
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cinema-display .player-v2-video-wrap {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cinema-display .tile {
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
}
.cinema-display .tile canvas,
.cinema-display .tile img.tile-img, video.tile-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.cinema-overlay {
  position: absolute;
  bottom: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  color: #fff;
  font-size: 12px;
  text-shadow: 0 1px 4px rgba(0,0,0,.9);
  pointer-events: none;
  z-index: 2;
}
.cinema-controls {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 0 4px;
}
.cinema-btn {
  flex: 0 0 auto;
  padding: 6px 12px;
  border: 1px solid rgba(255,255,255,.2);
  background: rgba(255,255,255,.08);
  color: #fff;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
}
.cinema-btn:hover { background: rgba(255,255,255,.15); }
.cinema-search {
  flex: 1 1 auto;
  min-width: 100px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.2);
  color: #fff;
  border-radius: 4px;
}
.cinema-count {
  color: #fff;
  font-size: 12px;
  opacity: 0.7;
}
.cinema-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 4px 0;
  scrollbar-width: thin;
}
.cinema-strip::-webkit-scrollbar { height: 4px; }
.cinema-strip::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 2px; }
.cinema-strip .player-v2-thumb {
  flex: 0 0 auto;
  width: 120px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s;
}
.cinema-strip .player-v2-thumb:hover { border-color: rgba(255,255,255,.4); }
.cinema-strip .player-v2-thumb.is-active { border-color: #fff; }
.cinema-strip .player-v2-thumb-img {
  width: 100%;
  height: 68px;
  background: #111;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.cinema-strip .player-v2-thumb-img img { width: 100%; height: 100%; object-fit: cover; }
.cinema-strip .player-v2-thumb-info { padding: 3px 5px; font-size: 10px; color: #ccc; }
.cinema-strip .player-v2-thumb-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cinema-strip .player-v2-thumb-sub { font-size: 9px; opacity: 0.6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 768px) {
  .eventdash-layout { grid-template-columns: 1fr; }
  .eventdash-sidebar { max-height: 250px; }
}/* ============ STREAMING LAYOUT ============ */
.stream-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 8px;
  padding: 8px;
  height: calc(100vh - var(--header-height));
  box-sizing: border-box;
  background: var(--bg);
}
.stream-main {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}
.stream-player {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
}
.stream-player .player-v2-video-wrap {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.stream-player .live-grid,
.stream-player .live-grid[data-cols="1"] {
  max-width: none;
  width: 100%;
  height: 100%;
  margin: 0;
}
.stream-player .tile {
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  border: none;
  border-radius: 0;
}
.stream-player .tile canvas,
.stream-player .tile img.tile-img, video.tile-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* Jam tetap tampil di overlay bawah */
.stream-live-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #e53935;
  color: #fff;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .05em;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 3px;
  opacity: 0.85;
}
.stream-live-badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
  animation: pulse-live 1.5s infinite;
}
@keyframes pulse-live {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.stream-info {
  padding: 0 4px;
}
.stream-title {
  font-family: var(--font-head);
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 4px;
}
.stream-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--text-soft);
}
.stream-meta .viewers {
  display: flex;
  align-items: center;
  gap: 4px;
}
.stream-meta .viewers .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #e53935;
}
.stream-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}
.stream-controls .player-btn {
  flex: 0 0 auto;
  padding: 8px 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: background .15s;
}
.stream-controls .player-btn:hover { background: var(--bg-soft); }
.stream-controls .audit-search {
  flex: 1 1 auto;
  min-width: 120px;
}
.stream-sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  min-height: 0;
}
.stream-sidebar-title {
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  padding: 0 4px;
}
.stream-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  flex: 1 1 auto;
}
.stream-item {
  display: flex;
  gap: 10px;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s;
  border: 1px solid transparent;
}
.stream-item:hover { background: var(--bg-soft); }
.stream-item.is-active { background: var(--bg-soft); border-color: var(--color-primary); }
.stream-thumb {
  width: 120px;
  height: 68px;
  background: #222;
  border-radius: 6px;
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
}
.stream-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.stream-thumb .live-badge {
  position: absolute;
  bottom: 4px;
  left: 4px;
  background: #e53935;
  color: #fff;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 700;
}
.stream-item-info {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}
.stream-item-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stream-item-sub {
  font-size: 11px;
  color: var(--text-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (max-width: 900px) {
  .stream-layout { grid-template-columns: 1fr; }
  .stream-sidebar { max-height: 200px; }
  .stream-thumb { width: 80px; height: 45px; }
}

/* ============ RESPONSIVE (MOBILE) ============ */
@media (max-width: 768px) {
  /* Stream layout: stack vertically */
  .stream-layout { grid-template-columns: 1fr; height: auto; min-height: calc(100vh - var(--header-height)); }
  .stream-player { min-height: 250px; }
  .stream-sidebar { max-height: 200px; }
  .stream-thumb { width: 80px; height: 45px; }
  .stream-controls { flex-wrap: wrap; }
  .stream-controls .player-btn { font-size: 12px; padding: 6px 10px; }
  .stream-controls .audit-search { min-width: 100%; }
  .stream-info { padding: 0; }
  .stream-title { font-size: 15px; }
  /* Hero */
  .hero-section { padding: calc(var(--header-height) + 16px) 0 32px; }
  .hero-headline { font-size: 24px; }
  .hero-subheadline { font-size: 14px; }
  .hero-cta-group { gap: 8px; }
  .hero-cta-group .btn { font-size: 13px; padding: 8px 14px; }
  /* Section headers */
  .section-header { margin-bottom: 16px; }
  .section-header h2 { font-size: 20px; }
  /* Footer */
  .footer-grid { grid-template-columns: 1fr; gap: 20px; }
  .footer-col { padding: 0; }
  .footer-brand { text-align: center; }
  .footer-brand .brand-link { justify-content: center; }
  .footer-bottom { flex-direction: column; text-align: center; gap: 8px; }
  /* Modals */
  .modal { width: 95vw; max-width: 95vw; margin: 10px; }
  .modal-body { padding: 16px; }
  .field-row { flex-direction: column; gap: 8px; }
  .field-row .field { min-width: 0; width: 100%; }
  /* Tables: horizontal scroll */
  .cam-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .cam-table { min-width: 600px; }
  /* Mega menu */
  .mega-panel { padding: 12px; }
  .mega-grid { grid-template-columns: 1fr; }
  .mega-intro-card { display: none; }
  /* Live toolbar */
  .toolbar { flex-wrap: wrap; gap: 8px; }
  .toolbar-group { flex-wrap: wrap; }
  .audit-search { min-width: 100%; }
  /* Page head */
  .page-head { flex-direction: column; gap: 12px; align-items: flex-start; }
  .page-title { font-size: 22px; }
  /* Cards */
  .stdi-card { padding: 16px; }
  .admin-quick-actions { flex-direction: column; }
  .admin-quick-actions .btn { width: 100%; }
  /* Form */
  .form-row { flex-direction: column; }
  .form-row .field { width: 100%; }
  /* Toast */
  .toast-stack { left: 10px; right: 10px; bottom: 10px; }
  .toast { max-width: 100%; }
}

@media (max-width: 480px) {
  /* Extra small screens */
  .hero-headline { font-size: 20px; }
  .nav-menu { gap: 4px; }
  .nav-link { font-size: 12px; padding: 6px 8px; }
  .brand-text strong { font-size: 11px; }
  .brand-text em { font-size: 13px; }
  .stream-player { min-height: 200px; }
  .stream-sidebar { max-height: 150px; }
  .stream-thumb { width: 60px; height: 34px; }
  .stream-item-name { font-size: 11px; }
  .stream-item-sub { font-size: 9px; }
  .stream-controls .player-btn { font-size: 11px; padding: 5px 8px; }
  /* Header compact */
  .navbar { gap: 8px; }
  .nav-live-clock { display: none; }
  .lang-select { font-size: 11px; padding: 0 4px; }
}

/* Admin mobile improvements */
@media (max-width: 1024px) {
  .admin-shell { grid-template-columns: minmax(0, 1fr); }
  .admin-side {
    position: fixed; top: 0; left: 0; height: 100vh;
    width: min(280px, 85vw); transform: translateX(-104%);
    transition: transform .25s ease; z-index: 50;
  }
  .admin-side.is-open { transform: translateX(0); }
  .admin-burger { display: inline-flex; }
  .admin-panels { padding: 16px 12px 40px; }
  .admin-topbar { padding: 12px 14px; flex-wrap: wrap; }
  .admin-topbar-left { gap: 8px; }
  .admin-heading .badge-gold { font-size: 10px; }
  .admin-title { font-size: 18px; }
  /* Admin tables: horizontal scroll */
  .admin-panel .cam-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .admin-panel .cam-table { min-width: 720px; }
  #adminCamTable, #camTable { min-width: 760px; width: max-content; table-layout: auto; }
  .admin-panel .cam-table th, .admin-panel .cam-table td { white-space: nowrap; }
  .admin-panel .cam-table td:nth-child(2) { white-space: normal; min-width: 180px; }
  /* Admin toolbar */
  .toolbar { flex-wrap: wrap; gap: 8px; }
  .toolbar .input { min-width: 0; flex: 1 1 120px; }
  /* Admin cards */
  .admin-dash-cols { grid-template-columns: 1fr; }
  .admin-quick-actions { flex-direction: column; }
  .admin-quick-actions .btn { width: 100%; }
  /* Settings form */
  .field-row { flex-direction: column; gap: 8px; }
  .field-row .field { width: 100%; }
  /* Audit table */
  .audit-col-ip { display: none; }
  .audit-col-wide { display: none; }
}

@media (max-width: 640px) {
  .admin-topbar-right .admin-session-pill { display: none; }
  .admin-panel .cam-table { min-width: 600px; }
  .admin-panels { padding: 12px 8px 32px; }
  .admin-topbar { padding: 10px 12px; }
  /* Smaller admin tabs when collapsed */
  .admin-shell.is-collapsed { grid-template-columns: 60px minmax(0, 1fr); }
}

.tile-mute-inline { font-size: 12px; }
.tile-mute-btn:hover { background: rgba(0,0,0,.8); }
.th-sort{cursor:pointer;user-select:none;white-space:nowrap}
.th-sort:hover{color:var(--gold,#d4af37)}
.th-sort::after{content:' ⇅';font-size:10px;opacity:.35}
.th-sort.is-sort::after{content:' ↑';opacity:.9}
.th-sort.is-sort.is-desc::after{content:' ↓';opacity:.9}
