:root {
  --bg: #0c0e11;
  --panel: #12151a;
  --panel-2: #191d23;
  --panel-3: #20242b;
  --border: #262b32;
  --border-soft: #1d2127;
  --text: #e6e8eb;
  --text-dim: #aeb3bd;
  --muted: #6b7280;
  --accent: #4a8fd6;
  --accent-dim: #2c4763;
  --red: #e5484d;
  --green: #34a870;
  --amber: #d6a04a;

  --font: -apple-system, "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --fs-2xs: 10.5px;
  --fs-xs: 11.5px;
  --fs-sm: 12.5px;
  --fs-base: 13px;
  --fs-md: 14px;
  --fs-lg: 15.5px;

  --r-sm: 6px;
  --r-md: 9px;
  --r-lg: 12px;

  --sidebar-rail-w: 60px;
  --sidebar-expanded-w: 300px;

  --shadow-sm: 0 2px 8px -3px rgba(0,0,0,.55);
  --shadow-md: 0 14px 34px -16px rgba(0,0,0,.7);
  --accent-glow: rgba(74,143,214,.38);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-base);
  background:
    radial-gradient(1100px 620px at 12% -8%, rgba(74,143,214,.07), transparent 60%),
    radial-gradient(900px 560px at 100% 100%, rgba(52,168,112,.045), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  letter-spacing: 0.1px;
}

a { color: var(--accent); text-decoration: none; }

button, input, select {
  font-family: inherit;
}

::selection { background: var(--accent-dim); }

/* ---------- Landing / Login ---------- */
body.landing, body.login-page {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(1200px 600px at 20% 0%, rgba(74,143,214,0.06), transparent 60%),
    var(--bg);
}
.landing-box, .login-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 32px 34px;
  width: 340px;
  text-align: center;
  box-shadow: 0 20px 60px -20px rgba(0,0,0,.6);
}
.landing-box h1, .login-box h1 { font-size: var(--fs-lg); font-weight: 600; margin-bottom: 4px; letter-spacing: -0.1px; }
.login-box p.sub { color: var(--muted); margin-top: 0; margin-bottom: 20px; font-size: var(--fs-xs); }
.login-box input {
  width: 100%;
  padding: 9px 11px;
  margin: 5px 0;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  font-size: var(--fs-sm);
  outline: none;
  transition: border-color .15s ease;
}
.login-box input:focus { border-color: var(--accent); }
.hint { font-size: var(--fs-2xs); color: var(--muted); margin-top: 12px; line-height: 1.5; }
.error-msg { color: var(--red); font-size: var(--fs-xs); min-height: 16px; margin-top: 6px; }

