* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #0f1117;
  color: #e1e4e8;
  line-height: 1.5;
}

header {
  background: #161b22;
  border-bottom: 1px solid #30363d;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

header h1 { font-size: 1.25rem; font-weight: 600; }

nav { display: flex; gap: 0.5rem; margin-left: auto; }

nav button {
  background: transparent;
  border: 1px solid #30363d;
  color: #c9d1d9;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
}
nav button:hover { background: #21262d; }
nav button.active { background: #1f6feb; border-color: #1f6feb; color: #fff; }

main { max-width: 800px; margin: 2rem auto; padding: 0 1rem; }

.section { display: none; }
.section.active { display: block; }

h2 { font-size: 1.1rem; margin-bottom: 1rem; }

.card {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}

label { display: block; font-size: 0.85rem; color: #8b949e; margin-bottom: 0.25rem; }

input[type="text"], input[type="number"], textarea {
  width: 100%;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 6px;
  color: #e1e4e8;
  padding: 0.5rem;
  font-size: 0.9rem;
}

button.primary {
  background: #238636;
  color: #fff;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  margin-top: 0.5rem;
}
button.primary:hover { background: #2ea043; }
button.primary:disabled { opacity: 0.5; cursor: not-allowed; }

button.danger {
  background: #da3633;
  color: #fff;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

.status-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 0.5rem;
}
.status-dot.connected { background: #3fb950; }
.status-dot.disconnected { background: #f85149; }

.toggle {
  position: relative;
  display: inline-block;
  width: 44px; height: 24px;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle .slider {
  position: absolute; inset: 0;
  background: #30363d;
  border-radius: 12px;
  cursor: pointer;
  transition: 0.2s;
}
.toggle .slider::before {
  content: "";
  position: absolute;
  width: 18px; height: 18px;
  left: 3px; bottom: 3px;
  background: #e1e4e8;
  border-radius: 50%;
  transition: 0.2s;
}
.toggle input:checked + .slider { background: #238636; }
.toggle input:checked + .slider::before { transform: translateX(20px); }

.cam-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; }
.cam-header h3 { font-size: 1rem; }

.cam-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }

.clip-list { list-style: none; }
.clip-list li {
  padding: 0.5rem 0;
  border-bottom: 1px solid #21262d;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.clip-list li:last-child { border-bottom: none; }
.clip-info { font-size: 0.85rem; }
.clip-info .camera { color: #58a6ff; }
.clip-info .time { color: #8b949e; }
.clip-info .size { color: #8b949e; font-size: 0.8rem; }

video { max-width: 100%; border-radius: 6px; margin-top: 0.5rem; }

.empty { color: #8b949e; text-align: center; padding: 2rem; }

.msg {
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
}
.msg.error { background: #3d1a1a; border: 1px solid #f85149; color: #f85149; }
.msg.success { background: #1a3d1a; border: 1px solid #3fb950; color: #3fb950; }
