:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --border: #e2e5ea;
  --text: #1f2933;
  --muted: #6b7280;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --danger: #dc2626;
  --danger-hover: #b91c1c;
}

* { 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;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 1.1rem; margin: 0; }
.topbar a { color: var(--primary); text-decoration: none; }
.topbar a:hover { text-decoration: underline; }
.topbar .user { color: var(--muted); margin-right: 8px; }

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 16px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
}
.card h2 { margin: 0 0 12px; font-size: 1.1rem; }

label {
  display: block;
  margin-bottom: 12px;
  font-size: 0.9rem;
}
input[type="text"], input[type="password"], input[type="file"] {
  display: block;
  width: 100%;
  padding: 8px 10px;
  margin-top: 4px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem;
  background: #fff;
}

button {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 0.9rem;
  cursor: pointer;
}
button:hover { background: var(--primary-hover); }
button.danger { background: var(--danger); }
button.danger:hover { background: var(--danger-hover); }
button.link {
  background: none;
  color: var(--primary);
  padding: 0;
  font-size: 0.9rem;
}
button.link:hover { text-decoration: underline; background: none; }
button.link.danger { color: var(--danger); }

.muted { color: var(--muted); font-size: 0.9rem; }
.error {
  background: #fee2e2;
  color: #991b1b;
  padding: 8px 12px;
  border-radius: 6px;
  margin-bottom: 12px;
  font-size: 0.9rem;
}

/* Login */
.login-card {
  max-width: 360px;
  margin: 80px auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 28px;
}
.login-card h1 { margin: 0 0 16px; font-size: 1.3rem; }
.login-card .hint { color: var(--muted); font-size: 0.85rem; margin-top: 12px; }

/* Video block */
.video-block {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  margin-top: 16px;
}
.video-block:first-of-type { border-top: none; padding-top: 0; margin-top: 0; }
.video-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.video-head h3 { margin: 0 0 4px; font-size: 1rem; }

.inline-form {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 10px 0;
}
.inline-form input { width: auto; flex: 1; margin: 0; }
.inline { display: inline; }

/* Recipients table */
.recipients {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  font-size: 0.9rem;
}
.recipients th, .recipients td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
.recipients th { color: var(--muted); font-weight: 500; }
.row-actions { display: flex; gap: 10px; align-items: center; }
.row-actions a { color: var(--primary); text-decoration: none; font-size: 0.9rem; }
.row-actions a:hover { text-decoration: underline; }
.row-actions form { display: inline; }

.badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  vertical-align: middle;
}
.badge-muted { background: #e5e7eb; color: #4b5563; }
.badge-warn  { background: #fef3c7; color: #92400e; }
.badge-good  { background: #d1fae5; color: #065f46; }

.link-input {
  width: 100%;
  font-family: ui-monospace, monospace;
  font-size: 0.8rem;
  padding: 4px 6px;
  margin: 0;
}

/* Stats */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.stat {
  background: var(--bg);
  border-radius: 6px;
  padding: 12px;
  display: flex;
  flex-direction: column;
}
.stat-num {
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 4px;
}
.stat span:last-child { color: var(--muted); font-size: 0.85rem; }