.btn {
  display: inline-block;
  margin: 6px 3px;
  padding: 9px 16px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  cursor: pointer;
  font-size: var(--fs-sm);
  font-weight: 600;
  transition: filter .12s ease, background .12s ease, border-color .12s ease;
}
.btn:hover { filter: brightness(1.08); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-secondary { background: var(--panel-2); color: var(--text-dim); border: 1px solid var(--border); }
.btn-secondary:hover { color: var(--text); border-color: #333a44; }
.btn-danger { background: var(--red); color: #fff; }
.btn-block { width: 100%; margin: 8px 0 0; }
.btn:disabled { opacity: .4; cursor: not-allowed; filter: none; }
.btn-sm { padding: 5px 10px; font-size: var(--fs-2xs); margin: 0; }

/* ---------- App shell ---------- */
.app {
  display: flex;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
}

/* ===== Sidebar : Opera-style rail that expands ===== */
.sidebar {
  width: var(--sidebar-rail-w);
  background: linear-gradient(180deg, var(--panel), #101319);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width .18s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
  box-shadow: 10px 0 28px -20px rgba(0,0,0,.75);
  position: relative;
  z-index: 3;
}
.sidebar.expanded {
  width: var(--sidebar-expanded-w);
}

.sidebar-top {
  display: flex;
  align-items: center;
  height: 56px;
  padding: 0 12px;
  border-bottom: 1px solid var(--border-soft);
  flex-shrink: 0;
  gap: 10px;
}
.burger {
  width: 38px; height: 38px;
  border-radius: var(--r-md);
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: background .12s ease, border-color .12s ease, transform .12s ease, box-shadow .12s ease;
  box-shadow: var(--shadow-sm);
}
.burger:hover { background: var(--panel-3); border-color: #333a44; color: var(--text); transform: translateY(-1px); }
.burger:active { transform: translateY(0); }
.burger svg { width: 18px; height: 18px; }
.burger svg { width: 18px; height: 18px; }
.burger .icon-off { display: block; }
.burger .icon-on { display: none; }
.burger.active .icon-off { display: none; }
.burger.active .icon-on { display: block; }

.sidebar-brand {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-dim);
  white-space: nowrap;
  opacity: 0;
  transition: opacity .12s ease;
  letter-spacing: .2px;
}
.sidebar.expanded .sidebar-brand { opacity: 1; transition-delay: .06s; }

/* --- collapsed rail: quick action icons --- */
.sidebar-rail-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 0;
  flex: 1;
  overflow-y: auto;
}
.sidebar.expanded .sidebar-rail-actions { display: none; }

.rail-btn {
  width: 40px; height: 40px;
  border-radius: var(--r-md);
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  position: relative;
  transition: background .12s ease, color .12s ease, border-color .12s ease, transform .12s ease, box-shadow .12s ease;
  box-shadow: var(--shadow-sm);
}
.rail-btn svg { width: 18px; height: 18px; }
.rail-btn:hover { background: var(--panel-3); color: var(--text); border-color: #333a44; transform: translateY(-1px); }
.rail-btn:active { transform: translateY(0); }
.rail-btn.active {
  background: linear-gradient(180deg, rgba(74,143,214,.28), rgba(74,143,214,.14));
  color: #d9ebff;
  border-color: rgba(74,143,214,.55);
  box-shadow: 0 0 0 1px rgba(74,143,214,.2), 0 6px 16px -8px var(--accent-glow);
}
.rail-btn.danger.active {
  background: linear-gradient(180deg, rgba(229,72,77,.28), rgba(229,72,77,.14));
  color: #ffc8c9;
  border-color: rgba(229,72,77,.55);
  box-shadow: 0 0 0 1px rgba(229,72,77,.2), 0 6px 16px -8px rgba(229,72,77,.45);
}
.sidebar-rail-actions { gap: 12px; }  /* poin 4: renggangin jarak antar tombol */

@keyframes recPulse { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }

/* record: merah + berkedip, sinkron sama label bawah */
.rail-btn.danger.active {
  animation: recPulse 1.1s ease-in-out infinite;
}
#bottomRecording.on {
  animation: recPulse 1.1s ease-in-out infinite;
}

/* stream: hijau, steady (nggak blink) */
.rail-btn.stream-on {
  background: rgba(52,168,112,.2);
  border-color: rgba(52,168,112,.55);
  color: #4be39a;
  box-shadow: 0 0 0 1px rgba(52,168,112,.2), 0 6px 16px -8px rgba(52,168,112,.4);
}
#bottomStreaming.on { color: #4be39a; }
#bottomStreaming.on .indicator { background: var(--green); }
.rail-btn .rail-dot {
  position: absolute; top: 6px; right: 6px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--red);
  display: none;
}
.rail-btn.active .rail-dot { display: block; animation: pulseDot 1.4s infinite; }
.rail-divider {
  width: 24px; height: 1px;
  background: var(--border-soft);
  margin: 6px 0;
}
.rail-btn svg { width: 18px; height: 18px; }
.rail-btn .icon-off { display: block; }
.rail-btn .icon-on { display: none; }
.rail-btn.active .icon-off { display: none; }
.rail-btn.active .icon-on { display: block; }
/* feedback saat ditekan — kesan tactile, bukan flat click */
.rail-btn:active, .burger:active, .icon-btn:active, .logout-btn:active {
  transform: scale(.92);
}

/* border lebih tegas drpd cuma mengandalkan shadow/glow */
.rail-btn, .burger, .icon-btn { border-width: 1px; }
.rail-btn.active, .rail-btn.stream-on, .rail-btn.danger.active {
  box-shadow: 0 0 0 1px currentColor inset, 0 4px 12px -6px currentColor;
}


@keyframes pulseDot {
  0%, 100% { opacity: 1; }
  50% { opacity: .3; }
}

/* --- expanded rail: inline config panel (no modal) --- */
.sidebar-config {
  display: none;
  flex-direction: column;
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px 8px;
}
.sidebar.expanded .sidebar-config { display: flex; }

.sidebar-config h4 {
  font-size: var(--fs-2xs);
  letter-spacing: .08em;
  color: var(--muted);
  text-transform: uppercase;
  margin: 0 0 14px;
  font-weight: 600;
}
.sidebar-config label {
  font-size: var(--fs-xs);
  color: var(--muted);
  display: block;
  margin-bottom: 4px;
  font-weight: 500;
}
.sidebar-config input[type=text],
.sidebar-config select {
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  font-size: var(--fs-sm);
  margin-bottom: 14px;
  outline: none;
  transition: border-color .15s ease;
}
.sidebar-config input[type=text]:focus,
.sidebar-config select:focus { border-color: var(--accent); }

.cam-config-row {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 11px 12px;
  margin-bottom: 10px;
  background: var(--panel-2);
}
.cam-config-row .row-title {
  font-size: var(--fs-2xs);
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .05em;
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-xs);
  margin: 10px 0;
  color: var(--text-dim);
}
.checkbox-line label { margin: 0; font-size: var(--fs-xs); color: var(--text-dim); }
.checkbox-line input[type=checkbox] {
  width: 14px; height: 14px;
  accent-color: var(--accent);
}

.private-link-box {
  background: var(--panel-2);
  border: 1px dashed var(--border);
  border-radius: var(--r-sm);
  padding: 9px 10px;
  font-size: var(--fs-2xs);
  word-break: break-all;
  margin-top: 6px;
  color: var(--text-dim);
}

.config-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
}
.config-actions .btn { margin: 0; flex: 1; text-align: center; }

