/* Danh tính - Thuộc tính > Cấu hình (faces-config.js): camera | ảnh để vẽ vùng | thông tin camera + vùng giám sát.
   Cùng bố cục với Giao thông > Cấu hình (traffic-config.css), lớp riêng tiền tố fc- để hai trang không ràng buộc nhau. */
#fcView { display: none; }
body.fc-cfg .wrap, body.fc-cfg #camstrip { display: none; }
body.fc-cfg #fcView { display: grid; grid-template-columns: 290px minmax(0, 1fr) 400px; gap: 16px; padding: 16px; height: calc(100vh - 58px); }
body.tab-traffic #fcView { display: none; }

.fc-side { display: flex; flex-direction: column; gap: 10px; padding: 14px; min-height: 0; }
.fc-stat { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; }
.fc-stat .tag { font-size: 11px; padding: 1px 8px; }
.fc-stat > div { flex-basis: 100%; color: var(--muted); }
.fc-box { border: 1px solid rgba(250,204,21,.45); background: rgba(250,204,21,.07); border-radius: 9px; padding: 10px 12px; font-size: 12.5px; line-height: 1.5; }
.fc-box .btn { width: 100%; justify-content: center; margin-top: 8px; }
.fc-cams { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 3px; }
.fc-cams .crow { padding: 6px 8px; min-height: 46px; text-align: left; }
.fc-cams .crow .nm { display: flex; flex-direction: column; gap: 1px; }
.fc-cams .crow .nm small { color: var(--dim); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fc-cams .crow .d.warn { background: var(--warn); } .fc-cams .crow .d.off { background: #5b6675; }
.fc-cams .crow .rb { font-size: 10.5px; padding: 0 6px; border-radius: 6px; border: 1px solid var(--line2); color: var(--muted); flex: none; }
.fc-newrow { cursor: default; border-style: dashed !important; }
.fc-side > .btn { justify-content: center; }

.fc-stage { display: flex; flex-direction: column; min-height: 0; min-width: 0; overflow: hidden; }
.fc-bar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.fc-bar .muted { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fc-canvas { position: relative; flex: 1; min-height: 0; display: grid; place-items: center; padding: 12px; background: #0b1016; }
.fc-pic { position: relative; max-width: 100%; max-height: 100%; aspect-ratio: 16 / 9; width: 100%; border-radius: 6px; overflow: hidden; background: #111820; }
#fcLive { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; pointer-events: none; }
.fc-pic img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; user-select: none; -webkit-user-drag: none; }
.fc-noimg { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center; color: var(--muted); font-size: 13.5px; background: rgba(11,16,22,.6); pointer-events: none; }
.fc-noimg[hidden] { display: none; }
#fcSvg { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
#fcSvg.drawing { cursor: crosshair; }
#fcSvg .rp { fill: rgba(61,139,253,.18); stroke: #3d8bfd; stroke-width: 2px; vector-effect: non-scaling-stroke; cursor: pointer; }
#fcSvg .rp.sel { fill: rgba(250,204,21,.18); stroke: #facc15; }
#fcSvg .rd { fill: none; stroke: #facc15; stroke-width: 2px; stroke-dasharray: 6 4; vector-effect: non-scaling-stroke; }
#fcSvg .rh { fill: #fff; stroke: #0b1016; stroke-width: 1px; vector-effect: non-scaling-stroke; cursor: grab; }
#fcSvg .rh.first { fill: #facc15; }
.fc-hint { min-height: 40px; padding: 10px 14px; border-top: 1px solid var(--line); font-size: 12.5px; color: #c9d3df; }

.fc-panel { display: flex; flex-direction: column; gap: 10px; padding: 14px; min-height: 0; overflow-y: auto; }
.fc-form { display: flex; flex-wrap: wrap; gap: 10px; }
.fc-form .fld { flex: 1 1 150px; }
.fc-form .fld.w2 { flex: 1 1 100%; }
.fc-form input:disabled { opacity: .6; }
.fc-row { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.fc-err { color: #fca5a5; font-size: 12px; word-break: break-word; }
.fc-roi { border: 1px solid var(--line2); border-left: 3px solid #3d8bfd; border-radius: 9px; background: var(--panel); padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.fc-roi .tools { display: flex; flex-wrap: wrap; gap: 6px; }
.fc-roi .muted { font-size: 12px; }
.fc-acts { display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.fc-acts .danger { color: #fca5a5; border-color: rgba(248,113,113,.5); }
.fc-disp { margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; font-size: 12.5px; }
.fc-disp .q { display: flex; align-items: center; gap: 10px; }
.fc-disp input[type=range] { flex: 1; accent-color: var(--accent); }
.fc-disp input[type=number] { width: 76px; height: 32px; background: var(--panel2); border: 1px solid var(--line2); border-radius: 8px; padding: 0 8px; color: var(--text); }
.tgl { position: relative; flex: none; width: 34px; height: 19px; --fc: #22c55e; }
.tgl input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.tgl i { position: absolute; inset: 0; border-radius: 999px; background: var(--panel3); border: 1px solid var(--line2); transition: .15s; pointer-events: none; }
.tgl i::after { content: ''; position: absolute; top: 2px; left: 2px; width: 13px; height: 13px; border-radius: 50%; background: #8b98a9; transition: .15s; }
.tgl input:checked + i { background: var(--fc); border-color: var(--fc); }
.tgl input:checked + i::after { left: 17px; background: #fff; }
.tgl input:disabled + i { opacity: .4; }

@media (max-width: 1100px) {
  body.fc-cfg #fcView { grid-template-columns: 1fr; height: auto; }
  .fc-cams { max-height: 260px; }
}
