* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #f4f5f7;
  color: #1c1e21;
  overflow-x: hidden;
}
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  background: #111827;
  color: #fff;
  padding: 12px 16px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px 16px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar .brand { font-weight: 700; font-size: 17px; letter-spacing: .5px; }
.topbar nav {
  order: 3;
  flex-basis: 100%;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.topbar nav::-webkit-scrollbar { display: none; }
.topbar nav a {
  color: #cbd5e1;
  font-size: 13px;
  white-space: nowrap;
  padding: 6px 10px;
  border-radius: 7px;
  flex-shrink: 0;
}
.topbar nav a.active, .topbar nav a:hover { color: #fff; background: rgba(255,255,255,.08); text-decoration: none; }
.topbar .logout { color: #fca5a5; font-size: 13px; white-space: nowrap; }

.container { max-width: 1100px; margin: 20px auto; padding: 0 16px 40px; }

.card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 18px;
  margin-bottom: 16px;
  overflow-x: auto;
}

.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.stat-tile { background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; padding: 14px; min-width: 0; }
.stat-tile .value { font-size: 24px; font-weight: 700; word-break: break-word; }
.stat-tile .label { color: #6b7280; font-size: 12.5px; margin-top: 4px; }

.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid #eef0f2; white-space: nowrap; }
th { color: #6b7280; font-weight: 600; font-size: 12px; text-transform: uppercase; }
tr:hover td { background: #fafbfc; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge.green { background: #dcfce7; color: #166534; }
.badge.red { background: #fee2e2; color: #991b1b; }
.badge.gray { background: #f1f5f9; color: #475569; }
.badge.blue { background: #dbeafe; color: #1e40af; }
.badge.amber { background: #fef3c7; color: #92400e; }

.btn {
  display: inline-block;
  padding: 10px 14px;
  border-radius: 7px;
  border: 1px solid #d1d5db;
  background: #fff;
  color: #1c1e21;
  cursor: pointer;
  font-size: 14px;
  line-height: 1.2;
  touch-action: manipulation;
}
.btn:hover { background: #f3f4f6; text-decoration: none; }
.btn.primary { background: #2563eb; color: #fff; border-color: #2563eb; }
.btn.primary:hover { background: #1d4ed8; }
.btn.danger { background: #dc2626; color: #fff; border-color: #dc2626; }
.btn.danger:hover { background: #b91c1c; }
.btn.small { padding: 6px 10px; font-size: 12.5px; }

.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 13px; color: #374151; margin-bottom: 5px; font-weight: 600; }
.form-row input, .form-row select, .form-row textarea {
  width: 100%; padding: 10px; border: 1px solid #d1d5db; border-radius: 7px; font-size: 16px;
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}
.inline-form input, .inline-form select {
  padding: 9px 10px;
  border: 1px solid #d1d5db;
  border-radius: 7px;
  font-size: 16px;
  flex: 1 1 auto;
  min-width: 84px;
}
.inline-form input[type="text"], .inline-form input[type="number"] { max-width: 100%; }

.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 16px; }
.login-box { background: #fff; border-radius: 12px; padding: 32px 28px; width: 100%; max-width: 340px; box-shadow: 0 10px 40px rgba(0,0,0,.08); }
.login-box h1 { font-size: 20px; margin: 0 0 24px; text-align: center; letter-spacing: .5px; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.flash.error { background: #fee2e2; color: #991b1b; }
.flash.success { background: #dcfce7; color: #166534; }

.pagination { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.muted { color: #6b7280; font-size: 13px; }
.actions-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
video.circle-video { border-radius: 50%; width: 260px; height: 260px; max-width: 60vw; max-height: 60vw; object-fit: cover; background: #000; }
.tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs a { padding: 8px 14px; border-radius: 8px; background: #f1f5f9; color: #374151; font-size: 14px; }
.tabs a.active { background: #2563eb; color: #fff; }

.card-list { display: flex; flex-direction: column; gap: 10px; }
.card-list-item { margin-bottom: 0; padding: 14px 16px; }
.card-list-item-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.card-list-item-label { font-weight: 600; font-size: 15px; }
.card-list-item-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; color: #6b7280; font-size: 12.5px; margin-top: 8px; }
.card-list-item-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.card-list-item-actions form { margin: 0; }

@media (max-width: 640px) {
  .container { margin: 12px auto; padding: 0 10px 32px; }
  .card { padding: 14px; border-radius: 12px; }
  h2 { font-size: 19px; }
  h3 { font-size: 16px; }
  .topbar { padding: 10px 12px; }
  .actions-row > form { flex: 1 1 auto; }
  .actions-row > form .btn { width: 100%; }
  .inline-form { flex-direction: column; align-items: stretch; }
  .inline-form input, .inline-form select, .inline-form .btn { width: 100%; min-width: 0; }
  table th, table td { padding: 8px 6px; font-size: 13px; }
}