/* --- footer (always visible, both states) --- */
.sidebar-footer {
  flex-shrink: 0;
  padding: 10px;
  border-top: 1px solid var(--border-soft);
  display: flex;
  justify-content: center;
}
.sidebar.expanded .sidebar-footer { padding: 12px 16px; }

.logout-btn {
  width: 40px; height: 40px;
  border-radius: var(--r-md);
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .12s ease, color .12s ease, border-color .12s ease, transform .12s ease;
}
.logout-btn svg { width: 17px; height: 17px; }
.logout-btn:hover { background: rgba(229,72,77,.1); color: var(--red); border-color: rgba(229,72,77,.3); }

.sidebar.expanded .logout-btn {
  width: 100%;
  justify-content: flex-start;
  gap: 9px;
  padding: 0 12px;
  font-size: var(--fs-xs);
  font-weight: 600;
}
.sidebar.expanded .logout-btn span { display: inline; }
.logout-btn span { display: none; }

/* streamer list (server dashboard) */
.streamer-list { flex: 1; overflow-y: auto; padding: 8px 8px; }
.sidebar:not(.expanded) .streamer-list { display: none; }
.streamer-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--r-sm); cursor: pointer;
  margin-bottom: 4px; border: 1px solid transparent;
  transition: background .12s ease, border-color .12s ease;
}
.streamer-item:hover { background: var(--panel-2); }
.streamer-item.selected { border-color: var(--accent-dim); background: var(--panel-2); }
.streamer-item .status-dot { width: 7px; height: 7px; border-radius: 50%; background: #3a3f4b; flex-shrink:0; }
.streamer-item.online .status-dot { background: var(--green); }
.streamer-item .meta { flex: 1; min-width: 0; }
.streamer-item .meta .n { font-size: var(--fs-sm); font-weight: 600; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.streamer-item .meta .s { font-size: var(--fs-2xs); color: var(--muted); margin-top: 1px; }
.streamer-item .lock { font-size: var(--fs-2xs); color: var(--muted); }

/* ---------- Main area ---------- */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  position: relative;
}
.topbar {
  padding: 0 22px;
  height: 56px;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.topbar h1 {
  font-size: var(--fs-md);
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.1px;
  color: var(--text);
}
.topbar .sub-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-2xs);
  color: var(--muted);
  background: var(--panel-2);
  padding: 4px 11px 4px 9px;
  border-radius: 20px;
  border: 1px solid var(--border);
  font-weight: 500;
}
.topbar .sub-badge::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
}
.topbar .sub-badge.conn-good::before {
  background: var(--green);
  box-shadow: 0 0 6px rgba(52,168,112,.7);
}
.topbar .sub-badge.conn-reconnecting::before {
  background: var(--amber);
  animation: pulseDot 1s infinite;
}
.topbar .sub-badge.conn-bad::before {
  background: var(--red);
}
.topbar .right { display: flex; align-items: center; gap: 10px; }

/* ---------- Camera grid ---------- */
.grid-4 {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 10px;
  padding: 16px;
  overflow: auto;
  min-height: 0;
  position: relative;
}
@media (max-width: 860px) {
  .grid-4 {
    grid-template-columns: 1fr;
    grid-template-rows: none;
    grid-auto-rows: minmax(200px, 1fr);
  }
}

