* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  background: #f4f6f8;
  color: #1f2933;
}

.topbar {
  background: #1f3a5f;
  color: #fff;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar h1 {
  font-size: 18px;
  margin: 0;
}

.topbar a {
  color: #cfe1ff;
  text-decoration: none;
  font-size: 14px;
}

.topbar a:hover {
  text-decoration: underline;
}

.page {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

.card {
  background: #fff;
  border-radius: 10px;
  padding: 20px 24px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

h2 {
  margin-top: 0;
  font-size: 18px;
}

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  width: 340px;
}

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: 13px;
  color: #52606d;
  margin-bottom: 4px;
}

input[type="text"],
input[type="password"],
input[type="number"] {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid #cbd2d9;
  border-radius: 6px;
  font-size: 14px;
}

.btn {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 6px;
  border: 1px solid #cbd2d9;
  background: #fff;
  color: #1f2933;
  cursor: pointer;
  font-size: 14px;
  text-decoration: none;
}

.btn:hover {
  background: #f0f4f8;
}

.btn-primary {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}

.btn-primary:hover {
  background: #1d4ed8;
}

.btn-danger {
  background: #fff;
  border-color: #e12d39;
  color: #e12d39;
}

.btn-danger:hover {
  background: #fde8e8;
}

.btn-block {
  width: 100%;
}

.error-msg {
  background: #fde8e8;
  color: #b3261e;
  padding: 10px 14px;
  border-radius: 6px;
  margin-bottom: 16px;
  font-size: 14px;
}

.facility-add {
  display: flex;
  gap: 10px;
}

.facility-add input {
  flex: 1;
}

.facility-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.facility-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border: 1px solid #e4e7eb;
  border-radius: 8px;
}

.facility-info .name {
  font-weight: 600;
  font-size: 15px;
}

.facility-info .url {
  font-size: 13px;
  color: #616e7c;
  margin-top: 2px;
}

.facility-actions {
  display: flex;
  gap: 8px;
}

.upload-form {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-end;
}

.upload-form .field {
  margin-bottom: 0;
}

.upload-form .files-field {
  flex: 1;
  min-width: 240px;
}

.seconds-field input {
  width: 80px;
}

.media-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.media-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  border: 1px solid #e4e7eb;
  border-radius: 8px;
}

.media-thumb {
  width: 64px;
  height: 48px;
  border-radius: 4px;
  background: #e4e7eb;
  object-fit: cover;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #9aa5b1;
}

.media-info {
  flex: 1;
  min-width: 0;
}

.media-name {
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e4e7eb;
  color: #52606d;
  margin-top: 3px;
}

.badge-image { background: #d7f3e3; color: #1a7f4c; }
.badge-video { background: #dbe7ff; color: #1d4ed8; }

.media-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.move-form, .seconds-form, .delete-form {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.empty-msg {
  color: #9aa5b1;
  font-size: 14px;
  padding: 20px 0;
  text-align: center;
}
