:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --border: #2d3a4f;
  --text: #e7ecf3;
  --muted: #8b9cb3;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --success: #22c55e;
  --danger: #ef4444;
  --radius: 12px;
  --font: "Segoe UI", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: linear-gradient(160deg, #0f1419 0%, #1a2744 100%);
  color: var(--text);
  line-height: 1.6;
}

.wrap {
  max-width: 520px;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.sub {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 1.75rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.card h2 {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
}

.card ul {
  margin: 0;
  padding-right: 1.25rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.card li {
  margin-bottom: 0.35rem;
}

.optional-tag {
  display: inline-block;
  font-size: 0.75rem;
  background: #2d3a4f;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  margin-right: 0.35rem;
  color: #a8b8d0;
}

.btn-row {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

button {
  font-family: inherit;
  font-size: 1rem;
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

button:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.status {
  text-align: center;
  padding: 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.status.error {
  color: var(--danger);
}

.hidden {
  display: none !important;
}

video.preview {
  width: 100%;
  max-height: 240px;
  border-radius: var(--radius);
  background: #000;
  margin-top: 1rem;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.admin-header h1 {
  margin: 0;
  font-size: 1.35rem;
}

.visit-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.visit-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  font-size: 0.85rem;
}

.visit-item time {
  color: var(--muted);
  font-size: 0.8rem;
}

.visit-item .meta {
  margin-top: 0.5rem;
  color: var(--muted);
  word-break: break-all;
}

.visit-item img.thumb {
  max-width: 120px;
  border-radius: 8px;
  display: block;
  cursor: zoom-in;
}

.thumb-wrap {
  margin-top: 0.75rem;
  padding: 0;
  border: none;
  background: none;
  cursor: zoom-in;
}

.visit-item img.thumb:hover {
  opacity: 0.9;
}

.visit-item__actions {
  margin-top: 0.75rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
  font-size: 0.85rem;
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.12);
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.lightbox-img {
  max-width: min(96vw, 720px);
  max-height: 90vh;
  border-radius: 8px;
  object-fit: contain;
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  left: 1rem;
  width: 2.5rem;
  height: 2.5rem;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.25);
}

.device-summary {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.device-summary__head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
  flex-wrap: wrap;
}

.device-summary__title {
  font-weight: 600;
  font-size: 0.9rem;
}

.device-badge {
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: #2d3a4f;
  color: #c5d4eb;
}

.device-badge--mobile {
  background: #1e3a5f;
  color: #93c5fd;
}

.device-badge--bot {
  background: #4a2030;
  color: #fca5a5;
  margin-right: 0.35rem;
}

.visit-item--bot {
  opacity: 0.85;
  border-color: #5c3d48;
}

.filter-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  cursor: pointer;
}

.filter-check input {
  width: 1.1rem;
  height: 1.1rem;
}

.device-badge--tablet {
  background: #3b2f5c;
  color: #d8b4fe;
}

.device-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.45rem 0.75rem;
  font-size: 0.8rem;
}

.device-kv {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.device-k {
  color: var(--muted);
  font-size: 0.72rem;
}

.device-v {
  word-break: break-word;
}

.device-raw {
  margin-top: 0.65rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.device-raw pre {
  margin: 0.5rem 0 0;
  padding: 0.65rem;
  background: #0f1419;
  border-radius: 8px;
  overflow: auto;
  max-height: 220px;
  font-size: 0.68rem;
  direction: ltr;
  text-align: left;
}

.login-form label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.login-form input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  margin-bottom: 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #0f1419;
  color: var(--text);
  font-family: inherit;
}

.privacy-note {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 1.25rem;
  text-align: center;
}

/* Visitor: blank page + top permission bar */
body.visitor-blank {
  background: #fff;
  min-height: 100vh;
  margin: 0;
}
  position: fixed;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  left: -9999px;
}