.cam-box {
  background: linear-gradient(160deg, #0e1114, #000 65%);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  overflow: hidden;
  position: relative;
  min-height: 140px;
  display: flex;
  box-shadow: var(--shadow-md), inset 0 0 0 1px rgba(255,255,255,.02);
}

.cam-box .cam-body {
  flex: 1;
  position: relative;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.cam-box .cam-body::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 46%;
  background: linear-gradient(180deg, rgba(0,0,0,.5) 0%, rgba(0,0,0,0) 100%);
  pointer-events: none;
  z-index: 1;
}
.cam-box video {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center;
  background: #000;
  display: block;
}
.cam-box video.mirrored { transform: scaleX(-1); }

.cam-box .cam-label {
  position: absolute;
  top: 10px; right: 12px;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: #f5f6f8;
  text-shadow: 0 1px 2px rgba(0,0,0,.6);
  letter-spacing: .1px;
  pointer-events: none;
  z-index: 2;
}
.cam-box .cam-rec-flag {
  position: absolute;
  top: 8px; left: 9px;
  display: none;
  align-items: center;
  gap: 5px;
  padding: 3px 9px 3px 7px;
  border-radius: 20px;
  background: rgba(20,10,10,.55);
  backdrop-filter: blur(3px);
  border: 1px solid rgba(255,255,255,.08);
  font-size: var(--fs-2xs);
  font-weight: 700;
  color: #ffc8c9;
  letter-spacing: .06em;
  z-index: 2;
}
.cam-box .cam-rec-flag.on { display: flex; }
.cam-box .cam-rec-flag .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 6px rgba(229,72,77,.8);
  animation: pulseDot 1.2s infinite;
}

.cam-box .placeholder {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: var(--fs-xs);
  text-align: center;
  padding: 0 12px;
}

.cam-box .onlabel {
  position: absolute;
  top: 10px; left: 12px;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: #f5f6f8;
  text-shadow: 0 1px 2px rgba(0,0,0,.6);
  letter-spacing: .1px;
  pointer-events: none;
  z-index: 2;
}

/* single "who am I watching" identity label - flat, no backdrop, bottom-left of the grid */
.monitor-identity-label {
  position: absolute;
  bottom: 14px; left: 24px;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: #f5f6f8;
  text-shadow: 0 1px 3px rgba(0,0,0,.75);
  pointer-events: none;
  z-index: 5;
  letter-spacing: .1px;
}

/* mini grid (private/view single-streamer) */
.mini-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 2px;
  width: 100%; height: 100%;
  background: #000;
}
.mini-grid .mini-cell { position: relative; overflow: hidden; background:#050505; display:flex; }
.mini-grid .mini-cell video { width: 100%; height: 100%; object-fit: cover; }
.mini-grid .mini-cell video.mirrored { transform: scaleX(-1); }
.mini-grid .mini-cell .mini-label {
  position: absolute; top: 8px; right: 8px;
  font-size: var(--fs-2xs); font-weight: 600;
  color: #f2f3f5;
  text-shadow: 0 1px 3px rgba(0,0,0,.85);
}

/* bottom status labels */
.bottom-status {
  display: flex; gap: 20px; padding: 9px 22px;
  border-top: 1px solid var(--border-soft);
  font-size: var(--fs-xs);
  flex-shrink: 0;
}
.bottom-status .item { display: flex; align-items: center; gap: 7px; color: var(--muted); font-weight: 500; }
.bottom-status .item.on { color: #f5a4a6; font-weight: 600; }
.bottom-status .item.on .indicator { animation: pulseDot 1.2s infinite; background: var(--red); }
.bottom-status .indicator { width: 8px; height: 8px; border-radius: 50%; background: #363b44; }

.total-badge {
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 20px; padding: 5px 12px; font-size: var(--fs-xs); color: var(--text-dim);
}
.total-badge b { color: var(--green); }

.empty-slot-cta { color: var(--muted); font-size: var(--fs-xs); text-align:center; }

/* scrollbars, quiet */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2a2f37; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #363c46; }

.rail-btn { position: relative; }
.rail-btn .rail-badge {
  position: absolute; bottom: -3px; right: -3px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px;
  background: var(--green);
  color: #06231a;
  font-size: 9.5px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--panel);
}

.cam-box .cam-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px;
  background: linear-gradient(180deg, rgba(255,255,255,.03), transparent);
  border-bottom: 1px solid var(--border-soft);
}
.cam-box .cam-header span { font-size: var(--fs-xs); font-weight: 600; color: var(--text-dim); }
.cam-box .header-actions { display: flex; gap: 6px; }

.icon-btn {
  width: 26px; height: 26px;
  border-radius: 7px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background .12s ease, color .12s ease, border-color .12s ease;
}
.icon-btn svg { width: 13px; height: 13px; }
.icon-btn:hover { background: var(--panel-3); color: var(--text); border-color: #333a44; }
.icon-btn.rec-on { background: rgba(229,72,77,.2); border-color: rgba(229,72,77,.55); color: #ffc8c9; }
.icon-btn.danger:hover { background: rgba(229,72,77,.16); border-color: rgba(229,72,77,.45); color: #ffb3b4; }

/* ================================================================
   USER MANAGEMENT DRAWER (admin-only, independent from sidebar)
   ================================================================ */
.umd-overlay {
  position: fixed; inset: 0;
  background: rgba(5,6,8,.6);
  display: none;
  z-index: 40;
}
.umd-overlay.open { display: block; }

.umd-drawer {
  position: absolute; top: 0; left: 0; bottom: 0;
  width: 560px;
  max-width: 92vw;
  background: var(--panel);
  border-right: 1px solid var(--border);
  box-shadow: 24px 0 60px -20px rgba(0,0,0,.75);
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform .2s cubic-bezier(.4,0,.2,1);
}
.umd-overlay.open .umd-drawer { transform: translateX(0); }

.umd-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-soft);
  flex-shrink: 0;
}
.umd-header h3 { margin: 0; font-size: var(--fs-md); font-weight: 600; }
.umd-header p { margin: 2px 0 0; font-size: var(--fs-2xs); color: var(--muted); }

.umd-body { flex: 1; overflow-y: auto; padding: 18px 20px 28px; }

.umd-create {
  display: flex; gap: 8px; margin-bottom: 18px;
  padding: 14px; border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--panel-2);
}
.umd-create input {
  flex: 1; padding: 8px 10px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--panel-3); color: var(--text);
  font-size: var(--fs-sm);
}
.umd-create input:focus { outline: none; border-color: var(--accent); }

