:root {
  --bg: #F3F6F7; --fg: #12303D; --muted: #566B76; --line: #D9E2E6; --line2: #C5D2D8;
  --accent: #0E7C86; --accent-bg: #E1F2F3; --accent-fg: #0B5F68;
  --warn-bg: #FFF0D1; --warn-fg: #8A4B00; --off-bg: #E8ECEF; --off-fg: #4B5563;
  --err-bg: #FDE7E7; --err-fg: #9B1C1C; --cam: #0F2530;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 14px/1.5 'Malgun Gothic', 'Apple SD Gothic Neo', system-ui, sans-serif; }
a { color: var(--accent-fg); }
.top { background: #fff; border-bottom: 1px solid var(--line); padding: 0 32px; min-height: 72px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 32px; }
.brand { display: flex; align-items: center; gap: 12px; }
.logo { width: 36px; height: 36px; border-radius: 10px; background: var(--accent); display: flex; align-items: center; justify-content: center; }
.brand-title { font-size: 18px; font-weight: 700; line-height: 1.2; }
.brand-sub { font-size: 12px; color: var(--muted); }
nav { display: flex; flex-wrap: wrap; gap: 4px; flex: 1 1 auto; }
nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: 10px; color: var(--fg); font-weight: 500; text-decoration: none; }
nav a[aria-current="page"] { background: var(--accent-bg); color: var(--accent-fg); font-weight: 700; }
.notice { background: var(--warn-bg); color: #6B3A00; font-size: 13px; padding: 8px 32px; }
main { padding: 24px 32px 48px; display: flex; flex-direction: column; gap: 24px; max-width: 1600px; }

.pill { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.pill.ok { background: var(--accent-bg); color: var(--accent-fg); }
.pill.warn { background: var(--warn-bg); color: var(--warn-fg); }
.pill.off, .pill.muted { background: var(--off-bg); color: var(--off-fg); }
.pill.err { background: var(--err-bg); color: var(--err-fg); }

.stats { display: flex; flex-wrap: wrap; gap: 16px; }
.stat { flex: 1 1 180px; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 16px 20px; }
.stat .l { font-size: 12px; color: var(--muted); }
.stat .v { font-size: 28px; font-weight: 700; line-height: 1.3; }
.stat .s { font-size: 13px; color: #4A606B; }

section.group { display: flex; flex-direction: column; gap: 12px; }
section.group > .gh { display: flex; align-items: baseline; gap: 10px; }
h2 { margin: 0; font-size: 18px; font-weight: 700; }
.caption { font-size: 13px; color: var(--muted); }
.cards { display: flex; flex-wrap: wrap; gap: 16px; }
.card { flex: 1 1 300px; min-width: 0; background: #fff; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; display: flex; flex-direction: column; }
.card.round { flex-basis: 420px; }
.card-head { padding: 14px 16px; display: flex; align-items: center; gap: 12px; }
.card-head h3 { margin: 0; font-size: 16px; font-weight: 700; line-height: 1.3; }
.card-head .k { font-size: 12px; color: var(--muted); }
.card-head .grow { flex: 1 1 auto; min-width: 0; }
.cams { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 2px; background: var(--cam); }
.cam { position: relative; aspect-ratio: 16 / 9; background: var(--cam) repeating-linear-gradient(135deg, rgba(255,255,255,.05) 0 12px, transparent 12px 24px); color: #B9CBD3; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.cam video-stream, .cam video { position: absolute; inset: 0; width: 100%; height: 100%; }
.cam video { object-fit: contain; background: #000; }
.cam .tag { position: absolute; top: 10px; left: 10px; font-size: 12px; padding: 3px 10px; border-radius: 999px; background: rgba(0,0,0,.55); color: #fff; z-index: 2; }
.cam .live { position: absolute; top: 10px; right: 10px; display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: rgba(0,0,0,.55); color: #fff; z-index: 2; }
.cam .live i { width: 8px; height: 8px; border-radius: 999px; background: #4FD1C5; }
.cam .live.offline { background: var(--off-bg); color: var(--off-fg); }
.cam .fs { position: absolute; bottom: 10px; right: 10px; width: 44px; height: 44px; border: 0; border-radius: 10px; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 2; }
.empty-cam { padding: 28px 16px; text-align: center; color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); }

.panel { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 20px 24px; display: flex; flex-direction: column; gap: 16px; }
.panel p { margin: 0; }
.btn { min-height: 44px; padding: 0 16px; border: 1px solid var(--line2); border-radius: 10px; background: #fff; color: var(--fg); font: inherit; cursor: pointer; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.btn.danger { color: var(--err-fg); border-color: #E5B4B4; }
.btn:disabled { opacity: .5; cursor: default; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
label.f input, label.f select { min-height: 44px; padding: 0 12px; border: 1px solid var(--line2); border-radius: 10px; font: inherit; color: var(--fg); background: #fff; min-width: 200px; }
.radio { display: flex; gap: 16px; align-items: center; min-height: 44px; }
.msg { padding: 12px 16px; border-radius: 10px; }
.msg.ok { background: var(--accent-bg); color: var(--accent-fg); }
.msg.err { background: var(--err-bg); color: var(--err-fg); }
.msg.warn { background: var(--warn-bg); color: var(--warn-fg); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid #E6ECEF; vertical-align: middle; }
th { font-size: 12px; color: var(--muted); font-weight: 500; }
td select, td input { min-height: 40px; padding: 0 8px; border: 1px solid var(--line2); border-radius: 8px; font: inherit; }
.steps { display: flex; gap: 8px; font-size: 13px; color: var(--muted); }
.steps b { color: var(--accent-fg); }
.preview { max-width: 640px; }
.hint { font-size: 12px; color: var(--muted); }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; z-index: 10; }
.modal[hidden] { display: none; }
.modal-box { background: #fff; border-radius: 16px; width: min(1280px, 96vw); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; }
.modal .cam { border-radius: 10px; }
