:root {
  --bg: #f4f6f8;
  --card: #fff;
  --text: #1d2730;
  --muted: #667684;
  --accent: #1f6f5c;
  --danger: #b3261e;
  --border: #dbe2e8;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a { color: var(--accent); }

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding: 0.75rem 1.25rem;
  background: var(--accent);
  color: #fff;
}
.site-header a, .site-header .link { color: #fff; text-decoration: none; }
.site-header .brand { font-size: 1.25rem; font-weight: 700; }
.site-header nav { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 1rem; }

main { max-width: 860px; margin: 0 auto; padding: 1.25rem; }

h1 { margin-top: 0; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}
.card.narrow { max-width: 420px; margin-left: auto; margin-right: auto; }
.card h2 { margin-top: 0; }

.muted { color: var(--muted); font-size: 0.9rem; }

label { display: block; margin-bottom: 0.9rem; font-weight: 600; }
label.check { font-weight: 400; }
input[type=text], input[type=password], select, textarea {
  display: block;
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.55rem 0.65rem;
  font: inherit;
  border: 1px solid var(--border);
  border-radius: 6px;
}
input[type=file] { display: block; margin-top: 0.35rem; }

button, .button {
  display: inline-block;
  padding: 0.55rem 1rem;
  font: inherit;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
}
button.secondary, .button.secondary { background: #51606d; }
button.danger { background: var(--danger); }
button.link {
  padding: 0;
  background: none;
  color: var(--accent);
  text-decoration: underline;
}
.site-header button.link { color: #fff; }

form.inline { display: inline-flex; gap: 0.35rem; align-items: center; }
form.inline input[type=text] { margin: 0; width: 10rem; }

.flash { padding: 0.75rem 1rem; border-radius: 6px; margin-bottom: 1rem; }
.flash-error { background: #fde8e6; color: var(--danger); }
.flash-success { background: #e2f4ec; color: #14573f; }

.post .body p { margin: 0 0 0.9rem; }
.actions { display: flex; gap: 0.5rem; margin-top: 1rem; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 0.5rem; margin-top: 0.75rem; }
.gallery img { width: 100%; height: 160px; object-fit: cover; border-radius: 6px; display: block; }
.thumb { font-weight: 400; font-size: 0.85rem; }

.pager { display: flex; justify-content: space-between; align-items: center; margin: 1rem 0; }

.qr { display: block; margin: 0.5rem auto; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.5rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.row-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.video-wrap { position: relative; background: #000; border-radius: 6px; overflow: hidden; aspect-ratio: 16 / 9; }
.video-wrap video-stream { display: block; width: 100%; height: 100%; }
.video-wrap:fullscreen { aspect-ratio: auto; border-radius: 0; }
.talk { display: flex; align-items: center; gap: 0.75rem; margin-top: 1rem; }
.talk button { min-width: 8rem; }
.fullscreen-btn { position: absolute; top: 0.5rem; right: 0.5rem; width: 2.5rem; height: 2.5rem; padding: 0; font-size: 1.3rem; background: rgba(0, 0, 0, 0.55); }

.ptz { display: flex; flex-wrap: wrap; gap: 1.5rem; margin-top: 1rem; }
.ptz .pad { display: grid; grid-template-columns: repeat(3, 3.5rem); grid-auto-rows: 3.5rem; gap: 0.35rem; }
.ptz .pad button { padding: 0; font-size: 1.4rem; touch-action: none; user-select: none; }
.ptz .pad .stop { background: var(--danger); }
.ptz .side { flex: 1; min-width: 220px; }
.ptz .zoom { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.ptz .zoom button { touch-action: none; user-select: none; }
.camera-shortcuts { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }

.camera-features { margin-top: 1.25rem; border-top: 1px solid var(--border); padding-top: 1rem; }
.camera-features h2 { margin: 0 0 0.75rem; font-size: 1.05rem; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.6rem 1rem; align-items: end; }
.feature-grid > button { width: max-content; }
.raw-command { margin-top: 1rem; }
.mono { white-space: pre-wrap; max-height: 16rem; overflow: auto; background: #f5f7fa; border: 1px solid var(--border); border-radius: 6px; padding: 0.6rem; font-family: ui-monospace, Menlo, Monaco, Consolas, monospace; font-size: 0.85rem; }
.error { color: var(--danger); }