.umd-msg { font-size: var(--fs-xs); margin-bottom: 12px; min-height: 16px; }
.umd-msg.error { color: var(--red); }
.umd-msg.ok { color: var(--green); }

.umd-row {
  border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 12px 14px; margin-bottom: 10px; background: var(--panel-2);
}
.umd-row-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.umd-row-id { min-width: 0; }
.umd-row-id .u-name { font-size: var(--fs-sm); font-weight: 600; color: var(--text); }
.umd-row-id .u-meta { font-size: var(--fs-2xs); color: var(--muted); margin-top: 2px; }
.umd-row-actions { display: flex; gap: 6px; flex-shrink: 0; }

.status-pill {
  font-size: var(--fs-2xs); font-weight: 700; letter-spacing: .04em;
  padding: 3px 10px; border-radius: 20px; cursor: pointer;
  user-select: none;
  border: 1px solid transparent;
}
.status-pill.enabled { background: rgba(52,168,112,.16); color: #7be3ae; border-color: rgba(52,168,112,.4); }
.status-pill.disabled { background: rgba(229,72,77,.16); color: #ffb3b4; border-color: rgba(229,72,77,.4); }
.status-pill[title] { position: relative; }

.umd-row-edit {
  display: none;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
  gap: 8px;
  flex-direction: column;
}
.umd-row.editing .umd-row-edit { display: flex; }
.umd-row-edit input {
  padding: 7px 9px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--panel-3); color: var(--text);
  font-size: var(--fs-sm);
}
.umd-row-edit .edit-actions { display: flex; gap: 8px; margin-top: 4px; }
.umd-row-edit .edit-actions .btn { margin: 0; flex: 1; }

.private-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border-soft);
  font-size: var(--fs-xs); color: var(--text-dim);
}
.private-link-mini {
  font-size: var(--fs-2xs); color: var(--muted); word-break: break-all;
  margin-top: 6px; background: var(--panel-3); border: 1px dashed var(--border);
  border-radius: var(--r-sm); padding: 6px 8px;
}

.toggle-switch {
  width: 34px; height: 19px; border-radius: 20px;
  background: var(--panel-3); border: 1px solid var(--border);
  position: relative; cursor: pointer; flex-shrink: 0;
  transition: background .15s ease, border-color .15s ease;
}
.toggle-switch::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--muted);
  transition: transform .15s ease, background .15s ease;
}
.toggle-switch.on { background: rgba(74,143,214,.25); border-color: rgba(74,143,214,.55); }
.toggle-switch.on::after { transform: translateX(15px); background: var(--accent); }

.cam-labels-readonly {
  font-size: var(--fs-2xs); color: var(--muted); margin-top: 4px;
}
.topbar .sub-badge.conn-bad::before { background: var(--red); }
